public function getAllViewFilesWithTranslations()
{
/*
* This pattern is derived from Barryvdh\TranslationManager by Barry vd. Heuvel <[email protected]>
*
* https://github.com/barryvdh/laravel-translation-manager/blob/master/src/Manager.php
*/
$functions = ['trans', 'trans_choice', 'Lang::get', 'Lang::choice', 'Lang::trans', 'Lang::transChoice', '@lang', '@choice'];
$pattern = '[^\\w]' . '(?<!->)' . '(' . implode('|', $functions) . ')' . "\\(" . "[\\'\"]" . '(' . '[a-zA-Z0-9_-]+' . "([.][^)]+)+" . ')' . "[\\'\"]" . "[\\),]";
$allMatches = [];
/** @var \Symfony\Component\Finder\SplFileInfo $file */
foreach ($this->disk->allFiles($this->syncPaths) as $file) {
if (preg_match_all("/{$pattern}/siU", $file->getContents(), $matches)) {
$allMatches[$file->getRelativePathname()] = $matches[2];
}
}
return $allMatches;
}