isExecutable() public method

Returns true if this node is ready for execution and false if it is not.
public isExecutable ( ) : boolean
return boolean
Example #1
0
 /**
  * Activates a node and returns true if it was activated, false if not.
  *
  * The node will only be activated if the node is executable.
  * See {@link ezcWorkflowNode::isExecutable()}.
  *
  * @param ezcWorkflowNode $node
  * @param bool            $notifyPlugins
  * @return bool
  * @ignore
  */
 public function activate(ezcWorkflowNode $node, $notifyPlugins = true)
 {
     // Only activate the node when
     //  - the execution of the workflow has not been cancelled,
     //  - the node is ready to be activated,
     //  - and the node is not already activated.
     if ($this->cancelled || !$node->isExecutable() || ezcWorkflowUtil::findObject($this->activatedNodes, $node) !== false) {
         return false;
     }
     $activateNode = true;
     foreach ($this->plugins as $plugin) {
         $activateNode = $plugin->beforeNodeActivated($this, $node);
         if (!$activateNode) {
             // @codeCoverageIgnoreStart
             break;
             // @codeCoverageIgnoreEnd
         }
     }
     if ($activateNode) {
         // Add node to list of activated nodes.
         $this->activatedNodes[] = $node;
         $this->numActivatedNodes++;
         if ($node instanceof ezcWorkflowNodeEnd) {
             $this->numActivatedEndNodes++;
         }
         if ($notifyPlugins) {
             foreach ($this->plugins as $plugin) {
                 $plugin->afterNodeActivated($this, $node);
             }
         }
         return true;
     } else {
         // @codeCoverageIgnoreStart
         return false;
         // @codeCoverageIgnoreEnd
     }
 }