Turba_List::insert PHP Method

insert() public method

Inserts a new object into the list.
public insert ( Turba_Object $object )
$object Turba_Object The object to insert.
    public function insert(Turba_Object $object)
    {
        if ($object instanceof Turba_Object) {
            $key = $object->getSource() . ':' . $object->getValue('__key');
            if (!isset($this->objects[$key])) {
                $this->objects[$key] = $object;
            }
        }
    }

Usage Example

コード例 #1
0
ファイル: List.php プロジェクト: horde/horde
 /**
  * Returns a filtered list of objects.
  *
  * @param  string $field  The field to filter on.
  * @param  array $values  An array of values that $field must be equal to
  *                        in order to be returned in the filtered list.
  *
  * @return Turba_List  The filtered list object.
  */
 public function filter($field, array $values)
 {
     $objects = new Turba_List();
     foreach ($this->objects as $obj) {
         if (in_array($obj->getValue($field), $values) !== false) {
             $objects->insert($obj);
         }
     }
     return $objects;
 }
All Usage Examples Of Turba_List::insert