Esempio n. 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);
 }
Esempio n. 2
0
 /**
  * Add a filter to the queue based on priority
  *
  * @param FilterInterface  $filter A Filter
  * @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 FilterChain
  */
 public function addFilter(FilterInterface $filter, $priority = null)
 {
     //Store reference to be used for filter chaining
     $this->_last = $filter;
     //Enqueue the filter
     $this->_queue->enqueue($filter, $priority);
     return $this;
 }
Esempio n. 3
0
 /**
  * Attach a transport handler
  *
  * @param   mixed  $transport An object that implements ObjectInterface, ObjectIdentifier object
  *                            or valid identifier string
  * @param   array $config  An optional associative array of configuration settings
  * @return DispatcherResponseAbstract
  */
 public function attachTransport($transport, $config = array())
 {
     if (!$transport instanceof DispatcherResponseTransportInterface) {
         $transport = $this->getTransport($transport, $config);
     }
     //Enqueue the transport handler in the command chain
     $this->_queue->enqueue($transport, $transport->getPriority());
     return $this;
 }
Esempio n. 4
0
 /**
  * Attach a filter for template transformation
  *
  * @param   mixed  $filter An object that implements ObjectInterface, ObjectIdentifier object
  *                         or valid identifier string
  * @param   array $config  An optional associative array of configuration settings
  * @return TemplateAbstract
  */
 public function attachFilter($filter, $config = array())
 {
     if (!$filter instanceof TemplateFilterInterface) {
         $filter = $this->getFilter($filter, $config);
     }
     //Enqueue the filter
     $this->_queue->enqueue($filter, $filter->getPriority());
     return $this;
 }
Esempio n. 5
0
 /**
  * Attach a filter for template transformation
  *
  * @param   mixed $filter An object that implements ObjectInterface, ObjectIdentifier object
  *                         or valid identifier string
  * @param   array $config An optional associative array of configuration settings
  * @throws \UnexpectedValueException
  * @return TemplateAbstract
  */
 public function addFilter($filter, $config = array())
 {
     //Create the complete identifier if a partial identifier was passed
     if (is_string($filter) && strpos($filter, '.') === false) {
         $identifier = $this->getIdentifier()->toArray();
         $identifier['path'] = array('template', 'filter');
         $identifier['name'] = $filter;
         $identifier = $this->getIdentifier($identifier);
     } else {
         $identifier = $this->getIdentifier($filter);
     }
     if (!$this->hasFilter($identifier->name)) {
         $filter = $this->getObject($identifier, $config);
         if (!$filter instanceof TemplateFilterInterface) {
             throw new \UnexpectedValueException("Template filter {$identifier} does not implement TemplateFilterInterface");
         }
         //Store the filter
         $this->__filters[$filter->getIdentifier()->name] = $filter;
         //Enqueue the filter
         $this->__filter_queue->enqueue($filter, $filter->getPriority());
     }
     return $this;
 }
Esempio n. 6
0
 /**
  * Add a filter to the queue based on priority
  *
  * @param FilterInterface 	$filter A Filter
  * @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 FilterChain
  */
 public function addFilter(FilterInterface $filter, $priority = null)
 {
     $priority = $priority == null ? $filter->getPriority() : $priority;
     $this->_queue->enqueue($filter, $priority);
     return $this;
 }
Esempio n. 7
0
 /**
  * Attach a command handler to the chain
  *
  * @param   CommandHandlerInterface  $handler  The command handler
  * @return CommandChain
  */
 public function addHandler(CommandHandlerInterface $handler)
 {
     $this->__queue->enqueue($handler, $handler->getPriority());
     return $this;
 }
Esempio n. 8
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);
 }
Esempio n. 9
0
 /**
  * Add a bootsstrapper to the queue based on priority
  *
  * @param BootstrapperInterface $bootstrapper A bootstrapper object
  * @param integer	            $priority   The bootstrapper priority, usually between 1 (high priority) and 5 (lowest),
  *                                          default is 3. If no priority is set, the bootstrapper priority will be used
  *                                          instead.
  * @return BootstrapperChain
  */
 public function addBootstrapper(BootstrapperInterface $bootstrapper, $priority = null)
 {
     $priority = $priority == null ? $bootstrapper->getPriority() : $priority;
     $this->_queue->enqueue($bootstrapper, $priority);
     return $this;
 }
Esempio n. 10
0
 /**
  * Attach a filter to the queue
  *
  * The priority parameter can be used to override the filter priority while enqueueing the filter.
  *
  * @param   FilterInterface  $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 FilterChain
  * @throws \InvalidArgumentException if the object doesn't implement FilterInterface
  */
 public function enqueue(ObjectHandlable $filter, $priority = null)
 {
     if (!$filter instanceof FilterInterface) {
         throw new \InvalidArgumentException('Filter needs to implement FilterInterface');
     }
     $priority = is_int($priority) ? $priority : FilterChain::PRIORITY_NORMAL;
     return parent::enqueue($filter, $priority);
 }