Пример #1
0
 public function pop($i = -1)
 {
     if (\snow_eq($i, -1)) {
         return array_pop($this->arr);
     } else {
         $this->offsetGet($i);
         $i = $this->_get_index($i);
         $splice = array_splice($this->arr, $i);
         return $splice[0];
     }
 }
Пример #2
0
 public function enterNode(PHPParser_Node $node)
 {
     if ($node instanceof PHPParser_Node_Expr_Assign) {
         $this->create_name($node, $node->var->name, true, true);
         $this->in_assign = true;
     } elseif ($node instanceof PHPParser_Node_Stmt_Function) {
         $this->create_name($node, $node->name, false, true);
         $this->scopes->append($this->scopes[-1]->copy());
         $this->scopes[-1]->prefix->append($node->name);
         $this->scopes[-1]->func = $node;
     } elseif ($node instanceof PHPParser_Node_Expr_Variable) {
         if (!$this->in_assign) {
             $this->create_name($node, $node->name, true, false);
         }
     } elseif ($node instanceof PHPParser_Node_Expr_FuncCall) {
         if (\snow_eq(count($node->name->parts), 1)) {
             $this->create_name($node, $node->name->parts[0], true, false);
             $node->as_variable = true;
         }
     }
 }