1 | <?php |
||
8 | trait BasePathTrait |
||
9 | { |
||
10 | private $basePath = ''; |
||
11 | |||
12 | /** |
||
13 | * Set the basepath used in the request. |
||
14 | * |
||
15 | * @param string $basePath |
||
16 | * |
||
17 | * @return self |
||
18 | */ |
||
19 | public function basePath($basePath) |
||
20 | { |
||
21 | if (strlen($basePath) > 1 && substr($basePath, -1) === '/') { |
||
22 | $this->basePath = substr($basePath, 0, -1); |
||
23 | } else { |
||
24 | $this->basePath = $basePath; |
||
25 | } |
||
26 | |||
27 | return $this; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Removes the basepath from a path. |
||
32 | * |
||
33 | * @param string $path |
||
34 | * |
||
35 | * @return string |
||
36 | */ |
||
37 | private function getPath($path) |
||
45 | } |
||
46 |