@@ -268,6 +268,16 @@ public function setSafeMode($safeMode)
268268 return $ this ;
269269 }
270270
271+ /**
272+ * Open the composer.json of the language pack and
273+ * save it to an array, accessible for the following functions
274+ */
275+ public function openComposerJson ($ originFile )
276+ {
277+ $ fileContents = (string ) file_get_contents ($ this ->originPath . '/ ' . $ originFile );
278+ return json_decode ($ fileContents , true );
279+ }
280+
271281 /**
272282 * Decides which validation function to use
273283 *
@@ -557,8 +567,7 @@ public function validateIndexFile($originFile)
557567 */
558568 public function validateJsonFile ($ originFile )
559569 {
560- $ fileContents = (string ) file_get_contents ($ this ->originPath . '/ ' . $ originFile );
561- $ jsonContent = json_decode ($ fileContents , true );
570+ $ jsonContent = $ this ->openComposerJson ($ originFile );
562571
563572 if (!str_starts_with ($ jsonContent ['name ' ], 'phpbb/phpbb-language- ' ))
564573 {
@@ -660,8 +669,8 @@ public function validateJsonFile($originFile)
660669 */
661670 public function validateCaptchaValues ($ originFile )
662671 {
663- $ fileContents = ( string ) file_get_contents ( $ this ->originPath . ' / ' . $ originFile );
664- $ jsonContent = json_decode ( $ fileContents , true );
672+ $ jsonContent = $ this ->openComposerJson ( $ originFile );
673+
665674 // The key 'RECAPTCHA_LANG' must match the list provided by Google, or be left empty
666675 // Check for valid recaptcha-lang: en-GB
667676 if (!in_array ($ jsonContent ['extra ' ]['recaptcha-lang ' ], $ this ->reCaptchaLanguages ))
0 commit comments