Ejemplo n.º 1
0
 /**
  * @param StackLevel $stack
  * @return array
  */
 private function groupOperators(StackLevel $stack)
 {
     $group = array();
     foreach ($stack->get() as $item) {
         if ($item instanceof StackLevel) {
             $group[] = $this->groupOperators($item);
         } elseif ($item instanceof StackExpression) {
             $group[] = $this->arrangeSet($item);
         } else {
             throw new QueryParserException("Unexpected value in item of type: " . gettype($item));
         }
     }
     return [$stack->getOperator()->get() => $group];
 }
 /**
  * @return int
  */
 public function getLevel()
 {
     if (is_null($this->parent)) {
         return 0;
     }
     return $this->parent->getLevel() + 1;
 }