Commit 2ffd6d8e by Alexander Makarov

Merge pull request #4561 from maxlapko/patch-1

Update MessageController.php
parents 5a8c997d 62bffafe
...@@ -96,6 +96,9 @@ class MessageController extends Controller ...@@ -96,6 +96,9 @@ class MessageController extends Controller
if (!is_dir($config['sourcePath'])) { if (!is_dir($config['sourcePath'])) {
throw new Exception("The source path {$config['sourcePath']} is not a valid directory."); throw new Exception("The source path {$config['sourcePath']} is not a valid directory.");
} }
if (empty($config['format']) || !in_array($config['format'], ['php', 'po', 'db'])) {
throw new Exception('Format should be either "php", "po" or "db".');
}
if (in_array($config['format'], ['php', 'po'])) { if (in_array($config['format'], ['php', 'po'])) {
if (!isset($config['messagePath'])) { if (!isset($config['messagePath'])) {
throw new Exception('The configuration file must specify "messagePath".'); throw new Exception('The configuration file must specify "messagePath".');
...@@ -106,9 +109,6 @@ class MessageController extends Controller ...@@ -106,9 +109,6 @@ class MessageController extends Controller
if (empty($config['languages'])) { if (empty($config['languages'])) {
throw new Exception("Languages cannot be empty."); throw new Exception("Languages cannot be empty.");
} }
if (empty($config['format']) || !in_array($config['format'], ['php', 'po', 'db'])) {
throw new Exception('Format should be either "php", "po" or "db".');
}
$files = FileHelper::findFiles(realpath($config['sourcePath']), $config); $files = FileHelper::findFiles(realpath($config['sourcePath']), $config);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment