Id.php 781 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Represents a directive ID in the interchange format.
  4. */
  5. class HTMLPurifier_ConfigSchema_Interchange_Id
  6. {
  7. public $key;
  8. public function __construct($key) {
  9. $this->key = $key;
  10. }
  11. /**
  12. * @warning This is NOT magic, to ensure that people don't abuse SPL and
  13. * cause problems for PHP 5.0 support.
  14. */
  15. public function toString() {
  16. return $this->key;
  17. }
  18. public function getRootNamespace() {
  19. return substr($this->key, 0, strpos($this->key, "."));
  20. }
  21. public function getDirective() {
  22. return substr($this->key, strpos($this->key, ".") + 1);
  23. }
  24. public static function make($id) {
  25. return new HTMLPurifier_ConfigSchema_Interchange_Id($id);
  26. }
  27. }
  28. // vim: et sw=4 sts=4