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

Commit

Permalink
Generator: propagate error if found unexpected data
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlindhe committed Feb 7, 2017
1 parent 9903ba3 commit 206c158
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,17 @@ private function allocateLocaleArray($path)
$this->allocateLocaleArray($path . '/' . $fileinfo->getFilename());
} else {
$noExt = $this->removeExtension($fileinfo->getFilename());
$fileName = $path . '/' . $fileinfo->getFilename();

// Ignore non *.php files (ex.: .gitignore, vim swap files etc.)
if (pathinfo($fileinfo->getFileName(), PATHINFO_EXTENSION) !== 'php') {
if (pathinfo($fileName, PATHINFO_EXTENSION) !== 'php') {
continue;
}
$tmp = include($fileName);
if (gettype($tmp) !== "array") {
throw new Exception('Unexpected data while processing '.$fileName);
continue;
}
$tmp = include($path . '/' . $fileinfo->getFilename());

$data[$noExt] = $this->adjustArray($tmp);
}
Expand Down

0 comments on commit 206c158

Please sign in to comment.