| Total Complexity | 4 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | trait PathAware |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var string |
||
| 12 | */ |
||
| 13 | private $path; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Returns the path |
||
| 17 | * |
||
| 18 | * @return string |
||
| 19 | */ |
||
| 20 | public function getPath() |
||
| 21 | { |
||
| 22 | return $this->path; |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Update the path |
||
| 27 | * |
||
| 28 | * @param string $path |
||
| 29 | * |
||
| 30 | * @return $this |
||
| 31 | */ |
||
| 32 | public function setPath($path) |
||
| 33 | { |
||
| 34 | $this->path = $this->normalisePath($path); |
||
| 35 | return $this; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Returns the normalised version of the given path |
||
| 40 | * |
||
| 41 | * @param string $path Path to normalise |
||
| 42 | * |
||
| 43 | * @return string normalised version of the path |
||
| 44 | */ |
||
| 45 | protected function normalisePath($path) |
||
| 51 | } |
||
| 52 | } |
||
| 53 | } |
||
| 54 |