friendica/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/Interchange/Id.php

59 lines
1.0 KiB
PHP
Raw Normal View History

2010-09-08 23:14:17 -04:00
<?php
/**
* Represents a directive ID in the interchange format.
*/
class HTMLPurifier_ConfigSchema_Interchange_Id
{
2016-02-09 05:06:17 -05:00
/**
* @type string
*/
2010-09-08 23:14:17 -04:00
public $key;
2016-02-09 05:06:17 -05:00
/**
* @param string $key
*/
public function __construct($key)
{
2010-09-08 23:14:17 -04:00
$this->key = $key;
}
/**
2016-02-09 05:06:17 -05:00
* @return string
2010-09-08 23:14:17 -04:00
* @warning This is NOT magic, to ensure that people don't abuse SPL and
* cause problems for PHP 5.0 support.
*/
2016-02-09 05:06:17 -05:00
public function toString()
{
2010-09-08 23:14:17 -04:00
return $this->key;
}
2016-02-09 05:06:17 -05:00
/**
* @return string
*/
public function getRootNamespace()
{
2010-09-08 23:14:17 -04:00
return substr($this->key, 0, strpos($this->key, "."));
}
2016-02-09 05:06:17 -05:00
/**
* @return string
*/
public function getDirective()
{
2010-09-08 23:14:17 -04:00
return substr($this->key, strpos($this->key, ".") + 1);
}
2016-02-09 05:06:17 -05:00
/**
* @param string $id
* @return HTMLPurifier_ConfigSchema_Interchange_Id
*/
public static function make($id)
{
2010-09-08 23:14:17 -04:00
return new HTMLPurifier_ConfigSchema_Interchange_Id($id);
}
}
// vim: et sw=4 sts=4