/usr/share/php/Horde/Date/Parser/Token.php is in php-horde-date-parser 2.0.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | <?php
class Horde_Date_Parser_Token
{
public $word;
public $tags;
public function __construct($word)
{
$this->word = $word;
$this->tags = array();
}
/**
* Tag this token with the specified tag
*/
public function tag($tagClass, $tag)
{
$this->tags[] = array($tagClass, $tag);
}
/**
* Remove all tags of the given class
*/
public function untag($tagClass)
{
$this->tags = array_filter($this->tags, create_function('$t', 'return substr($t[0], 0, ' . strlen($tagClass) . ') != "' . $tagClass . '";'));
}
/**
* Return true if this token has any tags
*/
public function tagged()
{
return count($this->tags) > 0;
}
/**
* Return the Tag that matches the given class
*/
public function getTag($tagClass)
{
$matches = array_filter($this->tags, create_function('$t', 'return substr($t[0], 0, ' . strlen($tagClass) . ') == "' . $tagClass . '";'));
$match = array_shift($matches);
return $match[1];
}
/**
* Print this Token in a pretty way
*/
public function __toString()
{
$tags = array();
foreach ($this->tags as $t) {
$tags[] = implode(': ', $t);
}
return '(' . implode(', ', $tags) . ') ';
}
}
|