/** * 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; }
/** * 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; }
/** * Fetches an object from the queue. * * @param unknown_type $channel * @return unknown */ public static function Fetch($queue) { $queue = ObjectQueue::GetQueue($queue); $item = $queue->qmanager->receive($queue->queue); if (count($item) > 0) { $queue->qmanager->delete($queue->queue, $item[0]['receipt']); $item = new SimpleModel($item[0]['body'], $queue->domain, $queue->db); return $item; } return null; }
/** * 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; }
/** * 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; }
/** * Get the priority of a command handler * * @param CommandHandlerInterface $handler A command handler * @return integer The command priority */ public function getHandlerPriority(CommandHandlerInterface $handler) { return $this->__queue->getPriority($handler); }
/** * Get the priority of a command * * @param CommandInterface $object * @return integer The command priority * @throws \InvalidArgumentException if the object doesn't implement CommandInterface */ public function getPriority(ObjectHandlable $command) { if (!$command instanceof CommandInterface) { throw new \InvalidArgumentException('Command needs to implement CommandInterface'); } return parent::getPriority($command); }
/** * Check if the queue does contain a given filter * * @param TemplateFilterInterface $filter * @return bool * @throws \InvalidArgumentException if the object doesn't implement TemplateFilterInterface */ public function contains(ObjectHandlable $filter) { if (!$filter instanceof TemplateFilterInterface) { throw new \InvalidArgumentException('Filter needs to implement TemplateFilterInterface'); } return parent::contains($filter); }
/** * Check if the queue does contain a given bootstrapper * * @param BootstrapperInterface $boostrapper * @return bool * @throws \InvalidArgumentException if the object doesn't implement BootstrapperInterface */ public function contains(ObjectHandlable $bootstrapper) { if (!$bootstrapper instanceof BootstrapperInterface) { throw new \InvalidArgumentException('Filter needs to implement BootstrapperInterface'); } return parent::contains($bootstrapper); }
/** * 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; }
/** * Add an error message to the top filter in the queue * * @param string $message The error message to add * @return FilterChain */ public function addError($message) { $this->_queue->top()->addError($message); return $this; }