| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | private function buildPatternsAndReplacementsFromMap(array $map, string $direction): array |
||
| 36 | { |
||
| 37 | $finalMap = $map; |
||
| 38 | if ($direction === self::DIRECTION_RTL) { |
||
| 39 | $finalMap = array_flip($map); |
||
| 40 | } |
||
| 41 | |||
| 42 | $patterns = array_map( |
||
| 43 | function (string $wordOrPhrase): string { |
||
| 44 | return sprintf('/\b%s\b/ui', $wordOrPhrase); |
||
| 45 | }, |
||
| 46 | array_keys($finalMap) |
||
|
|
|||
| 47 | ); |
||
| 48 | $replacements = array_values($finalMap); |
||
| 49 | |||
| 50 | return [$patterns, $replacements]; |
||
| 51 | } |
||
| 53 |