/** * Returns the current object * Allows for conditional statements in a fluid interface. * * @throws SQL\Exception\QueryBuilderException * * @return \SQL\Base\QueryBuilder */ public function _endif() { if (!$this->conditionalProxy) { throw new QueryBuilderException('_endif() must be called after _if()'); } $this->conditionalProxy = $this->conditionalProxy->getParentProxy(); if ($this->conditionalProxy) { return $this->conditionalProxy->getQueryOrProxy(); } // reached last level return $this; }