| Conditions | 5 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function __invoke(string $path): ?string |
||
| 27 | { |
||
| 28 | foreach ($this->map as $item) { |
||
| 29 | foreach ($item as $match => $replace) { |
||
| 30 | if (empty($match)) { |
||
| 31 | return $replace.$path; |
||
| 32 | } |
||
| 33 | |||
| 34 | if (0 === strpos($path, $match)) { |
||
| 35 | return preg_replace( |
||
| 36 | '/^'.preg_quote($match, '/').'/', |
||
| 37 | $replace, |
||
| 38 | $path |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 | return null; |
||
| 45 | } |
||
| 47 |