<commit_before><?php

namespace Symfony\Component\Validator\Mapping\Loader;

/*
 * This file is part of the Symfony framework.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

use Symfony\Component\Validator\Exception\MappingException;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Doctrine\Common\Annotations\AnnotationReader;
use Symfony\Component\Validator\Constraints\Validation;
use Symfony\Component\Validator\Constraint;

class AnnotationLoader implements LoaderInterface
{
    protected $reader;

    public function __construct()
    {
        $this->reader = new AnnotationReader();
        $this->reader->setAutoloadAnnotations(true);
        $this->reader->setAnnotationNamespaceAlias('Symfony\Component\Validator\Constraints\\', 'validation');
    }

    /**
     * {@inheritDoc}
     */
    public function loadClassMetadata(ClassMetadata $metadata)
    {
        $reflClass = $metadata->getReflectionClass();
        $className = $reflClass->getName();
        $loaded = false;

        foreach ($this->reader->getClassAnnotations($reflClass) as $constraint) {
            if ($constraint instanceof Validation) {
                foreach ($constraint->constraints as $constraint) {
                    $metadata->addConstraint($constraint);
                }
            } elseif ($constraint instanceof Constraint) {
                $metadata->addConstraint($constraint);
            }

            $loaded = true;<commit_msg>[Validator] Made the namespace prefix for annotations configurable<commit_after><?php

namespace Symfony\Component\Validator\Mapping\Loader;

/*
 * This file is part of the Symfony framework.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

use Symfony\Component\Validator\Exception\MappingException;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Doctrine\Common\Annotations\AnnotationReader;
use Symfony\Component\Validator\Constraints\Validation;
use Symfony\Component\Validator\Constraint;

class AnnotationLoader implements LoaderInterface
{
    protected $reader;

    public function __construct(array $paths = null)
    {
        if (null === $paths) {
            $paths = array('validation' => 'Symfony\\Component\\Validator\\Constraints\\');
        }

        $this->reader = new AnnotationReader();
        $this->reader->setAutoloadAnnotations(true);

        foreach ($paths as $prefix => $path) {
            $this->reader->setAnnotationNamespaceAlias($path, $prefix);
        }
    }

    /**
     * {@inheritDoc}
     */
    public function loadClassMetadata(ClassMetadata $metadata)
    {
        $reflClass = $metadata->getReflectionClass();
        $className = $reflClass->getName();
        $loaded = false;

        foreach ($this->reader->getClassAnnotations($reflClass) as $constraint) {
            if ($constraint instanceof Validation) {
                foreach ($constraint->constraints as $constraint) {
                    $metadata->addConstraint($constraint);
                }
            } elseif ($constraint instanceof Constraint) {
                $metadata->addConstraint($constraint);
            }

            $loaded = true;
{'fraction_non_alphanumeric': 0.11317922545782047, 'fraction_numerical': 0.0, 'mean_word_length': 2.8970760233918127, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 35, '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': '4720475', 'n_tokens_mistral': 842, 'n_tokens_neox': 822, 'n_words': 199}