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