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