<commit_before><?php

namespace Markup\NeedleBundle\Intercept;

use Markup\NeedleBundle\Event\SearchEvents;
use Markup\NeedleBundle\Event\UnresolvedInterceptEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* An interceptor object which can provide intercepts for searches.
*/
class Interceptor implements InterceptorInterface
{
    /**
     * @var EventDispatcherInterface
     **/
    private $eventDispatcher;

    /**
     * @var \SplObjectStorage<DefinitionInterface>
     **/
    private $definitions;

    /**
     * @var TypedInterceptMapperInterface[]
     **/
    private $interceptMappers = [];

    /**
     * @param EventDispatcherInterface $eventDispatcher
     **/
    public function __construct(EventDispatcherInterface $eventDispatcher)
    {
        $this->eventDispatcher = $eventDispatcher;
        $this->definitions = new \SplObjectStorage();
    }

    /**
     * {@inheritdoc}
     **/
    public function matchQueryToIntercept($queryString)
    {
        foreach ($this->definitions as $definition) {
            if ($definition->getMatcher()->matches($queryString)) {
                $interceptMapper = $this->getInterceptMapperForType($definition->getType());
                if (null === $interceptMapper) {
                    continue;<commit_msg>chore: tweak docblock for phpstan update<commit_after><?php

namespace Markup\NeedleBundle\Intercept;

use Markup\NeedleBundle\Event\SearchEvents;
use Markup\NeedleBundle\Event\UnresolvedInterceptEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
* An interceptor object which can provide intercepts for searches.
*/
class Interceptor implements InterceptorInterface
{
    /**
     * @var EventDispatcherInterface
     **/
    private $eventDispatcher;

    /**
     * @var \SplObjectStorage&DefinitionInterface[]
     **/
    private $definitions;

    /**
     * @var TypedInterceptMapperInterface[]
     **/
    private $interceptMappers = [];

    public function __construct(EventDispatcherInterface $eventDispatcher)
    {
        $this->eventDispatcher = $eventDispatcher;
        $this->definitions = new \SplObjectStorage();
    }

    /**
     * {@inheritdoc}
     **/
    public function matchQueryToIntercept($queryString)
    {
        foreach ($this->definitions as $definition) {
            if ($definition->getMatcher()->matches($queryString)) {
                $interceptMapper = $this->getInterceptMapperForType($definition->getType());
                if (null === $interceptMapper) {
                    continue;
{'fraction_non_alphanumeric': 0.11353882169332813, 'fraction_numerical': 0.0, 'mean_word_length': 3.082802547770701, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 18, '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': '3593240', 'n_tokens_mistral': 702, 'n_tokens_neox': 664, 'n_words': 125}