<commit_before><?php
namespace ArchNate\TriggrPHP\Collection;

use TPE\TriggrPHP\Handler;

class HandlerCollection implements \Countable
{
    /**
     * @var array The handles managed by the collection
     */
    protected $handlers = array();

    /**
     * @var array The sort order of handlers
     */
    protected $handlerSort = array();

    /**
     * @return int Returns the number of handlers currently collected
     */
    public function count()
    {
        return count($this->handlers);
    }

    /**
     * Adds a handler to the collection, any handler names that are identical are overwritten
     * @param Handler $handler The handler to be added to the collection
     * @return  self
     */
    public function addHandler(Handler $handler)
    {
        $this->handlers[$handler->getName()] = $handler;

        return $this;
    }

    /**
     * Removes a handler from the collection
     * @param  string $handlerName The text of the handler name
     * @return self
     */
    public function removeHandler($handlerName)
    {
        if(array_key_exists($handlerName, $this->handlers)) {
            unset($this->handlers[$handlerName]);
        }

        return $this;
    }

    /**
     * Sorts the handlers according to their priority option value
     * @return self
     */
    public function sortHandlers()
    {
        $this->handlerSort = array();
        foreach($this->handlers as $handler) {
            $handlerPriority = $handler->getOptions()->getPriority();
            $handlerName = $handler->getName();

            if(!isset($this->handlerSort[$handlerPriority])) {
                $this->handlerSort[$handlerPriority] = array();
            }

            $this->handlerSort[$handlerPriority][] = $handlerName;
        }

        ksort($this->handlerSort);

        return $this;
    }

    /**
     * Retrieves the sorted handler data
     * @return array The array of the handler sort data
     */
    public function getHandlerSort()
    {
        return $this->handlerSort;
    }

    /**
     * Retrieves the handler data
     * @return array The array of the handler data
     */
    public function getHandlers()
    {
        return $this->handlers;
    }

    /**
     * Retreives a handler from the collection by it's name
     * @param  string $handlerName The handler desired to be retrieved
     * @return Handler|null If no handler is available, null is returned
     */
    public function getHandlerByName($handlerName)
    {
        if(array_key_exists($handlerName, $this->handlers)) {
            return $this->handlers[$handlerName];
        }
    }
}<commit_msg>Fixed 1 missing namespace change<commit_after><?php
namespace ArchNate\TriggrPHP\Collection;

use ArchNate\TriggrPHP\Handler;

class HandlerCollection implements \Countable
{
    /**
     * @var array The handles managed by the collection
     */
    protected $handlers = array();

    /**
     * @var array The sort order of handlers
     */
    protected $handlerSort = array();

    /**
     * @return int Returns the number of handlers currently collected
     */
    public function count()
    {
        return count($this->handlers);
    }

    /**
     * Adds a handler to the collection, any handler names that are identical are overwritten
     * @param Handler $handler The handler to be added to the collection
     * @return  self
     */
    public function addHandler(Handler $handler)
    {
        $this->handlers[$handler->getName()] = $handler;

        return $this;
    }

    /**
     * Removes a handler from the collection
     * @param  string $handlerName The text of the handler name
     * @return self
     */
    public function removeHandler($handlerName)
    {
        if(array_key_exists($handlerName, $this->handlers)) {
            unset($this->handlers[$handlerName]);
        }

        return $this;
    }

    /**
     * Sorts the handlers according to their priority option value
     * @return self
     */
    public function sortHandlers()
    {
        $this->handlerSort = array();
        foreach($this->handlers as $handler) {
            $handlerPriority = $handler->getOptions()->getPriority();
            $handlerName = $handler->getName();

            if(!isset($this->handlerSort[$handlerPriority])) {
                $this->handlerSort[$handlerPriority] = array();
            }

            $this->handlerSort[$handlerPriority][] = $handlerName;
        }

        ksort($this->handlerSort);

        return $this;
    }

    /**
     * Retrieves the sorted handler data
     * @return array The array of the handler sort data
     */
    public function getHandlerSort()
    {
        return $this->handlerSort;
    }

    /**
     * Retrieves the handler data
     * @return array The array of the handler data
     */
    public function getHandlers()
    {
        return $this->handlers;
    }

    /**
     * Retreives a handler from the collection by it's name
     * @param  string $handlerName The handler desired to be retrieved
     * @return Handler|null If no handler is available, null is returned
     */
    public function getHandlerByName($handlerName)
    {
        if(array_key_exists($handlerName, $this->handlers)) {
            return $this->handlers[$handlerName];
        }
    }
}
{'fraction_non_alphanumeric': 0.1067521689928329, 'fraction_numerical': 0.0001886080724254998, 'mean_word_length': 2.2394624312767255, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '3206984', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1390, 'n_words': 416}