Exemplo 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);
 }
Exemplo n.º 2
0
 /**
  * Returns the object from the set
  *
  * Required by interface ArrayAccess
  *
  * @param   ObjectHandlable $object
  * @return  ObjectHandlable
  * @throws  \InvalidArgumentException if the object doesn't implement ObjectHandlable
  */
 public function offsetGet($object)
 {
     if (!$object instanceof ObjectHandlable) {
         throw new \InvalidArgumentException('Object needs to implement ObjectHandlable');
     }
     return $this->_object_set->offsetGet($object->getHandle());
 }
Exemplo n.º 3
0
 /**
  * Check if the queue does contain a given object
  *
  * @param  ObjectHandlable $object
  * @return bool
  */
 public function contains(ObjectHandlable $object)
 {
     $result = false;
     if ($handle = $object->getHandle()) {
         $result = $this->_object_list->offsetExists($handle);
     }
     return $result;
 }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
0
 /**
  * Removes a row from the rowset
  *
  * The row will be removed based on it's identity_column if set or otherwise by
  * it's object handle.
  *
  * @param  DatabaseRowInterface $row
  * @return DatabaseRowsetAbstract
  * @throws \InvalidArgumentException if the object doesn't implement DatabaseRowInterface
  */
 public function extract(ObjectHandlable $row)
 {
     if (!$row instanceof DatabaseRowInterface) {
         throw new \InvalidArgumentException('Row needs to implement DatabaseRowInterface');
     }
     if (isset($this->_identity_column)) {
         $handle = $row->{$this->_identity_column};
     } else {
         $handle = $row->getHandle();
     }
     if ($this->_object_set->offsetExists($handle)) {
         $this->_object_set->offsetUnset($handle);
     }
     return $this;
 }
Exemplo n.º 6
0
 /**
  * Removes an object from the set
  *
  * Required by interface ArrayAccess
  *
  * @param   ObjectHandlable  $object
  * @return  ObjectSet
  * @throws  \InvalidArgumentException if the object doesn't implement the ObjectHandlable interface
  */
 public function offsetUnset($object)
 {
     if (!$object instanceof ObjectHandlable) {
         throw new \InvalidArgumentException('Object needs to implement ObjectHandlable');
     }
     unset($this->__data[$object->getHandle()]);
     return $this;
 }