public function criteria($criteria = null)
    {
        if (is_null($criteria)) {
            return $this->mediator->criteria();
        }

        if (!is_null($criteria) && !is_a($criteria, CriteriaInterface::class)) {
            throw new InvalidCriteria();
        }

        $this->mediator->criteria()->addCriteria($criteria);

        return $this;
    }
public function criteria($criteria = null)
    {
        if (is_null($criteria)) {
            return $this->mediator->criteria();
        }

        if (!is_null($criteria) && !is_a($criteria, CriteriaInterface::class)) {
            throw new InvalidCriteria();
        }

        $this->mediator->criteria()->addCriteria($criteria);

        return $this;
    }
public function criteria ( $ criteria = null ) { if ( is_null ( $ criteria ) ) { return $ this -> mediator -> criteria ( ) ; } if ( ! is_null ( $ criteria ) && ! is_a ( $ criteria , CriteriaInterface :: class ) ) { throw new InvalidCriteria ( ) ; } $ this -> mediator -> criteria ( ) -> addCriteria ( $ criteria ) ; return $ this ; }
Add criteria to repository query or return criteria service.

@param CriteriaInterface|null $criteria

@throws InvalidCriteria

@return CriteriaService|$this
Add criteria to repository query or return criteria service .