Hal\Component\BusinessRule\Collection::applyFilter PHP Method

applyFilter() protected method

Filter datas
protected applyFilter ( ) : void
return void
    protected function applyFilter()
    {
        if (!$this->initialized) {
            $evaluator = new Evaluator();
            foreach ($this->datas as $key => $data) {
                foreach ($this->clauses as $clause) {
                    if (!$evaluator->evaluate($clause, $data)) {
                        unset($this->datas[$key]);
                    }
                }
            }
            $this->datas = array_values($this->datas);
            $this->initialized = true;
        }
    }