/** * Creates a node with the given attributes. * * @param mixed $attributes * @return Cartalyst\NestedSets\Nodes\NodeInterface $node */ public function createNode($attributes = []) { $attributes = (array) $attributes; // Prepare the node's children $children = []; if (isset($attributes['children'])) { $children = $attributes['children']; unset($attributes['children']); } // Create a new node which we will hydrate // with results. $node = $this->baseNode->createNode(); $node->setAllAttributes($attributes); $node->setChildren($children); return $node; }