JamesMoss\Flywheel\Predicate::addPredicate PHP Метод

addPredicate() защищенный Метод

protected addPredicate ( $type, $field, $operator = null, $value = null )
    protected function addPredicate($type, $field, $operator = null, $value = null)
    {
        if (!$this->predicates) {
            $type = false;
        }
        if ($field instanceof \Closure) {
            $sub = new self();
            call_user_func($field, $sub);
            $this->predicates[] = array($type, $sub->getAll());
            return $this;
        }
        $field = trim($field);
        if ($field == '') {
            throw new \InvalidArgumentException('Field name cannot be empty.');
        }
        if (!in_array($operator, $this->operators)) {
            throw new \InvalidArgumentException('Unknown operator `' . $operator . '`.');
        }
        $this->predicates[] = array($type, $field, $operator, $value);
        return $this;
    }