コード例 #1
0
 /**
  * Attach a command to the chain
  *
  * The priority parameter can be used to override the command priority with
  * enqueing the command.
  *
  * @param   object      A KCommand object
  * @param   integer     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 $cmd, $priority = null)
 {
     if (!$cmd instanceof KCommandInterface) {
         throw new InvalidArgumentException('Command needs to implement KCommandInterface');
     }
     $priority = is_int($priority) ? $priority : $cmd->getPriority();
     return parent::enqueue($cmd, $priority);
 }
コード例 #2
0
 /**
  * Check if the queue Does contain a given object
  *
  * @param  mixed $datum
  * @return bool
  */
 public function contains(KObjectHandlable $object)
 {
     $result = false;
     if ($handle = $object->getHandle()) {
         $result = $this->_object_list->offsetExists($handle);
     }
     return $result;
 }
コード例 #3
0
ファイル: set.php プロジェクト: JSWebdesign/intranet-platform
 /**
  * Checks if the set contains a specific object
  * 
  * @param   object      The object to look for.
  * @return  bool		Returns TRUE if the object is in the set, FALSE otherwise.
  */
 public function contains(KObjectHandlable $object)
 {
     return $this->_object_set->offsetExists($object->getHandle());
 }
コード例 #4
0
ファイル: abstract.php プロジェクト: stonyyi/anahita
 /**
  * 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  KDatabaseRowInterface $row
  * @return \KDatabaseRowsetAbstract
  * @throws InvalidArgumentException if the object doesn't implement KDatabaseRowInterface
  */
 public function extract(KObjectHandlable $row)
 {
     if (!$row instanceof KDatabaseRowInterface) {
         throw new InvalidArgumentException('Row needs to implement KDatabaseRowInterface');
     }
     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;
 }
コード例 #5
0
ファイル: queue.php プロジェクト: ravenlife/Ninja-Framework
 /**
  * Get the priority of an object in the queue
  * 
  * @param object   A KObject instance
  * @return  integer The command priority
  */
 public function getPriority(KObjectHandlable $object)
 {
     if ($handle = $object->getHandle()) {
         $result = null;
         if ($this->_priority->offsetExist($handle)) {
             $result = $this->_priority->offsetGet($handle);
         }
     }
     return $result;
 }
コード例 #6
0
ファイル: set.php プロジェクト: daodaoliang/nooku-framework
 /**
  * Removes an object from the set
  *
  * Required by interface ArrayAccess
  *
  * @param   KObjectHandlable  $object
  * @return  KObjectSet
  * @throws  \InvalidArgumentException if the object doesn't implement the KObjectHandlable interface
  */
 public function offsetUnset($object)
 {
     if (!$object instanceof KObjectHandlable) {
         throw new InvalidArgumentException('Object needs to implement KObjectHandlable');
     }
     unset($this->_data[$object->getHandle()]);
     return $this;
 }
コード例 #7
0
ファイル: set.php プロジェクト: stonyyi/anahita
 /**
  * Returns the object from the set
  *
  * Required by interface ArrayAccess
  *
  * @param   KObjectHandlable $object
  * @return  KObjectHandlable
  * @throws  InvalidArgumentException if the object doesn't implement KObjectHandlable
  */
 public function offsetGet($object)
 {
     if (!$object instanceof KObjectHandlable) {
         throw new InvalidArgumentException('Object needs to implement KObjectHandlable');
     }
     return $this->_object_set->offsetGet($object->getHandle());
 }