File indexing completed on 2024-05-26 06:02:32

0001 <?php
0002 
0003 /**
0004  * Represents a directive ID in the interchange format.
0005  */
0006 class HTMLPurifier_ConfigSchema_Interchange_Id
0007 {
0008 
0009     /**
0010      * @type string
0011      */
0012     public $key;
0013 
0014     /**
0015      * @param string $key
0016      */
0017     public function __construct($key)
0018     {
0019         $this->key = $key;
0020     }
0021 
0022     /**
0023      * @return string
0024      * @warning This is NOT magic, to ensure that people don't abuse SPL and
0025      *          cause problems for PHP 5.0 support.
0026      */
0027     public function toString()
0028     {
0029         return $this->key;
0030     }
0031 
0032     /**
0033      * @return string
0034      */
0035     public function getRootNamespace()
0036     {
0037         return substr($this->key, 0, strpos($this->key, "."));
0038     }
0039 
0040     /**
0041      * @return string
0042      */
0043     public function getDirective()
0044     {
0045         return substr($this->key, strpos($this->key, ".") + 1);
0046     }
0047 
0048     /**
0049      * @param string $id
0050      * @return HTMLPurifier_ConfigSchema_Interchange_Id
0051      */
0052     public static function make($id)
0053     {
0054         return new HTMLPurifier_ConfigSchema_Interchange_Id($id);
0055     }
0056 }
0057 
0058 // vim: et sw=4 sts=4