Skip to content

Commit 704fe4e

Browse files
committed
fix strtr array parameter!
1 parent 1930521 commit 704fe4e

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/Health.php

+11-7
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ private function executeValidation(object $validation, ConnectionInterface $to)
378378
// If the 'sourceFolder' property is set, then we are validating a folder of i18n files
379379
$dataPath = rtrim($validation->sourceFolder, '/');
380380
$matches = null;
381-
if (preg_match("/^(wider\-region|national\-calendar|diocesan\-calendar)\-([A-Z][_a-z]+)\-i18n$/", $validation->validate, $matches)) {
381+
if (preg_match("/^(wider\-region|national\-calendar|diocesan\-calendar)\-([A-Za-z_]+)\-i18n$/", $validation->validate, $matches)) {
382382
switch ($matches[1]) {
383383
case 'wider-region':
384384
$dataPath = strtr(
@@ -397,8 +397,10 @@ private function executeValidation(object $validation, ConnectionInterface $to)
397397
$nation = $diocese->nation;
398398
$dataPath = strtr(
399399
JsonData::DIOCESAN_CALENDARS_I18N_FOLDER,
400-
['{diocese}' => $matches[2]],
401-
['{nation}' => $nation]
400+
[
401+
'{diocese}' => $matches[2],
402+
'{nation}' => $nation
403+
]
402404
);
403405
break;
404406
}
@@ -433,9 +435,11 @@ private function executeValidation(object $validation, ConnectionInterface $to)
433435
$dioceseName = $diocese->diocese;
434436
$dataPath = strtr(
435437
JsonData::DIOCESAN_CALENDARS_FILE,
436-
['{diocese}' => $matches[2]],
437-
['{nation}' => $nation],
438-
['{diocese_name}' => $dioceseName]
438+
[
439+
'{diocese}' => $matches[2],
440+
'{nation}' => $nation,
441+
'{diocese_name}' => $dioceseName
442+
]
439443
);
440444
break;
441445
}
@@ -463,7 +467,7 @@ private function executeValidation(object $validation, ConnectionInterface $to)
463467
if (false === $files || empty($files)) {
464468
$message = new \stdClass();
465469
$message->type = "error";
466-
$message->text = "Data folder $validation->sourceFolder does not exist or does not contain any json files";
470+
$message->text = "Data folder $validation->sourceFolder ($dataPath) does not exist or does not contain any json files";
467471
$message->classes = ".$validation->validate.file-exists";
468472
$this->sendMessage($to, $message);
469473
return;

0 commit comments

Comments
 (0)