/** * {@inheritDoc} */ public function equals(NodeInterface $node) { if (!$node instanceof static) { return false; } /** @var Node $node */ return $this->name == $node->getName(); }
/** * Converts Node instance to an array * * @param NodeInterface $node Node to serialize * @param array $childs List of serialized child nodes * * @return array */ private function raw(NodeInterface $node, array $childs) { $data = ['org_id' => $node->getId(), 'org_name' => (string) $node->getName(), 'daughters' => $childs]; if (!isset($data['org_id'])) { unset($data['org_id']); } if (empty($data['daughters'])) { unset($data['daughters']); } return $data; }