PageRenderTime 46ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/kotal/vendor/phptal/PHPTAL/Namespace.php

https://bitbucket.org/chrispiechowicz/zepto
PHP | 70 lines | 49 code | 3 blank | 18 comment | 2 complexity | 9f70110aa89b97f7fb5b25155249617e MD5 | raw file
Possible License(s): LGPL-2.1, MIT, BSD-3-Clause
  1. <?php
  2. /**
  3. * PHPTAL templating engine
  4. *
  5. * PHP Version 5
  6. *
  7. * @category HTML
  8. * @package PHPTAL
  9. * @author Laurent Bedubourg <lbedubourg@motion-twin.com>
  10. * @author Kornel Lesiński <kornel@aardvarkmedia.co.uk>
  11. * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
  12. * @version SVN: $Id$
  13. * @link http://phptal.org/
  14. */
  15. /**
  16. * @see PHPTAL_NamespaceAttribute
  17. * @package PHPTAL
  18. * @subpackage Namespace
  19. */
  20. abstract class PHPTAL_Namespace
  21. {
  22. private $prefix, $namespace_uri;
  23. protected $_attributes;
  24. public function __construct($prefix, $namespace_uri)
  25. {
  26. if (!$namespace_uri || !$prefix) {
  27. throw new PHPTAL_ConfigurationException("Can't create namespace with empty prefix or namespace URI");
  28. }
  29. $this->_attributes = array();
  30. $this->prefix = $prefix;
  31. $this->namespace_uri = $namespace_uri;
  32. }
  33. public function getPrefix()
  34. {
  35. return $this->prefix;
  36. }
  37. public function getNamespaceURI()
  38. {
  39. return $this->namespace_uri;
  40. }
  41. public function hasAttribute($attributeName)
  42. {
  43. return array_key_exists(strtolower($attributeName), $this->_attributes);
  44. }
  45. public function getAttribute($attributeName)
  46. {
  47. return $this->_attributes[strtolower($attributeName)];
  48. }
  49. public function addAttribute(PHPTAL_NamespaceAttribute $attribute)
  50. {
  51. $attribute->setNamespace($this);
  52. $this->_attributes[strtolower($attribute->getLocalName())] = $attribute;
  53. }
  54. public function getAttributes()
  55. {
  56. return $this->_attributes;
  57. }
  58. abstract public function createAttributeHandler(PHPTAL_NamespaceAttribute $att, PHPTAL_Dom_Element $tag, $expression);
  59. }