original_string: public function getSql()
      {
          if ($this->isEmpty()) {
              throw new Exception("Invalid segment, please specify a valid segment.");
          }
          $sql = '';
          $subExpression = false;
          foreach ($this->tree as $expression) {
              $operator = $expression[self::INDEX_BOOL_OPERATOR];
              $operand = $expression[self::INDEX_OPERAND];
  
              if ($operator == self::BOOL_OPERATOR_OR
                  && !$subExpression
              ) {
                  $sql .= ' (';
                  $subExpression = true;
              } else {
                  $sql .= ' ';
              }
  
              $sql .= $operand;
  
              if ($operator == self::BOOL_OPERATOR_AND
                  && $subExpression
              ) {
                  $sql .= ')';
                  $subExpression = false;
              }
  
              $sql .= " $operator";
          }
          if ($subExpression) {
              $sql .= ')';
          }
          return array(
              'where' => $sql,
              'bind'  => $this->valuesBind,
              'join'  => implode(' ', $this->joins)
          );
      }
code: public function getSql()
      {
          if ($this->isEmpty()) {
              throw new Exception("Invalid segment, please specify a valid segment.");
          }
          $sql = '';
          $subExpression = false;
          foreach ($this->tree as $expression) {
              $operator = $expression[self::INDEX_BOOL_OPERATOR];
              $operand = $expression[self::INDEX_OPERAND];
  
              if ($operator == self::BOOL_OPERATOR_OR
                  && !$subExpression
              ) {
                  $sql .= ' (';
                  $subExpression = true;
              } else {
                  $sql .= ' ';
              }
  
              $sql .= $operand;
  
              if ($operator == self::BOOL_OPERATOR_AND
                  && $subExpression
              ) {
                  $sql .= ')';
                  $subExpression = false;
              }
  
              $sql .= " $operator";
          }
          if ($subExpression) {
              $sql .= ')';
          }
          return array(
              'where' => $sql,
              'bind'  => $this->valuesBind,
              'join'  => implode(' ', $this->joins)
          );
      }
code_tokens: public function getSql ( ) { if ( $ this -> isEmpty ( ) ) { throw new Exception ( "Invalid segment, please specify a valid segment." ) ; } $ sql = '' ; $ subExpression = false ; foreach ( $ this -> tree as $ expression ) { $ operator = $ expression [ self :: INDEX_BOOL_OPERATOR ] ; $ operand = $ expression [ self :: INDEX_OPERAND ] ; if ( $ operator == self :: BOOL_OPERATOR_OR && ! $ subExpression ) { $ sql .= ' (' ; $ subExpression = true ; } else { $ sql .= ' ' ; } $ sql .= $ operand ; if ( $ operator == self :: BOOL_OPERATOR_AND && $ subExpression ) { $ sql .= ')' ; $ subExpression = false ; } $ sql .= " $operator" ; } if ( $ subExpression ) { $ sql .= ')' ; } return array ( 'where' => $ sql , 'bind' => $ this -> valuesBind , 'join' => implode ( ' ' , $ this -> joins ) ) ; }
docstring: Given the array of parsed boolean logic, will return
  an array containing the full SQL string representing the filter,
  the needed joins and the values to bind to the query
  
  @throws Exception
  @return array SQL Query, Joins and Bind parameters
docstring_tokens: Given the array of parsed boolean logic will return an array containing the full SQL string representing the filter the needed joins and the values to bind to the query