]>
Commit | Line | Data |
---|---|---|
d4949327 NL |
1 | <?php\r |
2 | \r | |
3 | /**\r | |
4 | * Represents a directive ID in the interchange format.\r | |
5 | */\r | |
6 | class HTMLPurifier_ConfigSchema_Interchange_Id\r | |
7 | {\r | |
8 | \r | |
9 | /**\r | |
10 | * @type string\r | |
11 | */\r | |
12 | public $key;\r | |
13 | \r | |
14 | /**\r | |
15 | * @param string $key\r | |
16 | */\r | |
17 | public function __construct($key)\r | |
18 | {\r | |
19 | $this->key = $key;\r | |
20 | }\r | |
21 | \r | |
22 | /**\r | |
23 | * @return string\r | |
24 | * @warning This is NOT magic, to ensure that people don't abuse SPL and\r | |
25 | * cause problems for PHP 5.0 support.\r | |
26 | */\r | |
27 | public function toString()\r | |
28 | {\r | |
29 | return $this->key;\r | |
30 | }\r | |
31 | \r | |
32 | /**\r | |
33 | * @return string\r | |
34 | */\r | |
35 | public function getRootNamespace()\r | |
36 | {\r | |
37 | return substr($this->key, 0, strpos($this->key, "."));\r | |
38 | }\r | |
39 | \r | |
40 | /**\r | |
41 | * @return string\r | |
42 | */\r | |
43 | public function getDirective()\r | |
44 | {\r | |
45 | return substr($this->key, strpos($this->key, ".") + 1);\r | |
46 | }\r | |
47 | \r | |
48 | /**\r | |
49 | * @param string $id\r | |
50 | * @return HTMLPurifier_ConfigSchema_Interchange_Id\r | |
51 | */\r | |
52 | public static function make($id)\r | |
53 | {\r | |
54 | return new HTMLPurifier_ConfigSchema_Interchange_Id($id);\r | |
55 | }\r | |
56 | }\r | |
57 | \r | |
58 | // vim: et sw=4 sts=4\r |