1 | <?php |
||
24 | class ApiUrl implements SourceAccessorInterface |
||
25 | { |
||
26 | |||
27 | use SourceMagic; |
||
28 | |||
29 | private static $sources = []; |
||
30 | private $dotName = ''; |
||
31 | private $source = ''; |
||
|
|||
32 | private $className = ''; |
||
33 | |||
34 | public function __construct($className = null, $text = '') |
||
40 | |||
41 | /** |
||
42 | * Set root url of current project API. This can be relative or absolute url. |
||
43 | * |
||
44 | * Set url for many projects with namespaces - this allows cross-linking different projects: |
||
45 | * |
||
46 | * ``` |
||
47 | * ApiUrl::setRoot([ |
||
48 | * '/mangan/api' => 'Maslosoft\\Mangan\\' |
||
49 | * '/addendum/api' => 'Maslosoft\\Addendum\\' |
||
50 | * ]); |
||
51 | * ``` |
||
52 | * |
||
53 | * Could also be used for one project, but might result in wrong url if |
||
54 | * used on classes outside of project: |
||
55 | * |
||
56 | * ``` |
||
57 | * ApiUrl::setRoot('/mangan/api'); |
||
58 | * ``` |
||
59 | * |
||
60 | * |
||
61 | * @param string|string[] $apiUrl |
||
62 | */ |
||
63 | public static function setRoot($apiUrl) |
||
91 | |||
92 | public function method($name) |
||
97 | |||
98 | public function property($name) |
||
103 | |||
104 | public static function __callStatic($name, $arguments) |
||
108 | |||
109 | public function __toString() |
||
113 | |||
114 | /** |
||
115 | * TODO: Resolve real class where property was defined |
||
116 | * @param string $name Property name |
||
117 | * @return string |
||
118 | */ |
||
119 | private function resolvePropertyClass($name) |
||
123 | |||
124 | /** |
||
125 | * TODO: Resolve real class where method was defined |
||
126 | * @param string $name Method name |
||
127 | * @return string |
||
128 | */ |
||
129 | private function resolveMethodClass($name) |
||
133 | |||
134 | private function resolveSource($className) |
||
169 | |||
170 | /** |
||
171 | * Ensure that name starts and ends with slash |
||
172 | * @param string $name |
||
173 | * @return string |
||
174 | */ |
||
175 | private static function normalize($name) |
||
179 | |||
180 | } |
||
181 |
This check marks private properties in classes that are never used. Those properties can be removed.