<commit_before><?php
/**
 * Litus is a project by a group of students from the KU Leuven. The goal is to create
 * various applications to support the IT needs of student unions.
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 *
 * @license http://litus.cc/LICENSE
 */

namespace CommonBundle\Form\Address;

use CommonBundle\Component\Form\Bootstrap\Element\Select,
    CommonBundle\Component\Form\Bootstrap\Element\Text,
    CommonBundle\Component\Validator\NotZero as NotZeroValidator,
    Doctrine\ORM\EntityManager,
    Zend\Cache\Storage\StorageInterface as CacheStorage,
    Zend\InputFilter\InputFilter,
    Zend\InputFilter\Factory as InputFactory;

/**
 * Add Address
 *
 * @author <NAME> <<EMAIL>>
 */
class AddPrimary extends \CommonBundle\Component\Form\Bootstrap\Element\Collection
{
    /**
     * @var \Doctrine\ORM\EntityManager The EntityManager instance
     */
    protected $_entityManager = null;

    /**
     * @var \Zend\Cache\Storage\StorageInterface The cache instance
     */
    protected $_cache = null;

    /**
     * @var string The form's prefix
     */
    private $_prefix;

    /**
     * @var boolean Whether or not the form is required
     */
    private $_required;

    /**
     * @param \Zend\Cache\Storage\StorageInterface $cache The cache instance
     * @param \Doctrine\ORM\EntityManager $entityManager The EntityManager instance
     * @param string $prefix
     * @param null|string|int $name Optional name for the element
     * @param boolean $required Whether or not the address is required
     */
    public function __construct(CacheStorage $cache, EntityManager $entityManager, $prefix = '', $name = null, $required = true)
    {
        parent::__construct($name);

        $this->_entityManager = $entityManager;
        $this->_cache = $cache;

        $prefix = '' == $prefix ? '' : $prefix . '_';
        $this->_prefix = $prefix;
        $this->_required = $required;

        list($cities, $streets) = $this->_getCities();

        $field = new Select($prefix . 'address_city');
        $field->setLabel('City')
            ->setAttribute('class', $field->getAttribute('class') . ' input-large')
            ->setAttribute('options', $cities);
            ->setRequired($this->_required);
        $this->add($field);

        $field = new Text($prefix . 'address_postal_other');
        $field->setLabel('Postal Code')
            ->setAttribute('class', $field->getAttribute('class') . ' input-medium')
            ->setRequired($this->_required);
        $this->add($field);

        $field = new Text($prefix . 'address_city_other');
        $field->setLabel('City')
            ->setAttribute('class', $field->getAttribute('class') . ' input-large')
            ->setRequired($this->_required);
        $this->add($field);

        $field = new Text($prefix . 'address_street_other');<commit_msg>Bugfix<commit_after><?php
/**
 * Litus is a project by a group of students from the KU Leuven. The goal is to create
 * various applications to support the IT needs of student unions.
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 *
 * @license http://litus.cc/LICENSE
 */

namespace CommonBundle\Form\Address;

use CommonBundle\Component\Form\Bootstrap\Element\Select,
    CommonBundle\Component\Form\Bootstrap\Element\Text,
    CommonBundle\Component\Validator\NotZero as NotZeroValidator,
    Doctrine\ORM\EntityManager,
    Zend\Cache\Storage\StorageInterface as CacheStorage,
    Zend\InputFilter\InputFilter,
    Zend\InputFilter\Factory as InputFactory;

/**
 * Add Address
 *
 * @author <NAME> <<EMAIL>>
 */
class AddPrimary extends \CommonBundle\Component\Form\Bootstrap\Element\Collection
{
    /**
     * @var \Doctrine\ORM\EntityManager The EntityManager instance
     */
    protected $_entityManager = null;

    /**
     * @var \Zend\Cache\Storage\StorageInterface The cache instance
     */
    protected $_cache = null;

    /**
     * @var string The form's prefix
     */
    private $_prefix;

    /**
     * @var boolean Whether or not the form is required
     */
    private $_required;

    /**
     * @param \Zend\Cache\Storage\StorageInterface $cache The cache instance
     * @param \Doctrine\ORM\EntityManager $entityManager The EntityManager instance
     * @param string $prefix
     * @param null|string|int $name Optional name for the element
     * @param boolean $required Whether or not the address is required
     */
    public function __construct(CacheStorage $cache, EntityManager $entityManager, $prefix = '', $name = null, $required = true)
    {
        parent::__construct($name);

        $this->_entityManager = $entityManager;
        $this->_cache = $cache;

        $prefix = '' == $prefix ? '' : $prefix . '_';
        $this->_prefix = $prefix;
        $this->_required = $required;

        list($cities, $streets) = $this->_getCities();

        $field = new Select($prefix . 'address_city');
        $field->setLabel('City')
            ->setAttribute('class', $field->getAttribute('class') . ' input-large')
            ->setAttribute('options', $cities)
            ->setRequired($this->_required);
        $this->add($field);

        $field = new Text($prefix . 'address_postal_other');
        $field->setLabel('Postal Code')
            ->setAttribute('class', $field->getAttribute('class') . ' input-medium')
            ->setRequired($this->_required);
        $this->add($field);

        $field = new Text($prefix . 'address_city_other');
        $field->setLabel('City')
            ->setAttribute('class', $field->getAttribute('class') . ' input-large')
            ->setRequired($this->_required);
        $this->add($field);

        $field = new Text($prefix . 'address_street_other');
{'fraction_non_alphanumeric': 0.1460731211916046, 'fraction_numerical': 0.0, 'mean_word_length': 2.9003300330033004, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 87, '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': '6952614', 'n_tokens_mistral': 1667, 'n_tokens_neox': 1655, 'n_words': 401}