mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-27 20:40:22 +08:00
Update MessageController.php
Fixed order of checking config `format` property
This commit is contained in:
@@ -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
|
|||||||
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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user