@@ -557,7 +557,7 @@ public function validateIndexFile($originFile)
557557 */
558558 public function validateJsonFile ($ originFile )
559559 {
560- $ fileContents = (string ) file_get_contents ($ this ->originPath . '/ ' . $ originFile );
560+ $ fileContents = (string ) file_get_contents ($ this ->originPath . '/ ' . $ originFile );
561561 $ jsonContent = json_decode ($ fileContents , true );
562562
563563 if (!$ jsonContent ['name ' ] == (substr ($ originFile , 21 ) === 'phpbb/phpbb-language- ' ))
@@ -583,7 +583,7 @@ public function validateJsonFile($originFile)
583583 {
584584 $ this ->output ->addMessage (Output::FATAL , 'The defined version should not be empty. ' , $ originFile );
585585 }
586- elseif (preg_match ('^(\d+\.)?(\d+\.)?(\*|\d+)$ ' , $ jsonContent ['version ' ]))
586+ elseif (preg_match ('/ ^(\d+\.)?(\d+\.)?(\*|\d+)$/ ' , $ jsonContent ['version ' ]))
587587 {
588588 $ this ->output ->addMessage (Output::FATAL , 'The defined version is in the wrong format. ' , $ originFile );
589589 }
@@ -617,12 +617,12 @@ public function validateJsonFile($originFile)
617617 $ this ->output ->addMessage (Output::FATAL , 'The extra section is missing. ' , $ originFile );
618618 }
619619 // language-iso must be valid
620- if (preg_match ('^(?:[a-z]*_?){0,2}[a-z]*$ ' , $ jsonContent ['extra ' ]['language-iso ' ]))
620+ if (preg_match ('/ ^(?:[a-z]*_?){0,2}[a-z]*$/ ' , $ jsonContent ['extra ' ]['language-iso ' ]))
621621 {
622- $ this ->output ->addMessage (Output::FATAL , 'The language-iso should only contain small letters from a to z or maximum two underscores. ' , $ originFile );
622+ $ this ->output ->addMessage (Output::FATAL , 'The language-iso should only contain small letters from a to z and maximum two underscores. ' , $ originFile );
623623 }
624624 // Check for english name
625- if ($ jsonContent ['extra ' ]['english-name ' ] == '' || preg_match ('^[a-zA-Z\s]+$ ' , $ jsonContent ['extra ' ]['english-name ' ]))
625+ if ($ jsonContent ['extra ' ]['english-name ' ] == '' || preg_match ('/ ^[a-zA-Z\s]+$/ ' , $ jsonContent ['extra ' ]['english-name ' ]))
626626 {
627627 $ this ->output ->addMessage (Output::ERROR , 'The english-name value should only contain letters aA-zZ and spaces. ' , $ originFile );
628628 }
@@ -632,12 +632,12 @@ public function validateJsonFile($originFile)
632632 $ this ->output ->addMessage (Output::ERROR , 'The local-name value should not be empty. ' , $ originFile );
633633 }
634634 // Check for valid phpBB-Version, we accept: 4.0.0, 4.0.0-a1 or 4.0.0-b1 or 4.0.0-RC1
635- if (!preg_match ('^\d+\.\d+\.\d+(-(?:a|b|RC)\d+)?$ ' , $ jsonContent ['extra ' ]['phpbb-version ' ]) || $ jsonContent ['extra ' ]['phpbb-version ' ] == '' )
635+ if (!preg_match ('/ ^\d+\.\d+\.\d+(-(?:a|b|RC)\d+)?$/ ' , $ jsonContent ['extra ' ]['phpbb-version ' ]) || $ jsonContent ['extra ' ]['phpbb-version ' ] == '' )
636636 {
637637 $ this ->output ->addMessage (Output::FATAL , 'The phpbb-version value should not be empty and contain a valid version number. ' , $ originFile );
638638 }
639639 // Check for valid direction
640- $ direction = $ jsonContent ['extra ' ]['phpbb- direction ' ];
640+ $ direction = $ jsonContent ['extra ' ]['direction ' ];
641641 if (!in_array ($ direction , array ('ltr ' , 'rtl ' )))
642642 {
643643 $ this ->output ->addMessage (Output::FATAL , 'The direction can only be rtl or ltr. ' , $ originFile );
@@ -648,7 +648,7 @@ public function validateJsonFile($originFile)
648648 $ this ->output ->addMessage (Output::FATAL , 'The user-lang must be defined. ' , $ originFile );
649649 }
650650 // Check for plural-rule
651- if (!preg_match ('^(?:[0-9]|1[0-5])$ ' , $ jsonContent ['extra ' ]['plural-rule ' ]))
651+ if (!preg_match ('/ ^(?:[0-9]|1[0-5])$/ ' , $ jsonContent ['extra ' ]['plural-rule ' ]))
652652 {
653653 $ this ->output ->addMessage (Output::FATAL , 'Plural rules does not have a valid value. ' , $ originFile );
654654 }
0 commit comments