protected function takeChildFromDOM($child) { $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; switch ($absoluteNodeName) { case $this->lookupNamespace('openSearch') . ':' . 'totalResults': $totalResults = new Zend_Gdata_Extension_OpenSearchTotalResults(); $totalResults->transferFromDOM($child); $this->_totalResults = $totalResults; break; case $this->lookupNamespace('openSearch') . ':' . 'startIndex': $startIndex = new Zend_Gdata_Extension_OpenSearchStartIndex(); $startIndex->transferFromDOM($child); $this->_startIndex = $startIndex; break; case $this->lookupNamespace('openSearch') . ':' . 'itemsPerPage': $itemsPerPage = new Zend_Gdata_Extension_OpenSearchItemsPerPage(); $itemsPerPage->transferFromDOM($child); $this->_itemsPerPage = $itemsPerPage; break; default: parent::takeChildFromDOM($child); break; } }
public function testExtensionAttributes() { $extensionAttributes = $this->openSearchStartIndex->extensionAttributes; $extensionAttributes['foo1'] = array('name' => 'foo1', 'value' => 'bar'); $extensionAttributes['foo2'] = array('name' => 'foo2', 'value' => 'rab'); $this->openSearchStartIndex->extensionAttributes = $extensionAttributes; $this->assertEquals('bar', $this->openSearchStartIndex->extensionAttributes['foo1']['value']); $this->assertEquals('rab', $this->openSearchStartIndex->extensionAttributes['foo2']['value']); $openSearchStartIndexXml = $this->openSearchStartIndex->saveXML(); $newOpenSearchStartIndex = new Zend_Gdata_Extension_OpenSearchStartIndex(); $newOpenSearchStartIndex->transferFromXML($openSearchStartIndexXml); $this->assertEquals('bar', $newOpenSearchStartIndex->extensionAttributes['foo1']['value']); $this->assertEquals('rab', $newOpenSearchStartIndex->extensionAttributes['foo2']['value']); }