示例#1
0
 /**
  * Attach a filter to the queue
  *
  * The priority parameter can be used to override the filter priority while enqueueing the filter.
  *
  * @param   TemplateFilterInterface  $filter
  * @param   integer          $priority The filter priority, usually between 1 (high priority) and 5 (lowest),
  *                                     default is 3. If no priority is set, the filter priority will be used
  *                                     instead.
  * @return TemplateFilterChain
  * @throws \InvalidArgumentException if the object doesn't implement TemplateFilterInterface
  */
 public function enqueue(ObjectHandlable $filter, $priority = null)
 {
     if (!$filter instanceof TemplateFilterInterface) {
         throw new \InvalidArgumentException('Filter needs to implement TemplateFilterInterface');
     }
     $priority = is_int($priority) ? $priority : $filter->getPriority();
     return parent::enqueue($filter, $priority);
 }
示例#2
0
 /**
  * Attach a command to the chain
  *
  * The priority parameter can be used to override the command priority while enqueueing the command.
  *
  * @param   CommandInterface   $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 CommandChain
  * @throws \InvalidArgumentException if the object doesn't implement CommandInterface
  */
 public function enqueue(ObjectHandlable $command, $priority = null)
 {
     if (!$command instanceof CommandInterface) {
         throw new \InvalidArgumentException('Command needs to implement CommandInterface');
     }
     $priority = is_int($priority) ? $priority : $command->getPriority();
     return parent::enqueue($command, $priority);
 }