<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>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 *
 * @license http://litus.cc/LICENSE
 */

namespace BrBundle\Form\Career\Match\Company;

use BrBundle\Entity\Match\Profile;
use Laminas\Validator\Identical;

/**
 * Add Profile
 *
 * @author <NAME> <<EMAIL>>
 */
class Add extends \CommonBundle\Component\Form\Bootstrap\Form
{
    protected $hydrator = 'BrBundle\Hydrator\Match\Profile';

    /**
     * @var array All possible features
     */
    protected $features;

    public function init()
    {

        parent::init();


        foreach ($this->getFeatureNames() as $featureId => $featureName) {
            $this->add(
                array(
                    'type'       => 'select',
                    'name'       => 'feature_'.$featureId,
                    'label'      => $featureName,
                    'value'      => ' ',
                    'attributes' => array(
                        'style'   => 'max-height: 38px;height:38px;max-width:150px;',
                        'options' => $this->makeOptions(),
                    ),
                    'options'    => array(
                        'input' => array(
                            'filters' => array(
                                array('name' => 'StringTrim'),
                            ),
                            'validators' => array(
                                array(
                                    'name' => 'FeatureImportanceConstraint',
                                ),
                            ),
                        ),

                    ),
                )
            );
        }

        // Sector features
        foreach ($this->getSectorFeatureNames() as $featureId => $featureName){
            $this->add(
                array(
                    'type'       => 'select',
                    'name'       => 'sector_feature_'.$featureId,
                    'label'      => 'Sector Feature: '.$featureName,
                    'value'      => 0,
                    'attributes' => array(
                        'style'   => 'max-height: 38px;height:38px;max-width:150px;',
                        'options'  => $this->makeSectorOptions(),
                    ),
                    'options' => array(
                        'input' => array(
                            'filters' => array(
                                array('name' => 'StringTrim'),
                            ),
                            'validators' => array(
                                array(
                                    'name'    => 'SectorImportanceConstraint',
                                ),
                            ),
                        ),

                    ),
                )
            );
        }

        $this->add(
            array(
                'type'       => 'checkbox',
                'name'       => 'conditions',
                'label'      => 'I have read and accept the terms specified above',
                'attributes' => array(
                    'id' => 'conditions',
                ),
                'options'    => array(
                    'input' => array(
                        'validators' => array(
                            array(
                                'name'    => 'identical',
                                'options' => array(
                                    'token'    => true,
                                    'strict'   => false,
                                    'messages' => array(
                                        Identical::NOT_SAME => 'You must agree to the terms and conditions.',
                                    ),
                                ),
                            ),
                        ),
                    ),
                ),
            )
        );

        $this->addSubmit('Add', 'profile_add');
    }

    /**
     * @return array
     */
    private function getFeatureNames()
    {
        $featureNames = array();
        foreach ($this->getEntityManager()->getRepository('BrBundle\Entity\Match\Feature')->findAll() as $feature) {
            if (!$feature->isSector() && ($feature->getType() == 'company' || $feature->getType() == null)){
                $featureNames[$feature->getId()] = $feature->getName();
            }
        }

        return $featureNames;
    }

    /**
     * @return array
     */
    private function makeOptions()
    {

        $options = array(' ');
        foreach (Profile\ProfileFeatureMap::$POSSIBLE_VISIBILITIES as $val => $type) {
            $options[$val] = $type;
        }

        return $options;
    }

    /**
     * @return array
     */
    private function getSectorFeatureNames()
    {
        $featureNames = array();
        foreach ($this->getEntityManager()->getRepository('BrBundle\Entity\Match\Feature')->findAll() as $feature) {
            if ($feature->isSector())
                $featureNames[$feature->getId()] = $feature->getName();
        }

        return $featureNames;
    }

    /**
     * @return array
     */
    private function makeSectorOptions()
    {
        $amt = $this->getEntityManager()
            ->getRepository('CommonBundle\Entity\General\Config')
            ->getConfigValue('br.match_sector_feature_max_points');
        return range(0,$amt);
    }

    /**
     * @param  array All possible features
     * @return self
     */
    public function setFeatures(array $features)
    {
        $this->features = $features;

        return $this;
    }
}
<commit_msg>Update Add.php<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>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 *
 * @license http://litus.cc/LICENSE
 */

namespace BrBundle\Form\Career\Match\Company;

use BrBundle\Entity\Match\Profile;
use Laminas\Validator\Identical;

/**
 * Add Profile
 *
 * @author <NAME> <<EMAIL>>
 */
class Add extends \CommonBundle\Component\Form\Bootstrap\Form
{
    protected $hydrator = 'BrBundle\Hydrator\Match\Profile';

    /**
     * @var array All possible features
     */
    protected $features;

    public function init()
    {

        parent::init();


        foreach ($this->getFeatureNames() as $featureId => $featureName) {
            $this->add(
                array(
                    'type'       => 'select',
                    'name'       => 'feature_'.$featureId,
                    'label'      => $featureName,
                    'value'      => ' ',
                    'attributes' => array(
                        'style'   => 'max-height: 38px;height:38px;max-width:150px;',
                        'options' => $this->makeOptions(),
                    ),
                    'options'    => array(
                        'input' => array(
                            'filters' => array(
                                array('name' => 'StringTrim'),
                            ),
                            'validators' => array(
                                array(
                                    'name' => 'FeatureImportanceConstraint',
                                ),
                            ),
                        ),

                    ),
                )
            );
        }

        // Sector features
        foreach ($this->getSectorFeatureNames() as $featureId => $featureName){
            $this->add(
                array(
                    'type'       => 'select',
                    'name'       => 'sector_feature_'.$featureId,
                    'label'      => 'Sector Feature: '.$featureName,
                    'value'      => 0,
                    'attributes' => array(
                        'style'   => 'max-height: 38px;height:38px;max-width:150px;',
                        'options'  => $this->makeSectorOptions(),
                    ),
                    'options' => array(
                        'input' => array(
                            'filters' => array(
                                array('name' => 'StringTrim'),
                            ),
                            'validators' => array(
                                array(
                                    'name'    => 'SectorImportanceConstraint',
                                ),
                            ),
                        ),

                    ),
                )
            );
        }

        $this->add(
            array(
                'type'       => 'checkbox',
                'name'       => 'conditions',
                'label'      => 'The information provided in this survey may be used within this application. My personal information may be shared with companies matched to my profile.',
                'attributes' => array(
                    'id' => 'conditions',
                ),
                'options'    => array(
                    'input' => array(
                        'validators' => array(
                            array(
                                'name'    => 'identical',
                                'options' => array(
                                    'token'    => true,
                                    'strict'   => false,
                                    'messages' => array(
                                        Identical::NOT_SAME => 'You must agree to the terms and conditions.',
                                    ),
                                ),
                            ),
                        ),
                    ),
                ),
            )
        );

        $this->addSubmit('Add', 'profile_add');
    }

    /**
     * @return array
     */
    private function getFeatureNames()
    {
        $featureNames = array();
        foreach ($this->getEntityManager()->getRepository('BrBundle\Entity\Match\Feature')->findAll() as $feature) {
            if (!$feature->isSector() && ($feature->getType() == 'company' || $feature->getType() == null)){
                $featureNames[$feature->getId()] = $feature->getName();
            }
        }

        return $featureNames;
    }

    /**
     * @return array
     */
    private function makeOptions()
    {

        $options = array(' ');
        foreach (Profile\ProfileFeatureMap::$POSSIBLE_VISIBILITIES as $val => $type) {
            $options[$val] = $type;
        }

        return $options;
    }

    /**
     * @return array
     */
    private function getSectorFeatureNames()
    {
        $featureNames = array();
        foreach ($this->getEntityManager()->getRepository('BrBundle\Entity\Match\Feature')->findAll() as $feature) {
            if ($feature->isSector())
                $featureNames[$feature->getId()] = $feature->getName();
        }

        return $featureNames;
    }

    /**
     * @return array
     */
    private function makeSectorOptions()
    {
        $amt = $this->getEntityManager()
            ->getRepository('CommonBundle\Entity\General\Config')
            ->getConfigValue('br.match_sector_feature_max_points');
        return range(0,$amt);
    }

    /**
     * @param  array All possible features
     * @return self
     */
    public function setFeatures(array $features)
    {
        $this->features = $features;

        return $this;
    }
}

{'fraction_non_alphanumeric': 0.1332835697105416, 'fraction_numerical': 0.002654059882226093, 'mean_word_length': 1.1273817925194072, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 213, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1454381', 'n_tokens_mistral': 3086, 'n_tokens_neox': 2917, 'n_words': 604}