/** * @return boolean */ public function __invoke(Node $node) { if ($node instanceof ArrayLookupNode) { $root = $node->getRootArray(); if ($root instanceof ObjectPropertyNode) { $object = $root->getObject(); if ($object instanceof VariableNode && $object->getName() == $this->variable) { return sizeof($node->getKeys()) >= 3; } } } return FALSE; }
/** * Returns the root of the lookup. * * For example, given an expression like $foo['bar']['baz'], * this method will return a VariableNode for $foo. * * @return Node */ public function getRootArray() { return $this->array instanceof ArrayLookupNode ? $this->array->getRootArray() : $this->array; }