<?php

namespace External\SprintBundle\Context;

class UserContext extends \KupShop\KupShopBundle\Context\UserContext
{
    protected $config;

    public function isDealer()
    {
        if ($user = $this->getActive()) {
            foreach ($this->config['dealer_group_ids'] ?? [] as $group) {
                if ($user->hasGroupId($group)) {
                    return true;
                }
            }
        }

        return false;
    }

    public function setConfig($config): void
    {
        $this->config = $config;
    }
}
