| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | public function getTranslatableStrings(array $patterns): array |
||
| 12 | { |
||
| 13 | $translations = []; |
||
| 14 | $files = $this->getFiles($patterns); |
||
| 15 | |||
| 16 | foreach ($files as $file) { |
||
| 17 | $handle = fopen($file, 'rb'); |
||
| 18 | $text = fread($handle, filesize($file)); |
||
|
|
|||
| 19 | |||
| 20 | $re = '/(?:\_\_|\$t)\(\\\'((?:.(?!(?<![\\\\])\\\'))*.?)/m'; |
||
| 21 | preg_match_all($re, $text, $matches, PREG_SET_ORDER, 0); |
||
| 22 | |||
| 23 | foreach ($matches as $match) { |
||
| 24 | $translations[] = $match[1]; |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | return array_unique($translations); |
||
| 29 | } |
||
| 46 |