<commit_before><?php

namespace BetterReflection\Reflector;

use BetterReflection\Identifier\Identifier;
use BetterReflection\Identifier\IdentifierType;
use BetterReflection\Reflection\ReflectionFunction;
use BetterReflection\SourceLocator\AggregateSourceLocator;
use BetterReflection\SourceLocator\LocatedSource;
use BetterReflection\SourceLocator\PhpInternalSourceLocator;
use BetterReflection\SourceLocator\SourceLocator;
use BetterReflection\Reflection\ReflectionClass;
use BetterReflection\Reflection\Reflection;
use PhpParser\Parser;
use PhpParser\Lexer;
use PhpParser\Node;

class Generic
{
    /**
     * @var SourceLocator
     */
    private $sourceLocator;

    /**
     * @var Parser
     */
    private $parser;

    public function __construct(SourceLocator $sourceLocator)
    {
        $this->sourceLocator = $sourceLocator;
        $this->parser        = new Parser\Multiple([
            new Parser\Php7(new Lexer()),
            new Parser\Php5(new Lexer())
        ]);
    }

    /**
     * Uses the SourceLocator given in the constructor to locate the $identifier
     * specified and returns the \Reflector.
     *
     * @param Identifier $identifier
     *
     * @return Reflection
     */
    public function reflect(Identifier $identifier)
    {
        $aggregate = $this->sourceLocator;

        if (! $locatedSource = $aggregate($identifier)) {
            throw Exception\IdentifierNotFound::fromIdentifier($identifier);
        }

        return $this->reflectFromLocatedSource($identifier, $locatedSource);<commit_msg>Correcting locator naming as per @asgrim's review<commit_after><?php

namespace BetterReflection\Reflector;

use BetterReflection\Identifier\Identifier;
use BetterReflection\Identifier\IdentifierType;
use BetterReflection\Reflection\ReflectionFunction;
use BetterReflection\SourceLocator\AggregateSourceLocator;
use BetterReflection\SourceLocator\LocatedSource;
use BetterReflection\SourceLocator\PhpInternalSourceLocator;
use BetterReflection\SourceLocator\SourceLocator;
use BetterReflection\Reflection\ReflectionClass;
use BetterReflection\Reflection\Reflection;
use PhpParser\Parser;
use PhpParser\Lexer;
use PhpParser\Node;

class Generic
{
    /**
     * @var SourceLocator
     */
    private $sourceLocator;

    /**
     * @var Parser
     */
    private $parser;

    public function __construct(SourceLocator $sourceLocator)
    {
        $this->sourceLocator = $sourceLocator;
        $this->parser        = new Parser\Multiple([
            new Parser\Php7(new Lexer()),
            new Parser\Php5(new Lexer())
        ]);
    }

    /**
     * Uses the SourceLocator given in the constructor to locate the $identifier
     * specified and returns the \Reflector.
     *
     * @param Identifier $identifier
     *
     * @return Reflection
     */
    public function reflect(Identifier $identifier)
    {
        $locator = $this->sourceLocator;

        if (! $locatedSource = $locator($identifier)) {
            throw Exception\IdentifierNotFound::fromIdentifier($identifier);
        }

        return $this->reflectFromLocatedSource($identifier, $locatedSource);
{'fraction_non_alphanumeric': 0.09317166560306318, 'fraction_numerical': 0.0012763241863433313, 'mean_word_length': 3.409282700421941, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '1328499', 'n_tokens_mistral': 850, 'n_tokens_neox': 836, 'n_words': 179}