blob: 2e95a9f0364a3dd6ba1dd14c0fdb82bb0debda80 (
plain)
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
|
<?php
namespace phorkie;
class Tool_Info
{
public $class;
public function __construct($class)
{
$this->class = $class;
}
/**
* Format the tool path
*
* @param File $file
*
* @return string
*/
public function getLink(File $file)
{
return $file->getLink('tool', $this->stripPrefix($this->class));
}
/**
* Clean namespace from class
*
* @return string
*/
public function getTitle()
{
return $this->stripPrefix($this->class);
}
/**
* Removes custom namespace prefix
*
* @param string $class Class of object
*
* @return string
*/
protected function stripPrefix($class)
{
$prefix = '\\phorkie\\Tool_';
if (substr($class, 0, strlen($prefix)) === $prefix) {
return substr($class, strlen($prefix));
}
return $class;
}
}
?>
|