public function testUnset() { $collection = new CAttributeCollection(); $collection->add('Property', 'value'); unset($collection->Property); $this->assertEquals(0, count($collection)); }
public function testRemove() { $collection = new CAttributeCollection(); $collection->add('Property', 'value'); $collection->remove('Property'); $this->assertEquals(0, count($collection)); }
/** * @inheritDoc */ public function add($key, $value) { if (!$value instanceof Queue) { $value = $this->createQueue($key, $value); } else { $value->name = $key; $value->setClient($this->getClient()); } parent::add($key, $value); }
/** * Gets the solr client options * @return CAttributeCollection the client options */ public function getClientOptions() { if ($this->_clientOptions === null) { $clientOptions = new CAttributeCollection(); $clientOptions->caseSensitive = true; if ($this->_client !== null) { foreach ($this->_client->getOptions() as $key => $value) { $clientOptions->add($key, $value); } } $this->_clientOptions = $clientOptions; } return $this->_clientOptions; }
public function testMergeWithCaseInSensitive() { $collection = new CAttributeCollection(); $collection->caseSensitive = true; $collection->add('k1', 'item'); $item = array('K1' => 'ITEM'); $collection->mergeWith($item); $this->assertEquals('item', $collection->itemAt('k1')); $this->assertEquals('ITEM', $collection->itemAt('K1')); }
/** * Sets the element at the specified offset. * This method is required by the interface ArrayAccess. * @param integer $offset the offset to set element * @param mixed $item the element value */ public function offsetSet($offset, $item) { $this->_attributes->add($offset, $item); }