<commit_before><?php

namespace PHPCD\Element\ConstantInfo;

use PHPCD\Element\ClassInfo\ReflectionClassFactory;
use PHPCD\Filter\ClassConstantFilter;
use PHPCD\PatternMatcher\PatternMatcher;

class ReflectionClassConstantRepository implements ClassConstantRepository
{
    /**
     * @var PatternMatcher
     */
    private $patternMatcher;

    /**
     * @var ReflectionClassFactory
     */
    protected $classInfoFactory;

    /**
     * @param PatternMatcher $patternMatcher
     */
    public function __construct(PatternMatcher $patternMatcher, ReflectionClassFactory $factory)
    {
        $this->patternMatcher = $patternMatcher;
        $this->classInfoFactory = $factory;
    }

    /**
     * @param ClassConstantFilter $filter
     *
     * @return ClassConstantCollection
     */
    public function find(ClassConstantFilter $filter)
    {
        $classInfo = $this->classInfoFactory->createFromFilter($filter);

        $collection = new ClassConstantCollection();

        foreach ($classInfo->getConstants() as $name => $value) {
            $collection->add(new GenericClassConstant($classInfo, $name, $value));
        }

        return $collection;
    }
}<commit_msg>ReflectionClassConstantRepository restored missing pattern matching<commit_after><?php

namespace PHPCD\Element\ConstantInfo;

use PHPCD\Element\ClassInfo\ReflectionClassFactory;
use PHPCD\Filter\ClassConstantFilter;
use PHPCD\PatternMatcher\PatternMatcher;

class ReflectionClassConstantRepository implements ClassConstantRepository
{
    /**
     * @var PatternMatcher
     */
    private $patternMatcher;

    /**
     * @var ReflectionClassFactory
     */
    protected $classInfoFactory;

    /**
     * @param PatternMatcher $patternMatcher
     */
    public function __construct(PatternMatcher $patternMatcher, ReflectionClassFactory $factory)
    {
        $this->patternMatcher = $patternMatcher;
        $this->classInfoFactory = $factory;
    }

    /**
     * @param ClassConstantFilter $filter
     *
     * @return ClassConstantCollection
     */
    public function find(ClassConstantFilter $filter)
    {
        $classInfo = $this->classInfoFactory->createFromFilter($filter);

        $collection = new ClassConstantCollection();

        foreach ($classInfo->getConstants() as $name => $value) {
            if ($this->patternMatcher->match($filter->getPattern(), $name)) {
                $collection->add(new GenericClassConstant($classInfo, $name, $value));
            }
        }

        return $collection;
    }
}
{'fraction_non_alphanumeric': 0.10584518167456557, 'fraction_numerical': 0.0, 'mean_word_length': 3.172981878088962, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '980148', 'n_tokens_mistral': 660, 'n_tokens_neox': 639, 'n_words': 125}