Horde_Imap_Client_Ids::add PHP Method

add() public method

Add IDs to the current object.
public add ( mixed $ids )
$ids mixed Either self::ALL, self::SEARCH_RES, self::LARGEST, Horde_Imap_Client_Ids object, array, or sequence string.
    public function add($ids)
    {
        if (!is_null($ids)) {
            if (is_string($ids) && in_array($ids, array(self::ALL, self::SEARCH_RES, self::LARGEST))) {
                $this->_ids = $ids;
            } elseif ($add = $this->_resolveIds($ids)) {
                if (is_array($this->_ids) && !empty($this->_ids)) {
                    foreach ($add as $val) {
                        $this->_ids[] = $val;
                    }
                } else {
                    $this->_ids = $add;
                }
                if (!$this->duplicates) {
                    $this->_ids = count($this->_ids) > 25000 ? array_unique($this->_ids) : array_keys(array_flip($this->_ids));
                }
            }
            $this->_sorted = is_array($this->_ids) && count($this->_ids) === 1;
        }
    }

Usage Example

Ejemplo n.º 1
0
 public function testRemoveWithDuplicateSequenceNumbers()
 {
     $map = new Horde_Imap_Client_Ids_Map(array(1 => 1, 2 => 2, 3 => 3));
     // Inefficient sequence number remove with duplicate sequence numbers.
     $ids = new Horde_Imap_Client_Ids(array(), true);
     $ids->duplicates = true;
     $ids->add(array('2', '2'));
     $map->remove($ids);
     $this->assertEquals(array(1 => 1), $map->map);
 }
All Usage Examples Of Horde_Imap_Client_Ids::add