Skip to content
This repository was archived by the owner on Jul 16, 2020. It is now read-only.

Commit 371d630

Browse files
committed
Implemented recursive scanning of lang files through subdirs.
1 parent baa633c commit 371d630

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Generator.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,20 @@ private function allocateLocaleArray($path)
4242

4343
$dir = new DirectoryIterator($path);
4444
foreach ($dir as $fileinfo) {
45-
if (!$fileinfo->isDot()) {
45+
// Do not mess with dotfiles at all.
46+
if ($fileinfo->isDot()) {
47+
continue;
48+
}
49+
50+
// Check if the "file" is a subdirectory which has to be scanned.
51+
if ($fileinfo->isDir()) {
52+
// Recursivley iterate through subdirs, until everything was allocated.
53+
$data = $this->allocateLocaleArray($path . '/' . $fileinfo->getFilename());
54+
} else {
4655
$noExt = $this->removeExtension($fileinfo->getFilename());
56+
4757
// Ignore non *.php files (ex.: .gitignore, vim swap files etc.)
48-
if (pathinfo($fileinfo->getFileName())['extension'] !== 'php') {
58+
if (pathinfo($fileinfo->getFileName(), PATHINFO_EXTENSION) !== 'php') {
4959
continue;
5060
}
5161
$tmp = include($path . '/' . $fileinfo->getFilename());

0 commit comments

Comments
 (0)