Ejemplo n.º 1
0
 /**
  * Adds a child to this node.
  *
  * @param NodeInterface $child     - Child.
  * @param bool          $setParent - Set Parent?
  *
  * @throws \IronEdge\Component\Graphs\Exception\ChildTypeNotSupportedException
  *
  * @return NodeInterface
  */
 public function addChild(NodeInterface $child, bool $setParent = true) : NodeInterface
 {
     $ret = parent::addChild($child, $setParent);
     if ($child instanceof State && $child->isInitial()) {
         $this->addInitialState($child);
     }
     return $ret;
 }
 /**
  * Method supportsParent.
  *
  * @param NodeInterface $parent - Parent.
  *
  * @return bool
  */
 public function supportsParent(NodeInterface $parent) : bool
 {
     parent::supportsParent($parent);
     return $parent instanceof State || $parent instanceof Flow;
 }
Ejemplo n.º 3
0
 /**
  * Returns default metadata.
  *
  * @return array
  */
 public function getDefaultMetadata() : array
 {
     return array_replace_recursive(parent::getDefaultMetadata(), ['isInitial' => false]);
 }