2008-03-22 03:55:59 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a directive ID in the interchange format.
|
|
|
|
*/
|
|
|
|
class HTMLPurifier_ConfigSchema_Interchange_Id
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @type string
|
|
|
|
*/
|
2009-02-07 07:53:20 +00:00
|
|
|
public $key;
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @param string $key
|
|
|
|
*/
|
|
|
|
public function __construct($key)
|
|
|
|
{
|
2009-02-07 07:53:20 +00:00
|
|
|
$this->key = $key;
|
2008-03-22 03:55:59 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-03-23 02:50:42 +00:00
|
|
|
/**
|
2013-07-16 11:56:14 +00:00
|
|
|
* @return string
|
2008-03-23 02:50:42 +00:00
|
|
|
* @warning This is NOT magic, to ensure that people don't abuse SPL and
|
|
|
|
* cause problems for PHP 5.0 support.
|
|
|
|
*/
|
2013-07-16 11:56:14 +00:00
|
|
|
public function toString()
|
|
|
|
{
|
2009-02-07 07:53:20 +00:00
|
|
|
return $this->key;
|
|
|
|
}
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getRootNamespace()
|
|
|
|
{
|
2009-02-07 07:53:20 +00:00
|
|
|
return substr($this->key, 0, strpos($this->key, "."));
|
|
|
|
}
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getDirective()
|
|
|
|
{
|
2009-02-07 07:53:20 +00:00
|
|
|
return substr($this->key, strpos($this->key, ".") + 1);
|
2008-03-22 03:55:59 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @param string $id
|
|
|
|
* @return HTMLPurifier_ConfigSchema_Interchange_Id
|
|
|
|
*/
|
|
|
|
public static function make($id)
|
|
|
|
{
|
2009-02-07 07:53:20 +00:00
|
|
|
return new HTMLPurifier_ConfigSchema_Interchange_Id($id);
|
2008-03-22 03:55:59 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-06 09:24:59 +00:00
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|