Alterway\Component\Workflow\NodeMap::has PHP Method

has() public method

Checks if a node exists.
public has ( string $name ) : boolean
$name string
return boolean
    public function has($name)
    {
        $name = (string) $name;
        return isset($this->items[$name]);
    }

Usage Example

Example #1
0
 /**
  * Initializes the workflow with a given token.
  *
  * @param string $token
  *
  * @return Workflow
  *
  * @throws Exception\InvalidTokenException
  */
 public function initialize($token = null)
 {
     if (null === $token) {
         $this->current = $this->start;
     } elseif ($this->nodes->has($token)) {
         $this->current = $this->nodes->get($token);
     } else {
         throw new Exception\InvalidTokenException();
     }
     return $this;
 }