<commit_before><?php

/*
 * This file is part of the RollerworksMultiUserBundle package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Rollerworks\Bundle\MultiUserBundle\Model;

use FOS\UserBundle\Model\UserManagerInterface;
use FOS\UserBundle\Model\GroupManagerInterface;
use Rollerworks\Bundle\MultiUserBundle\Exception\MissingTemplateException;

/**
 * UserConfiguration, holds the configuration of a user in the system.
 *
 * @author <NAME> <<EMAIL>>
 */
class UserConfig
{
    protected $servicePrefix;
    protected $routePrefix;
    protected $templates;
    protected $forms;
    protected $config;

    protected $userManager;
    protected $groupManager;

    /**
     * Constructor.
     *
     * @param string                $servicePrefix
     * @param string                $routePrefix
     * @param UserManagerInterface  $userManager
     * @param GroupManagerInterface $groupManager
     */
    public function __construct($servicePrefix, $routePrefix, UserManagerInterface $userManager, GroupManagerInterface $groupManager)
    {
        $this->servicePrefix = $servicePrefix;
        $this->routePrefix = $routePrefix;
        $this->userManager = $userManager;
        $this->groupManager = $groupManager;
        $this->templates = array();
        $this->forms = array();
        $this->config = array();
    }

    /**
     * Set a config.
     *
     * @param string $name
     * @param mixed  $value
     */
    public function setConfig($name, $value)
    {
        $this->config[$name] = $value;
    }

    /**
     * @param string  $name
     * @param integer $defaultValue
     *
     * @return mixed
     */
    public function getConfig($name, $defaultValue = null)
    {
        return array_key_exists($name, $this->config) ? $this->config[$name] : $defaultValue;
    }

    /**
     * Set the form configuration.
     *
     * @param string $name
     * @param string $formName
     * @param string $type
     * @param array  $validationGroups
     *
     * @return static
     */
    public function setForm($name, $formName, $type, array $validationGroups)
    {
        $this->forms[$name] = array('type' => $type, 'name' => $formName, 'validation_groups' => $validationGroups);

        return $this;
    }

    /**
     * Set the template configuration.
     *<commit_msg>fix phpdoc<commit_after><?php

/*
 * This file is part of the RollerworksMultiUserBundle package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Rollerworks\Bundle\MultiUserBundle\Model;

use FOS\UserBundle\Model\UserManagerInterface;
use FOS\UserBundle\Model\GroupManagerInterface;
use Rollerworks\Bundle\MultiUserBundle\Exception\MissingTemplateException;

/**
 * UserConfiguration, holds the configuration of a user in the system.
 *
 * @author <NAME> <<EMAIL>>
 */
class UserConfig
{
    protected $servicePrefix;
    protected $routePrefix;
    protected $templates;
    protected $forms;
    protected $config;

    protected $userManager;
    protected $groupManager;

    /**
     * Constructor.
     *
     * @param string                $servicePrefix
     * @param string                $routePrefix
     * @param UserManagerInterface  $userManager
     * @param GroupManagerInterface $groupManager
     */
    public function __construct($servicePrefix, $routePrefix, UserManagerInterface $userManager, GroupManagerInterface $groupManager)
    {
        $this->servicePrefix = $servicePrefix;
        $this->routePrefix = $routePrefix;
        $this->userManager = $userManager;
        $this->groupManager = $groupManager;
        $this->templates = array();
        $this->forms = array();
        $this->config = array();
    }

    /**
     * Set a config.
     *
     * @param string                       $name
     * @param string|integer|boolean|array $value
     */
    public function setConfig($name, $value)
    {
        $this->config[$name] = $value;
    }

    /**
     * @param string                       $name
     * @param string|integer|boolean|array $defaultValue
     *
     * @return string|integer|boolean|array
     */
    public function getConfig($name, $defaultValue = null)
    {
        return array_key_exists($name, $this->config) ? $this->config[$name] : $defaultValue;
    }

    /**
     * Set the form configuration.
     *
     * @param string $name
     * @param string $formName
     * @param string $type
     * @param array  $validationGroups
     *
     * @return static
     */
    public function setForm($name, $formName, $type, array $validationGroups)
    {
        $this->forms[$name] = array('type' => $type, 'name' => $formName, 'validation_groups' => $validationGroups);

        return $this;
    }

    /**
     * Set the template configuration.
     *
{'fraction_non_alphanumeric': 0.1178714859437751, 'fraction_numerical': 0.0, 'mean_word_length': 2.614658925979681, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7057439', 'n_tokens_mistral': 1394, 'n_tokens_neox': 1374, 'n_words': 349}