1 | <?php |
||
20 | class ApiUrl implements SourceAccessorInterface |
||
21 | { |
||
22 | |||
23 | use SourceMagic; |
||
24 | |||
25 | private static $sources = []; |
||
26 | private $dotName = ''; |
||
27 | private $source = ''; |
||
28 | |||
29 | public function __construct($className = null, $text = '') |
||
66 | |||
67 | /** |
||
68 | * Set root url of current project API. This can be relative or absolute url. |
||
69 | * |
||
70 | * Set url for many projects with namespaces - this allows cross-linking different projects: |
||
71 | * |
||
72 | * ``` |
||
73 | * ApiUrl::setRoot([ |
||
74 | * '/mangan/api' => 'Maslosoft\\Mangan\\' |
||
75 | * '/addendum/api' => 'Maslosoft\\Addendum\\' |
||
76 | * ]); |
||
77 | * ``` |
||
78 | * |
||
79 | * Could also be used for one project, but might result in wrong url if |
||
80 | * used on classes outside of project: |
||
81 | * |
||
82 | * ``` |
||
83 | * ApiUrl::setRoot('/mangan/api); |
||
84 | * ``` |
||
85 | * |
||
86 | * |
||
87 | * @param string $apiUrl |
||
88 | */ |
||
89 | public static function setRoot($apiUrl) |
||
117 | |||
118 | public function method($name) |
||
123 | |||
124 | public function property($name) |
||
129 | |||
130 | public static function __callStatic($name, $arguments) |
||
134 | |||
135 | public function __toString() |
||
139 | |||
140 | /** |
||
141 | * Ensure that name starts and ends with slash |
||
142 | * @param string $name |
||
143 | * @return string |
||
144 | */ |
||
145 | private static function normalize($name) |
||
149 | |||
150 | } |
||
151 |