public function itemAt($key) { if ($this->contains($key)) { return parent::itemAt($key); } return null; }
/** * Gets the queue with the given name, or creates it if it doesn't exist. * @param string $key the name of the queue * * @return Queue the queue instance */ public function itemAt($key) { $item = parent::itemAt($key); if ($item === null) { $item = $this->createQueue($key); $this->add($key, $item); } return $item; }
/** * Overrides the parent to load resources from the api on demand. * * @inheritDoc */ public function itemAt($key) { $item = parent::itemAt($key); if ($item === null && !in_array($key, $this->_lookedUpResourceNames)) { $resource = $this->lookupResource($key); if ($resource) { $this->add($key, $resource); return $resource; } } return $item; }
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')); }
/** * Returns the element at the specified offset. * This method is required by the interface ArrayAccess. * @param integer $offset the offset to retrieve element. * @return mixed the element at the offset, null if no element is found at the offset */ public function offsetGet($offset) { return $this->_attributes->itemAt($offset); }
public function testAdd() { $collection = new CAttributeCollection(); $collection->add('Property', 'value'); $this->assertEquals('value', $collection->itemAt('Property')); }