@@ -25,23 +25,23 @@ class Manager
2525 private $ path ;
2626
2727 /**
28- * the paths to the views files .
28+ * The paths to directories where we look for localised strings to sync .
2929 *
3030 * @var array
3131 */
32- private $ viewsPaths ;
32+ private $ syncPaths ;
3333
3434 /**
3535 * Manager constructor.
3636 *
3737 * @param Filesystem $disk
3838 * @param string $path
3939 */
40- public function __construct (Filesystem $ disk , $ path , array $ viewsPaths )
40+ public function __construct (Filesystem $ disk , $ path , array $ syncPaths )
4141 {
4242 $ this ->disk = $ disk ;
4343 $ this ->path = $ path ;
44- $ this ->viewsPaths = $ viewsPaths ;
44+ $ this ->syncPaths = $ syncPaths ;
4545 }
4646
4747 /**
@@ -261,7 +261,8 @@ public function collectFromViews()
261261 $ functions = ['trans ' , 'trans_choice ' , 'Lang::get ' , 'Lang::choice ' , 'Lang::trans ' , 'Lang::transChoice ' , '@lang ' , '@choice ' ];
262262
263263 $ pattern =
264- // See http://regexr.com/392hu
264+ // See https://regex101.com/r/jS5fX0/1
265+ '[^\w] ' . // Must not start with any alpha numeric character or underscore
265266 '( ' .implode ('| ' , $ functions ).') ' .// Must start with one of the functions
266267 "\( " .// Match opening parentheses
267268 "[\' \"] " .// Match " or '
@@ -274,7 +275,7 @@ public function collectFromViews()
274275 ;
275276
276277 /** @var \Symfony\Component\Finder\SplFileInfo $file */
277- foreach ($ this ->disk ->allFiles ($ this ->viewsPaths ) as $ file ) {
278+ foreach ($ this ->disk ->allFiles ($ this ->syncPaths ) as $ file ) {
278279 if (preg_match_all ("/ $ pattern/siU " , $ file ->getContents (), $ matches )) {
279280 foreach ($ matches [2 ] as $ key ) {
280281 try {
0 commit comments