/** * Returns the current object * Allows for conditional statements in a fluid interface. * * @return $this|Criteria */ public function _endif() { if (!$this->conditionalProxy) { throw new LogicException(__METHOD__ . ' must be called after _if()'); } $this->conditionalProxy = $this->conditionalProxy->getParentProxy(); if ($this->conditionalProxy) { return $this->conditionalProxy->getCriteriaOrProxy(); } // reached last level return $this; }