<commit_before><?php

namespace Gdbots\QueryParser\Node;

use Doctrine\Common\Collections\ArrayCollection;
use Gdbots\QueryParser\Visitor\QueryItemVisitorinterface;

abstract class QueryItem
{
    /**
     * @var array
     */
    protected $parentTokenTypes = [];

    /**
     * @param int $parentTokenType
     *
     * @return bool
     */
    public function hasParentTokenType($parentTokenType)
    {
        return $this->getParentTokenTypes()->contains($parentTokenType);
    }

    /**
     * @param array $parentTokenTypes
     *
     * @return QueryItem
     */
    public function setParentTokenTypes(array $parentTokenTypes)
    {
        $this->parentTokenTypes = new ArrayCollection();

        foreach ($parentTokenTypes as $parentTokenType) {
            $this->addParentTokenType($parentTokenType);
        }

        return $this;
    }

    /**
     * @return \Traversable
     */
    public function getParentTokenTypes()
    {
        return $this->parentTokenTypes ?: $this->parentTokenTypes = new ArrayCollection();
    }

    /**
     * @param int $parentTokenType
     *
     * @return QueryItem
     */
    public function addParentTokenType($parentTokenType)
    {
        if (!$this->getParentTokenTypes()->contains($parentTokenType)) {
            $this->getParentTokenTypes()->add($parentTokenType);
        }

        return $this;
    }

    /**
     * @param int $parentTokenType
     *
     * @return QueryItem
     */
    public function removeParentTokenType($parentTokenType)
    {
        if ($this->getParentTokenTypes()->contains($parentTokenType)) {
            $this->getParentTokenTypes()->removeElement($parentTokenType);
        }

        return $this;
    }

    /**
     * @return array
     */
    public function toArray()
    {
        return [];
    }

    /**
     * @param int $tokenType
     *
     * @return array
     */
    public function getQueryItemsByTokenType($tokenType = null)
    {
        return [];
    }

    /**
     * @param QueryItemVisitorinterface $visitor
     */
    abstract public function accept(QueryItemVisitorinterface $visitor);
}
<commit_msg>Replace ArrayCollection with simple array<commit_after><?php

namespace Gdbots\QueryParser\Node;

use Gdbots\QueryParser\Visitor\QueryItemVisitorinterface;

abstract class QueryItem
{
    /**
     * @var array
     */
    protected $parentTokenTypes = [];

    /**
     * @param int $parentTokenType
     *
     * @return bool
     */
    public function hasParentTokenType($parentTokenType)
    {
        return in_array($parentTokenType, $this->parentTokenTypes);
    }

    /**
     * @param array $parentTokenTypes
     *
     * @return QueryItem
     */
    public function setParentTokenTypes(array $parentTokenTypes)
    {
        $this->parentTokenTypes = [];

        foreach ($parentTokenTypes as $parentTokenType) {
            $this->addParentTokenType($parentTokenType);
        }

        return $this;
    }

    /**
     * @return \Traversable
     */
    public function getParentTokenTypes()
    {
        return $this->parentTokenTypes ?: $this->parentTokenTypes = [];
    }

    /**
     * @param int $parentTokenType
     *
     * @return QueryItem
     */
    public function addParentTokenType($parentTokenType)
    {
        if (!$this->hasParentTokenType($parentTokenType)) {
            $this->getParentTokenTypes[] = $parentTokenType;
        }

        return $this;
    }

    /**
     * @param int $parentTokenType
     *
     * @return QueryItem
     */
    public function removeParentTokenType($parentTokenType)
    {
        if ($this->hasParentTokenType($parentTokenType)) {
            unset($this->getParentTokenTypes[array_search($parentTokenType, $this->getParentTokenTypes)]);
        }

        return $this;
    }

    /**
     * @return array
     */
    public function toArray()
    {
        return [];
    }

    /**
     * @param int $tokenType
     *
     * @return array
     */
    public function getQueryItemsByTokenType($tokenType = null)
    {
        return [];
    }

    /**
     * @param QueryItemVisitorinterface $visitor
     */
    abstract public function accept(QueryItemVisitorinterface $visitor);
}

{'fraction_non_alphanumeric': 0.11688931297709923, 'fraction_numerical': 0.0, 'mean_word_length': 2.2706708268330735, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '1965765', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1162, 'n_words': 207}