<commit_before><?php

namespace Ipunkt\LaravelJsonApi\Repositories\Conditions;

use Illuminate\Support\Collection;
use Ipunkt\LaravelJsonApi\Contracts\Repositories\Conditions\RepositoryCondition;
use Ipunkt\LaravelJsonApi\Contracts\Repositories\Conditions\TakesConditions;

class ConditionApplier
{
    /**
     * @var Collection|RepositoryCondition[]
     */
    private $conditions;

    /**
     * @var bool
     */
    private $peek = false;

    /**
     * ConditionApplier constructor.
     */
    public function __construct()
    {
        $this->conditions = new Collection;
    }

    /**
     * adds a condition
     *
     * @param RepositoryCondition $condition
     */
    public function addCondition(RepositoryCondition $condition)
    {
        $this->conditions->push($condition);
    }

    /**
     * returns condition by type
     *
     * @param string $respositoryType
     * @return Collection
     */
    public function getConditionByType(string $respositoryType) : Collection
    {
        return $this->conditions->filter(function (RepositoryCondition $condition) use ($respositoryType) {
            return $condition instanceof $respositoryType;
        });
    }

    /**
     * Prevents the next request from clearing the Conditions if set to true
     *
     * @param bool $peek defaults to true if not give
     */
    public function setPeek($peek = null)<commit_msg>fixed typo in var name<commit_after><?php

namespace Ipunkt\LaravelJsonApi\Repositories\Conditions;

use Illuminate\Support\Collection;
use Ipunkt\LaravelJsonApi\Contracts\Repositories\Conditions\RepositoryCondition;
use Ipunkt\LaravelJsonApi\Contracts\Repositories\Conditions\TakesConditions;

class ConditionApplier
{
    /**
     * @var Collection|RepositoryCondition[]
     */
    private $conditions;

    /**
     * @var bool
     */
    private $peek = false;

    /**
     * ConditionApplier constructor.
     */
    public function __construct()
    {
        $this->conditions = new Collection;
    }

    /**
     * adds a condition
     *
     * @param RepositoryCondition $condition
     */
    public function addCondition(RepositoryCondition $condition)
    {
        $this->conditions->push($condition);
    }

    /**
     * returns condition by type
     *
     * @param string $repositoryType
     * @return Collection
     */
    public function getConditionByType(string $repositoryType) : Collection
    {
        return $this->conditions->filter(function (RepositoryCondition $condition) use ($repositoryType) {
            return $condition instanceof $repositoryType;
        });
    }

    /**
     * Prevents the next request from clearing the Conditions if set to true
     *
     * @param bool $peek defaults to true if not give
     */
    public function setPeek($peek = null)
{'fraction_non_alphanumeric': 0.09825560697757209, 'fraction_numerical': 0.0, 'mean_word_length': 2.702239789196311, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '3100388', 'n_tokens_mistral': 772, 'n_tokens_neox': 760, 'n_words': 179}