<commit_before><?php
/**
 * This file is part of the Ray.Compiler package.
 *
 * @license http://opensource.org/licenses/MIT MIT
 */
namespace Ray\Compiler;

use Ray\Di\InjectionPointInterface;

final class InjectionPoint implements InjectionPointInterface
{
    /**
     * @var \ReflectionParameter
     */
    private $parameter;

    /**
     * @var string
     */
    private $scriptDir;

    public function __construct(\ReflectionParameter $parameter, $scriptDir)
    {
        $this->parameter = $parameter;
        $this->scriptDir = $scriptDir;
    }

    /**
     * {@inheritdoc}
     */
    public function getParameter() : \ReflectionParameter
    {
        return $this->parameter;
    }

    /**
     * {@inheritdoc}
     */
    public function getMethod() : \ReflectionMethod
    {
        return $this->parameter->getDeclaringFunction();
    }

    /**
     * {@inheritdoc}
     */
    public function getClass() : \ReflectionClass
    {
        return $this->parameter->getDeclaringClass();
    }

    /**
     * {@inheritdoc}
     */
    public function getQualifiers() : array
    {
        return [$this->getQualifier()];
    }

    /**
     * {@inheritdoc}
     */
    public function getQualifier()
    {
        $file = \sprintf(
            ScriptInjector::QUALIFIER,
            $this->scriptDir,
            \str_replace('\\', '_', $this->parameter->getDeclaringClass()->name),
            $this->parameter->getDeclaringFunction()->name,
            $this->parameter->name
        );
        if (\file_exists($file)) {
            return \unserialize(\file_get_contents($file));
        }
    }
}
<commit_msg>validate ReflectionClass class<commit_after><?php
/**
 * This file is part of the Ray.Compiler package.
 *
 * @license http://opensource.org/licenses/MIT MIT
 */
namespace Ray\Compiler;

use Ray\Di\InjectionPointInterface;

final class InjectionPoint implements InjectionPointInterface
{
    /**
     * @var \ReflectionParameter
     */
    private $parameter;

    /**
     * @var string
     */
    private $scriptDir;

    public function __construct(\ReflectionParameter $parameter, $scriptDir)
    {
        $this->parameter = $parameter;
        $this->scriptDir = $scriptDir;
    }

    /**
     * {@inheritdoc}
     */
    public function getParameter() : \ReflectionParameter
    {
        return $this->parameter;
    }

    /**
     * {@inheritdoc}
     */
    public function getMethod() : \ReflectionMethod
    {
        return $this->parameter->getDeclaringFunction();
    }

    /**
     * {@inheritdoc}
     */
    public function getClass() : \ReflectionClass
    {
        $class = $this->parameter->getDeclaringClass();
        if (! $class instanceof \ReflectionClass) {
            throw new \LogicException; // @codeCoverageIgnore
        }

        return $class;
    }

    /**
     * {@inheritdoc}
     */
    public function getQualifiers() : array
    {
        return [$this->getQualifier()];
    }

    /**
     * {@inheritdoc}
     */
    public function getQualifier()
    {
        $file = \sprintf(
            ScriptInjector::QUALIFIER,
            $this->scriptDir,
            \str_replace('\\', '_', $this->parameter->getDeclaringClass()->name),
            $this->parameter->getDeclaringFunction()->name,
            $this->parameter->name
        );
        if (\file_exists($file)) {
            return \unserialize(\file_get_contents($file));
        }
    }
}

{'fraction_non_alphanumeric': 0.14023858015711377, 'fraction_numerical': 0.0, 'mean_word_length': 2.0669045495093665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '5411809', 'n_tokens_mistral': 973, 'n_tokens_neox': 958, 'n_words': 176}