private function findTargetAndDirection(Node $node) { $target = null; $direction = null; $previous = $next = $node; while (true) { $previous = $this->getPrevious($previous); $next = $this->getNext($next); if ($previous === null && $next === null) { $target = $node->parent(); $direction = self::DIRECTION_SUFFIX; break; } if ($previous !== null && !$previous instanceof Attributes) { $target = $previous; $direction = self::DIRECTION_SUFFIX; break; } if ($next !== null && !$next instanceof Attributes) { $target = $next; $direction = self::DIRECTION_PREFIX; break; } } return [$target, $direction]; }
/** * @return AbstractBlock|null */ public function parent() { return parent::parent(); }