@@ -115,17 +115,14 @@ public function create_extension($data)
115115 $ filesystem ->remove ($ this ->root_path . 'store/tmp-ext ' );
116116 $ filesystem ->mkdir ($ ext_path );
117117
118- $ phpbb31 = (bool ) preg_match ('/^[\D]*3\.1.*$/ ' , $ data ['requirements ' ]['phpbb_version_min ' ]);
119-
120118 $ template = $ this ->get_template_engine ();
121119 $ template ->set_custom_style ('skeletonextension ' , $ this ->root_path . 'ext/phpbb/skeleton/skeleton ' );
122120 $ template ->assign_vars ([
123121 'COMPONENT ' => $ data ['components ' ],
124122 'EXTENSION ' => $ data ['extension ' ],
125123 'REQUIREMENTS ' => $ data ['requirements ' ],
126124 'AUTHORS ' => $ data ['authors ' ],
127- 'LANGUAGE ' => $ this ->get_language_version_data ($ phpbb31 ),
128- 'S_PHPBB_31 ' => $ phpbb31 ,
125+ 'LANGUAGE ' => $ this ->get_language_version_data ($ data ),
129126 ]);
130127
131128 $ component_data = $ this ->get_component_dialog_values ();
@@ -236,19 +233,21 @@ protected function get_template_engine()
236233 * Get an array of language class and methods depending on 3.1 or 3.2
237234 * compatibility, for use in the skeleton twig templates.
238235 *
239- * @param bool $phpbb31 Is phpBB 3.1 support requested?
236+ * @param array $data Extension data
240237 *
241238 * @return array An array of language data
242239 */
243- protected function get_language_version_data ($ phpbb31 )
240+ protected function get_language_version_data ($ data )
244241 {
242+ $ phpbb_31 = (bool ) preg_match ('/^\D*3\.1.*$/ ' , $ data ['requirements ' ]['phpbb_version_min ' ]);
243+
245244 return [
246- 'class ' => $ phpbb31 ? '\phpbb\user ' : '\phpbb\language\language ' ,
247- 'object ' => $ phpbb31 ? 'user ' : 'language ' ,
248- 'function ' => $ phpbb31 ? 'add_lang_ext ' : 'add_lang ' ,
245+ 'class ' => $ phpbb_31 ? '\phpbb\user ' : '\phpbb\language\language ' ,
246+ 'object ' => $ phpbb_31 ? 'user ' : 'language ' ,
247+ 'function ' => $ phpbb_31 ? 'add_lang_ext ' : 'add_lang ' ,
249248 'indent ' => [
250- 'class ' => $ phpbb31 ? "\t\t\t" : '' ,
251- 'object ' => $ phpbb31 ? "\t" : '' ,
249+ 'class ' => $ phpbb_31 ? "\t\t\t" : '' ,
250+ 'object ' => $ phpbb_31 ? "\t" : '' ,
252251 ],
253252 ];
254253 }
0 commit comments