Esempio n. 1
0
 /**
  * Attach a command to the chain
  * 
  * The priority parameter can be used to override the command priority while enqueueing the command.
  * 
  * @param   KCommandInterface   $command
  * @param   integer             $priority The command priority, usually between 1 (high priority) and 5 (lowest),
  *                                        default is 3. If no priority is set, the command priority will be used
  *                                        instead.
  * @return \KCommandChain
  * @throws InvalidArgumentException if the object doesn't implement KCommandInterface
  */
 public function enqueue(KObjectHandlable $command, $priority = null)
 {
     if (!$command instanceof KCommandInterface) {
         throw new InvalidArgumentException('Command needs to implement KCommandInterface');
     }
     $priority = is_int($priority) ? $priority : $command->getPriority();
     return parent::enqueue($command, $priority);
 }