Changeset 3002
- Timestamp:
- 10/08/08 19:58:55 (3 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/src/config/util/dom/AgaviXmlConfigDomElement.class.php
r3001 r3002 3 3 class AgaviXmlConfigDomElement extends DOMElement implements IteratorAggregate 4 4 { 5 /** 6 * __toString() magic method, returns the element value. 7 * 8 * @see AgaviXmlConfigDomElement::getValue() 9 * 10 * @return string The element value. 11 * 12 * @author David Zülke <david.zuelke@bitextender.com> 13 * @since 1.0.0 14 */ 5 15 public function __toString() 6 16 { … … 8 18 } 9 19 20 /** 21 * Returns the element name. 22 * 23 * @return string The element name. 24 * 25 * @author David Zülke <david.zuelke@bitextender.com> 26 * @since 1.0.0 27 */ 10 28 public function getName() 11 29 { … … 15 33 } 16 34 35 /** 36 * Returns the element value. 37 * 38 * @return string The element value. 39 * 40 * @author David Zülke <david.zuelke@bitextender.com> 41 * @since 1.0.0 42 */ 17 43 public function getValue() 18 44 { … … 28 54 * @return Iterator An iterator. 29 55 * 30 * @author David Zülke <d z@bitxtender.com>56 * @author David Zülke <david.zuelke@bitextender.com> 31 57 * @since 1.0.0 32 58 */ … … 42 68 } 43 69 70 /** 71 * Retrieve singular form of given element name. 72 * This does special splitting only of the last part of the name if the name 73 * of the element contains hyphens, underscores or dots. 74 * 75 * @param string The element name to singularize. 76 * 77 * @return string The singularized element name. 78 * 79 * @author Noah Fontes <noah.fontes@bitextender.com> 80 * @since 1.0.0 81 */ 44 82 protected function singularize($name) 45 83 { 84 // TODO: shouldn't this be static? 46 85 $names = preg_split('#([_\-\.])#', $name, -1, PREG_SPLIT_DELIM_CAPTURE); 47 86 $names[count($names) - 1] = AgaviInflector::singularize(end($names)); … … 268 307 * @see DOMElement::getAttribute() 269 308 * 270 * @author David Zülke <d z@bitxtender.com>309 * @author David Zülke <david.zuelke@bitextender.com> 271 310 * @since 1.0.0 272 311 */ … … 298 337 * @see DOMElement::getAttributeNS() 299 338 * 300 * @author David Zülke <d z@bitxtender.com>339 * @author David Zülke <david.zuelke@bitextender.com> 301 340 * @since 1.0.0 302 341 */ … … 307 346 if($retval === null) { 308 347 $retval = $default; 348 } 349 350 return $retval; 351 } 352 353 /** 354 * Retrieve all attributes of the element that are in no namespace. 355 * 356 * @return array An associative array of attribute names and values. 357 * 358 * @author David Zülke <david.zuelke@bitextender.com> 359 * @since 1.0.0 360 */ 361 public function getAttributes() 362 { 363 return $this->getAttributesNS(''); 364 } 365 366 /** 367 * Retrieve all attributes of the element that are in the given namespace. 368 * 369 * @return array An associative array of attribute names and values. 370 * 371 * @author David Zülke <david.zuelke@bitextender.com> 372 * @since 1.0.0 373 */ 374 public function getAttributesNS($namespaceUri) 375 { 376 $retval = array(); 377 378 foreach($this->ownerDocument->getXpath()->query(sprintf('@*[namespace-uri() = "%s"]', $namespaceUri), $this) as $attribute) { 379 $retval[$attribute->localName] = $attribute->nodeValue; 309 380 } 310 381

