Passed
Push — master ( c14394...753352 )
by Goffy
04:41
created

CreateArchitecture::CopyRatingFiles()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 14
nc 2
nop 1
dl 0
loc 23
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
namespace XoopsModules\Modulebuilder\Files;
4
5
use XoopsModules\Modulebuilder;
6
7
/*
8
 You may not change or alter any portion of this comment or credits
9
 of supporting developers from this source code or any supporting source code
10
 which is considered copyrighted (c) material of the original comment or credit authors.
11
12
 This program is distributed in the hope that it will be useful,
13
 but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
 */
16
/**
17
 * modulebuilder module.
18
 *
19
 * @copyright       XOOPS Project (https://xoops.org)
20
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
21
 *
22
 * @since           2.5.0
23
 *
24
 * @author          Txmod Xoops http://www.txmodxoops.org
25
 *
26
 */
27
28
//include dirname(__DIR__) . '/autoload.php';
29
30
/**
31
 * Class Architecture.
32
 */
33
class CreateArchitecture extends CreateStructure
34
{
35
    /**
36
     * @var mixed
37
     */
38
    private $cf = null;
39
40
    /**
41
     * @var mixed
42
     */
43
    private $helper = null;
44
45
    /**
46
     * @public function constructor
47
     * @param null
48
     */
49
    public function __construct()
50
    {
51
        parent::__construct();
52
        $this->helper = Modulebuilder\Helper::getInstance();
53
        $this->cf     = Modulebuilder\Files\CreateFile::getInstance();
54
        $this->setUploadPath(TDMC_UPLOAD_REPOSITORY_PATH);
55
    }
56
57
    /**
58
     * @static function getInstance
59
     *
60
     * @param null
61
     *
62
     * @return Modulebuilder\Files\CreateArchitecture
63
     */
64
    public static function getInstance()
65
    {
66
        static $instance = false;
67
        if (!$instance) {
68
            $instance = new self();
69
        }
70
71
        return $instance;
72
    }
73
74
    /**
75
     * @public function setBaseFoldersFiles
76
     *
77
     * @param $module
78
     */
79
    public function setBaseFoldersFiles($module)
80
    {
81
        // Module
82
        $modId = $module->getVar('mod_id');
83
        // Id of tables
84
        $tables = $this->cf->getTableTables($modId);
85
86
        $table = null;
87
        foreach (array_keys($tables) as $t) {
88
            $tableId   = $tables[$t]->getVar('table_id');
89
            $tableName = $tables[$t]->getVar('table_name');
90
            $table     = $this->helper->getHandler('Tables')->get($tableId);
91
        }
92
93
        $indexFile       = XOOPS_UPLOAD_PATH . '/index.html';
94
        $stlModuleAuthor = str_replace(' ', '', mb_strtolower($module->getVar('mod_author')));
95
        $this->setModuleName($module->getVar('mod_dirname'));
96
        $uploadPath = $this->getUploadPath();
97
        // Creation of "module" folder in the Directory repository
98
        $this->makeDir($uploadPath . '/' . $this->getModuleName());
99
        if (1 != $module->getVar('mod_user')) {
100
            // Copied of index.html file in "root module" folder
101
            $this->copyFile('', $indexFile, 'index.html');
102
        }
103
        if (1 == $module->getVar('mod_admin')) {
104
            // Creation of "admin" folder and index.html file
105
            $this->makeDirAndCopyFile('admin', $indexFile, 'index.html');
106
        }
107
        if (1 == $module->getVar('mod_blocks')) {
108
            // Creation of "blocks" folder and index.html file
109
            $this->makeDirAndCopyFile('blocks', $indexFile, 'index.html');
110
        }
111
        $language  = ('english' !== $GLOBALS['xoopsConfig']['language']) ? $GLOBALS['xoopsConfig']['language'] : 'english';
112
        $copyFiles = [
113
            'class'                           => $indexFile,
114
            'include'                         => $indexFile,
115
            'config'                          => $indexFile,
116
            'language'                        => $indexFile,
117
            'assets'                          => $indexFile,
118
            'assets/css'                      => $indexFile,
119
            'assets/css/admin'                => $indexFile,
120
            'assets/icons'                    => $indexFile,
121
            'assets/icons/16'                 => $indexFile,
122
            'assets/icons/32'                 => $indexFile,
123
            'docs'                            => $indexFile,
124
            'assets/images'                   => $indexFile,
125
            'assets/js'                       => $indexFile,
126
            'language/' . $language           => $indexFile,
127
            'language/' . $language . '/help' => $indexFile,
128
            'preloads'                        => $indexFile,
129
        ];
130
        foreach ($copyFiles as $k => $v) {
131
            // Creation of folders and index.html file
132
            $this->makeDirAndCopyFile($k, $v, 'index.html');
133
        }
134
        //Copy the logo of the module
135
        $modImage = str_replace(' ', '', $module->getVar('mod_image'));
136
        $targetImage = 'logoModule.png';
137
        $this->copyFile('assets/images', TDMC_UPLOAD_IMGMOD_PATH . '/' . $modImage, $targetImage);
138
139
        //Copy blank files
140
        $targetImage = 'blank.gif';
141
        $this->copyFile('assets/images', TDMC_IMAGE_PATH . '/' . $targetImage, $targetImage);
142
        $targetImage = 'blank.png';
143
        $this->copyFile('assets/images', TDMC_IMAGE_PATH . '/' . $targetImage , $targetImage);
144
145
        // Copy of 'module_author_logo.png' file in uploads dir
146
        $logoPng     = $stlModuleAuthor . '_logo.png';
147
        $logoGifFrom = TDMC_UPLOAD_IMGMOD_PATH . '/' . $logoPng;
148
        // If file exists
149
        if (!file_exists($logoGifFrom)) {
150
            // Rename file
151
            $copyFile    = TDMC_IMAGES_LOGOS_URL . '/xoopsdevelopmentteam_logo.gif';
152
            $copyNewFile = $logoGifFrom;
153
            copy($copyFile, $copyNewFile);
154
        } else {
155
            // Copy file
156
            $copyFile    = TDMC_IMAGES_LOGOS_URL . '/' . $logoPng;
157
            $copyNewFile = $logoGifFrom;
158
            copy($copyFile, $copyNewFile);
159
        }
160
161
        // Creation of 'module_author_logo.gif' file
162
        $this->copyFile('assets/images', $copyNewFile, $logoPng);
163
        $docs = [
164
            '/credits.txt' => 'credits.txt',
165
            '/install.txt' => 'install.txt',
166
            '/lang.diff'   => 'lang.diff',
167
            '/license.txt' => 'license.txt',
168
            '/readme.txt'  => 'readme.txt',
169
        ];
170
        foreach ($docs as $k => $v) {
171
            // Creation of folder docs and .txt files
172
            $this->makeDirAndCopyFile('docs', TDMC_DOCS_PATH . $k, $v);
173
        }
174
        if (!empty($tableName)) {
175
            if (1 == $module->getVar('mod_admin') || 1 == $module->getVar('mod_user')) {
176
                // Creation of "templates" folder and index.html file
177
                $this->makeDirAndCopyFile('templates', $indexFile, 'index.html');
178
            }
179
            if (1 == $module->getVar('mod_admin')) {
180
                // Creation of "templates/admin" folder and index.html file
181
                $this->makeDirAndCopyFile('templates/admin', $indexFile, 'index.html');
182
            }
183
            if ((1 == $module->getVar('mod_blocks')) && (1 == $table->getVar('table_blocks'))) {
184
                // Creation of "templates/blocks" folder and index.html file
185
                $this->makeDirAndCopyFile('templates/blocks', $indexFile, 'index.html');
186
            }
187
            // Creation of "sql" folder and index.html file
188
            $this->makeDirAndCopyFile('sql', $indexFile, 'index.html');
189
            if ((1 == $module->getVar('mod_notifications')) && (1 == $table->getVar('table_notifications'))) {
190
                // Creation of "language/local_language/mail_template" folder and index.html file
191
                $this->makeDirAndCopyFile('language/' . $language . '/mail_template', $indexFile, 'index.html');
192
            }
193
        }
194
    }
195
196
    /**
197
     * @public function setFilesToBuilding
198
     *
199
     * @param string $module
200
     *
201
     * @return array
202
     */
203
    public function setFilesToBuilding($module)
204
    {
205
        // Module
206
        $modId         = $module->getVar('mod_id');
207
        $moduleDirname = $module->getVar('mod_dirname');
208
        $icon32        = 'assets/icons/32';
209
        $tables        = $this->cf->getTableTables($modId);
210
        $files         = $this->cf->getTableMorefiles($modId);
211
        $ret           = [];
212
        $templateType  = 'defstyle';
213
214
        $table              = null;
215
        $tableCategory      = [];
216
        //$tableName          = [];
217
        $tableAdmin         = [];
218
        $tableUser          = [];
219
        $tableBlocks        = [];
220
        $tableSearch        = [];
221
        $tableComments      = [];
222
        $tableNotifications = [];
223
        $permTables         = [];
224
        $tablePermissions   = [];
225
        $tableBroken        = [];
226
        $tablePdf           = [];
227
        $tablePrint         = [];
228
        $tableRate          = [];
229
        $tableRss           = [];
230
        $tableSingle        = [];
231
        $tableSubmit        = [];
232
        $tableVisit         = [];
233
        $tableTag           = [];
234
        foreach (array_keys($tables) as $t) {
235
            $tableId              = $tables[$t]->getVar('table_id');
236
            $tableName            = $tables[$t]->getVar('table_name');
237
            $tableSoleName        = $tables[$t]->getVar('table_solename');
238
            $tableCategory[]      = $tables[$t]->getVar('table_category');
239
            $tableImage           = $tables[$t]->getVar('table_image');
240
            $tableAdmin[]         = $tables[$t]->getVar('table_admin');
241
            $tableUser[]          = $tables[$t]->getVar('table_user');
242
            $tableBlocks[]        = $tables[$t]->getVar('table_blocks');
243
            $tableSearch[]        = $tables[$t]->getVar('table_search');
244
            $tableComments[]      = $tables[$t]->getVar('table_comments');
245
            $tableNotifications[] = $tables[$t]->getVar('table_notifications');
246
            $tablePermissions[]   = $tables[$t]->getVar('table_permissions');
247
            $permTables[]         = $tables[$t]->getVar('table_name');
248
            $tableBroken[]        = $tables[$t]->getVar('table_broken');
249
            $tablePdf[]           = $tables[$t]->getVar('table_pdf');
250
            $tablePrint[]         = $tables[$t]->getVar('table_print');
251
            $tableRate[]          = $tables[$t]->getVar('table_rate');
252
            $tableRss[]           = $tables[$t]->getVar('table_rss');
253
            $tableSingle[]        = $tables[$t]->getVar('table_single');
254
            $tableSubmit[]        = $tables[$t]->getVar('table_submit');
255
            $tableVisit[]         = $tables[$t]->getVar('table_visit');
256
            $tableTag[]           = $tables[$t]->getVar('table_tag');
257
258
            // Get Table Object
259
            $table = $this->helper->getHandler('Tables')->get($tableId);
260
            // Copy of tables images file
261
            if (file_exists($uploadTableImage = TDMC_UPLOAD_IMGTAB_PATH . '/' . $tableImage)) {
262
                $this->copyFile($icon32, $uploadTableImage, $tableImage);
263
            } elseif (file_exists($uploadTableImage = XOOPS_ICONS32_PATH . '/' . $tableImage)) {
264
                $this->copyFile($icon32, $uploadTableImage, $tableImage);
265
            }
266
            // Creation of admin files
267
            if (1 === (int)$tables[$t]->getVar('table_admin')) {
268
                // Admin Pages File
269
                $adminPages = Modulebuilder\Files\Admin\AdminPages::getInstance();
270
                $adminPages->write($module, $table, $tableName . '.php');
271
                $ret[] = $adminPages->render();
272
                // Admin Templates File
273
                $adminTemplatesPages = Modulebuilder\Files\Templates\Admin\TemplatesAdminPages::getInstance();
274
                $adminTemplatesPages->write($module, $table, $moduleDirname . '_admin_' . $tableName . '.tpl');
275
                $ret[] = $adminTemplatesPages->render();
276
            }
277
            // Creation of blocks
278
            if (1 === (int)$tables[$t]->getVar('table_blocks')) {
279
                // Blocks Files
280
                $blocksFiles = Modulebuilder\Files\Blocks\BlocksFiles::getInstance();
281
                $blocksFiles->write($module, $table, $tableName . '.php');
282
                $ret[] = $blocksFiles->render();
283
                // Templates Blocks Files
284
                if ($templateType  == 'bootstrap') {
285
                    $templatesBlocks = Modulebuilder\Files\Templates\Blocks\Bootstrap\TemplatesBlocks::getInstance();
0 ignored issues
show
Bug introduced by
The type XoopsModules\Modulebuild...otstrap\TemplatesBlocks was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
286
                } else {
287
                    $templatesBlocks = Modulebuilder\Files\Templates\Blocks\Defstyle\TemplatesBlocks::getInstance();
288
                }
289
                $templatesBlocks->write($module, $table, $moduleDirname . '_block_' . $tableName . '.tpl');
290
                $ret[] = $templatesBlocks->render();
291
            }
292
            // Creation of classes
293
            if (1 === (int)$tables[$t]->getVar('table_admin') || 1 === (int)$tables[$t]->getVar('table_user')) {
294
                // Class Files
295
                $classFiles = Modulebuilder\Files\Classes\ClassFiles::getInstance();
296
                $classFiles->write($module, $table, $tables, ucfirst($tableName) . '.php');
297
                $ret[] = $classFiles->render();
298
            }
299
            // Creation of classhandlers
300
            if (1 === (int)$tables[$t]->getVar('table_admin') || 1 === (int)$tables[$t]->getVar('table_user')) {
301
                // Class Files
302
                $classFiles = Modulebuilder\Files\Classes\ClassHandlerFiles::getInstance();
303
                $classFiles->write($module, $table, $tables, ucfirst($tableName) . 'Handler.php');
304
                $ret[] = $classFiles->render();
305
            }
306
            // Creation of user files
307
            if (1 === (int)$tables[$t]->getVar('table_user')) {
308
                // User Pages File
309
                $userPages = Modulebuilder\Files\User\UserPages::getInstance();
310
                $userPages->write($module, $table, $tableName . '.php');
311
                $ret[] = $userPages->render();
312
                // User Templates File
313
                if ($templateType  == 'bootstrap') {
314
                    $userTemplatesPages = Modulebuilder\Files\Templates\User\Bootstrap\Pages::getInstance();
0 ignored issues
show
Bug introduced by
The type XoopsModules\Modulebuild...es\User\Bootstrap\Pages was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
315
                } else {
316
                    $userTemplatesPages = Modulebuilder\Files\Templates\User\Defstyle\Pages::getInstance();
317
                }
318
                $userTemplatesPages->write($module, $table, $moduleDirname . '_' . $tableName . '.tpl');
319
                $ret[] = $userTemplatesPages->render();
320
                // User List Templates File
321
                if ($templateType  == 'bootstrap') {
322
                    $userTemplatesPagesList = Modulebuilder\Files\Templates\User\Bootstrap\PagesList::getInstance();
0 ignored issues
show
Bug introduced by
The type XoopsModules\Modulebuild...ser\Bootstrap\PagesList was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
323
                } else {
324
                    $userTemplatesPagesList = Modulebuilder\Files\Templates\User\Defstyle\PagesList::getInstance();
325
                }
326
                $userTemplatesPagesList->write($module, $table, $tables, $moduleDirname . '_' . $tableName . '_list' . '.tpl');
327
                $ret[] = $userTemplatesPagesList->render();
328
                // User Item Templates File
329
                if ($templateType  == 'bootstrap') {
330
                    $userTemplatesPagesItem = Modulebuilder\Files\Templates\User\Bootstrap\PagesItem::getInstance();
0 ignored issues
show
Bug introduced by
The type XoopsModules\Modulebuild...ser\Bootstrap\PagesItem was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
331
                } else {
332
                    $userTemplatesPagesItem = Modulebuilder\Files\Templates\User\Defstyle\PagesItem::getInstance();
333
                }
334
                $userTemplatesPagesItem->write($module, $table, $tables, $moduleDirname . '_' . $tableName . '_item' . '.tpl');
335
                $ret[] = $userTemplatesPagesItem->render();
336
                if (1 === (int)$tables[$t]->getVar('table_category')) {
337
                    // User List Templates File
338
                    $userTemplatesCategories = Templates\User\Defstyle\Categories::getInstance();
339
                    $userTemplatesCategories->write($module, $table, $moduleDirname . '_' . $tableName . '_cat.tpl');
340
                    $ret[] = $userTemplatesCategories->render();
341
                    // User List Templates File
342
                    $userTemplatesCategoriesList = Templates\User\Defstyle\CategoriesList::getInstance();
343
                    $userTemplatesCategoriesList->write($module, $table, $moduleDirname . '_' . $tableName . '_cat_list' . '.tpl');
344
                    $ret[] = $userTemplatesCategoriesList->render();
345
                }
346
                // Creation of notifications files
347
                if (1 === (int)$tables[$t]->getVar('table_notifications')) {
348
                    $languageMailTpl = Modulebuilder\Files\Language\LanguageMailTpl::getInstance();
349
                    // Language Mail Template Modify File
350
                    $languageMailTpl->write($module, $table,  $tableSoleName . '_modify_notify.tpl');
351
                    $ret[] = $languageMailTpl->render();
352
                    // Language Mail Template Delete File
353
                    $languageMailTpl->write($module, $table,  $tableSoleName . '_delete_notify.tpl');
354
                    $ret[] = $languageMailTpl->render();
355
                    // Language Mail Template Approve File
356
                    $languageMailTpl->write($module, $table,  $tableSoleName . '_approve_notify.tpl');
357
                    $ret[] = $languageMailTpl->render();
358
                    if (1 === (int)$tables[$t]->getVar('table_broken')) {
359
                        // Language Mail Template Category File
360
                        $languageMailTpl = Modulebuilder\Files\Language\LanguageMailTpl::getInstance();
361
                        $languageMailTpl->write($module, $table,  $tableSoleName . '_broken_notify.tpl');
362
                        $ret[] = $languageMailTpl->render();
363
                    }
364
                    // Creation of notifications files
365
                    if (1 === (int)$tables[$t]->getVar('table_comments')) {
366
                        // Language Mail Template Category File
367
                        $languageMailTpl = Modulebuilder\Files\Language\LanguageMailTpl::getInstance();
368
                        $languageMailTpl->write($module, $table,  $tableSoleName . '_comment_notify.tpl');
369
                        $ret[] = $languageMailTpl->render();
370
                    }
371
                }
372
            }
373
        }
374
375
        // Creation of constants
376
        $classSpecialFiles = Modulebuilder\Files\Classes\ClassSpecialFiles::getInstance();
377
        $classSpecialFiles->write($module, '', $tables, ucfirst('constants') . '.php');
378
        $classSpecialFiles->className = 'Constants';
379
        $ret[] = $classSpecialFiles->renderConstantsInterface();
380
381
        // Creation of permissions
382
        if (in_array(1, $tablePermissions)) {
383
            // Creation of classes
384
            $classSpecialFiles = Modulebuilder\Files\Classes\ClassSpecialFiles::getInstance();
385
            $classSpecialFiles->write($module, '', null, ucfirst('permissions') . '.php');
386
            $classSpecialFiles->className = 'Permissions';
387
            $ret[] = $classSpecialFiles->renderClass();
388
389
            // Creation of classhandlers
390
            $classSpecialFiles = Modulebuilder\Files\Classes\ClassSpecialFiles::getInstance();
391
            $classSpecialFiles->write($module, '', $permTables, ucfirst('PermissionsHandler') . '.php');
392
            $classSpecialFiles->className = 'PermissionsHandler';
393
            $ret[] = $classSpecialFiles->renderPermissionsHandler();
394
395
        }
396
        foreach (array_keys($files) as $t) {
397
            $fileName      = $files[$t]->getVar('file_name');
398
            $fileExtension = $files[$t]->getVar('file_extension');
399
            $fileInfolder  = $files[$t]->getVar('file_infolder');
400
            // More File
401
            $moreFiles = Modulebuilder\Morefiles::getInstance();
402
            $moreFiles->write($module, $fileName, $fileInfolder, $fileExtension);
0 ignored issues
show
Bug introduced by
The method write() does not exist on XoopsModules\Modulebuilder\Morefiles. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

402
            $moreFiles->/** @scrutinizer ignore-call */ 
403
                        write($module, $fileName, $fileInfolder, $fileExtension);
Loading history...
403
            $ret[] = $moreFiles->render();
0 ignored issues
show
Bug introduced by
The method render() does not exist on XoopsModules\Modulebuilder\Morefiles. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

403
            /** @scrutinizer ignore-call */ 
404
            $ret[] = $moreFiles->render();
Loading history...
404
        }
405
        // Language Modinfo File
406
        $languageModinfo = Modulebuilder\Files\Language\LanguageModinfo::getInstance();
407
        $languageModinfo->write($module, $table, 'modinfo.php');
408
        $ret[] = $languageModinfo->render();
409
        if (1 == $module->getVar('mod_admin')) {
410
            // Admin Header File
411
            $adminHeader = Modulebuilder\Files\Admin\AdminHeader::getInstance();
412
            $adminHeader->write($module, $table, $tables, 'header.php');
413
            $ret[] = $adminHeader->render();
414
            // Admin Index File
415
            $adminIndex = Modulebuilder\Files\Admin\AdminIndex::getInstance();
416
            $adminIndex->write($module, $tables, 'index.php');
417
            $ret[] = $adminIndex->render();
418
            // Admin Menu File
419
            $adminObject = Modulebuilder\Files\Admin\AdminMenu::getInstance();
420
            $adminObject->write($module, 'menu.php');
421
            $ret[] = $adminObject->render();
422
            // Admin About File
423
            $adminAbout = Modulebuilder\Files\Admin\AdminAbout::getInstance();
424
            $adminAbout->write($module, 'about.php');
425
            $ret[] = $adminAbout->render();
426
            // Admin Footer File
427
            $adminFooter = Modulebuilder\Files\Admin\AdminFooter::getInstance();
428
            $adminFooter->write($module, 'footer.php');
429
            $ret[] = $adminFooter->render();
430
            // Templates Admin About File
431
            $adminTemplatesAbout = Modulebuilder\Files\Templates\Admin\TemplatesAdminAbout::getInstance();
432
            $adminTemplatesAbout->write($module, $moduleDirname . '_admin_about.tpl');
433
            $ret[] = $adminTemplatesAbout->render();
434
            // Templates Admin Index File
435
            $adminTemplatesIndex = Modulebuilder\Files\Templates\Admin\TemplatesAdminIndex::getInstance();
436
            $adminTemplatesIndex->write($module, $moduleDirname . '_admin_index.tpl');
437
            $ret[] = $adminTemplatesIndex->render();
438
            // Templates Admin Footer File
439
            $adminTemplatesFooter = Modulebuilder\Files\Templates\Admin\TemplatesAdminFooter::getInstance();
440
            $adminTemplatesFooter->write($module, $moduleDirname . '_admin_footer.tpl');
441
            $ret[] = $adminTemplatesFooter->render();
442
            // Templates Admin Header File
443
            $adminTemplatesHeader = Modulebuilder\Files\Templates\Admin\TemplatesAdminHeader::getInstance();
444
            $adminTemplatesHeader->write($module, $moduleDirname . '_admin_header.tpl');
445
            $ret[] = $adminTemplatesHeader->render();
446
            // Language Admin File
447
            $languageAdmin = Modulebuilder\Files\Language\LanguageAdmin::getInstance();
448
            $languageAdmin->write($module, $table, $tables, 'admin.php');
449
            $ret[] = $languageAdmin->render();
450
        }
451
452
        // Class Helper File ==> setCommonFiles
453
454
        // Include Functions File
455
        $includeFunctions = Modulebuilder\Files\Includes\IncludeFunctions::getInstance();
456
        $includeFunctions->write($module, 'functions.php');
457
        $ret[] = $includeFunctions->render();
458
459
        // Include Install File  ==>  setCommonFiles
460
        // Include Uninstall File  ==>  setCommonFiles
461
        // Include Update File  ==>  setCommonFiles
462
463
        if (in_array(1, $tableBlocks)) {
464
            // Language Blocks File
465
            $languageBlocks = Modulebuilder\Files\Language\LanguageBlocks::getInstance();
466
            $languageBlocks->write($module, $tables, 'blocks.php');
467
            $ret[] = $languageBlocks->render();
468
        }
469
        // Creation of admin broken files
470
        if (in_array(1, $tableBroken)) {
471
            // Admin broken File
472
            $adminPermissions = Modulebuilder\Files\Admin\AdminBroken::getInstance();
473
            $adminPermissions->write($module, $tables, 'broken.php');
474
            $ret[] = $adminPermissions->render();
475
            // Templates Admin broken File
476
            $adminTemplatesPermissions = Modulebuilder\Files\Templates\Admin\TemplatesAdminBroken::getInstance();
477
            $adminTemplatesPermissions->write($module, $tables, $moduleDirname . '_admin_broken.tpl');
478
            $ret[] = $adminTemplatesPermissions->render();
479
        }
480
        // Creation of admin permission files
481
        if (in_array(1, $tablePermissions)) {
482
            // Admin Permissions File
483
            $adminPermissions = Modulebuilder\Files\Admin\AdminPermissions::getInstance();
484
            $adminPermissions->write($module, $tables, 'permissions.php');
485
            $ret[] = $adminPermissions->render();
486
            // Templates Admin Permissions File
487
            $adminTemplatesPermissions = Modulebuilder\Files\Templates\Admin\TemplatesAdminPermissions::getInstance();
488
            $adminTemplatesPermissions->write($module, $moduleDirname . '_admin_permissions.tpl');
489
            $ret[] = $adminTemplatesPermissions->render();
490
        }
491
        // Creation of notifications files
492
        if (in_array(1, $tableNotifications)) {
493
            // Include Notifications File
494
            $includeNotifications = Modulebuilder\Files\Includes\IncludeNotifications::getInstance();
495
            $includeNotifications->write($module, $tables, 'notification.inc.php');
496
            $ret[] = $includeNotifications->render();
497
            $languageMailTpl = Modulebuilder\Files\Language\LanguageMailTpl::getInstance();
498
            // Language Mail Template Category File
499
            //$languageMailTpl->write($module, $table, 'category_new_notify.tpl');
500
            //$ret[] = $languageMailTpl->render();
501
            // Language Mail Template New File
502
            $languageMailTpl->write($module, $table, 'global_new_notify.tpl');
503
            $ret[] = $languageMailTpl->render();
504
            // Language Mail Template Modify File
505
            $languageMailTpl->write($module, $table, 'global_modify_notify.tpl');
506
            $ret[] = $languageMailTpl->render();
507
            // Language Mail Template Delete File
508
            $languageMailTpl->write($module, $table, 'global_delete_notify.tpl');
509
            $ret[] = $languageMailTpl->render();
510
            // Language Mail Template Approve File
511
            $languageMailTpl->write($module, $table, 'global_approve_notify.tpl');
512
            $ret[] = $languageMailTpl->render();
513
            if (in_array(1, $tableBroken)) {
514
                // Language Mail Template Broken File
515
                $languageMailTpl->write($module, $table, 'global_broken_notify.tpl');
516
                $ret[] = $languageMailTpl->render();
517
            }
518
            if (in_array(1, $tableComments)) {
519
                // Language Mail Template Broken File
520
                $languageMailTpl->write($module, $table, 'global_comment_notify.tpl');
521
                $ret[] = $languageMailTpl->render();
522
            }
523
        }
524
        // Creation of sql file
525
        if (null != $table->getVar('table_name')) {
526
            // Sql File
527
            $sqlFile = Modulebuilder\Files\Sql\SqlFile::getInstance();
528
            $sqlFile->write($module, 'mysql.sql');
529
            $ret[] = $sqlFile->render();
530
        }
531
        // Creation of search file
532
        if (in_array(1, $tableSearch)) {
533
            // Search File
534
            //TODO: UserSearch has to be adapted
535
            /*
536
            $userSearch = Modulebuilder\Files\User\UserSearch::getInstance();
537
            $userSearch->write($module, $table, 'search.php');
538
            $ret[] = $userSearch->render();
539
            */
540
            // Include Search File
541
            $includeSearch = Modulebuilder\Files\Includes\IncludeSearch::getInstance();
542
            $includeSearch->write($module, $tables, 'search.inc.php');
543
            $ret[] = $includeSearch->render();
544
        }
545
        // Creation of comments files
546
        if (in_array(1, $tableComments)) {
547
            // Include Comments File
548
            $includeComments = Modulebuilder\Files\Includes\IncludeComments::getInstance();
549
            $includeComments->write($module, $table);
550
            $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_edit');
551
            // Include Comments File
552
            $includeComments = Modulebuilder\Files\Includes\IncludeComments::getInstance();
553
            $includeComments->write($module, $table);
554
            $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_delete');
555
            // Include Comments File
556
            $includeComments = Modulebuilder\Files\Includes\IncludeComments::getInstance();
557
            $includeComments->write($module, $table);
558
            $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_post');
559
            // Include Comments File
560
            $includeComments = Modulebuilder\Files\Includes\IncludeComments::getInstance();
561
            $includeComments->write($module, $table);
562
            $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_reply');
563
            // Include Comments File
564
            //$includeComments = Modulebuilder\Files\Includes\IncludeComments::getInstance();
565
            //$includeComments->write($module, $table);
566
            //$ret[] = $includeComments->renderCommentsNew($module, 'comment_new');
567
            // Include Comment Functions File
568
            $includeCommentFunctions = Modulebuilder\Files\Includes\IncludeCommentFunctions::getInstance();
569
            $includeCommentFunctions->write($module, $table, 'comment_functions.php');
570
            $ret[] = $includeCommentFunctions->render();
571
        }
572
573
        if ((1 == $module->getVar('mod_user')) && in_array(1, $tableUser)) {
574
            // Creation of user template files
575
            // Templates Index File
576
            if ($templateType  == 'bootstrap') {
577
                $userTemplatesIndex = Modulebuilder\Files\Templates\User\Bootstrap\Index::getInstance();
0 ignored issues
show
Bug introduced by
The type XoopsModules\Modulebuild...es\User\Bootstrap\Index was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
578
            } else {
579
                $userTemplatesIndex = Modulebuilder\Files\Templates\User\Defstyle\Index::getInstance();
580
            }
581
            $userTemplatesIndex->write($module, $table, $tables, $moduleDirname . '_index.tpl');
582
            $ret[] = $userTemplatesIndex->render();
583
            // Templates Footer File
584
            if ($templateType  == 'bootstrap') {
585
                $userTemplatesFooter = Modulebuilder\Files\Templates\User\Bootstrap\Footer::getInstance();
0 ignored issues
show
Bug introduced by
The type XoopsModules\Modulebuild...s\User\Bootstrap\Footer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
586
            } else {
587
                $userTemplatesFooter = Modulebuilder\Files\Templates\User\Defstyle\Footer::getInstance();
588
            }
589
            $userTemplatesFooter->write($module, $table, $moduleDirname . '_footer.tpl');
590
            $ret[] = $userTemplatesFooter->render();
591
            // Templates Header File
592
            if ($templateType  == 'bootstrap') {
593
                $userTemplatesHeader = Modulebuilder\Files\Templates\User\Bootstrap\Header::getInstance();
0 ignored issues
show
Bug introduced by
The type XoopsModules\Modulebuild...s\User\Bootstrap\Header was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
594
            } else {
595
                $userTemplatesHeader = Modulebuilder\Files\Templates\User\Defstyle\Header::getInstance();
596
            }
597
            $userTemplatesHeader->write($module, $moduleDirname . '_header.tpl');
598
            $ret[] = $userTemplatesHeader->render();
599
600
            // Creation of user files
601
            // User Footer File
602
            $userFooter = Modulebuilder\Files\User\UserFooter::getInstance();
603
            $userFooter->write($module, 'footer.php');
604
            $ret[] = $userFooter->render();
605
            // User Header File
606
            $userHeader = Modulebuilder\Files\User\UserHeader::getInstance();
607
            $userHeader->write($module, $table, $tables, 'header.php');
608
            $ret[] = $userHeader->render();
609
            // User Notification Update File
610
            if ((1 == $module->getVar('mod_notifications')) && in_array(1, $tableNotifications)) {
611
                $userNotificationUpdate = Modulebuilder\Files\User\UserNotificationUpdate::getInstance();
612
                $userNotificationUpdate->write($module, 'notification_update.php');
613
                $ret[] = $userNotificationUpdate->render();
614
            }
615
            // User Pdf File
616
            if (in_array(1, $tablePdf)) {
617
                $userPdf = Modulebuilder\Files\User\UserPdf::getInstance();
618
                $userPdf->write($module, $table, 'pdf.php');
619
                $ret[] = $userPdf->render();
620
                // User Templates Pdf File
621
                if ($templateType  == 'bootstrap') {
622
                    $userTemplatesPdf = Modulebuilder\Files\Templates\User\Bootstrap\Pdf::getInstance();
0 ignored issues
show
Bug introduced by
The type XoopsModules\Modulebuild...ates\User\Bootstrap\Pdf was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
623
                } else {
624
                    $userTemplatesPdf = Modulebuilder\Files\Templates\User\Defstyle\Pdf::getInstance();
625
                }
626
                $userTemplatesPdf->write($module, $moduleDirname . '_pdf.tpl');
627
                $ret[] = $userTemplatesPdf->render();
628
            }
629
            // User Print File
630
            if (in_array(1, $tablePrint)) {
631
                $userPrint = Modulebuilder\Files\User\UserPrint::getInstance();
632
                $userPrint->write($module, $table, 'print.php');
633
                $ret[] = $userPrint->render();
634
                // User Templates Print File
635
                if ($templateType  == 'bootstrap') {
636
                    $userTemplatesPrint = Modulebuilder\Files\Templates\User\Bootstrap\UserPrint::getInstance();
0 ignored issues
show
Bug introduced by
The type XoopsModules\Modulebuild...ser\Bootstrap\UserPrint was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
637
                } else {
638
                    $userTemplatesPrint = Modulebuilder\Files\Templates\User\Defstyle\UserPrint::getInstance();
639
                }
640
                $userTemplatesPrint->write($module, $table, $moduleDirname . '_print.tpl');
641
                $ret[] = $userTemplatesPrint->render();
642
            }
643
644
            //TODO: UserSearch has to be adapted
645
646
            // User Rate File
647
            if (in_array(1, $tableRate)) {
648
                $userRate = Modulebuilder\Files\User\UserRate::getInstance();
649
                $userRate->write($module, $tables, 'rate.php');
650
                $ret[] = $userRate->render();
651
652
                $this->CopyRatingFiles($moduleDirname);
653
            }
654
655
            // User Rss File
656
            if (in_array(1, $tableRss)) {
657
                $userRss = Modulebuilder\Files\User\UserRss::getInstance();
658
                $userRss->write($module, $table, 'rss.php');
659
                $ret[] = $userRss->render();
660
                // User Templates Rss File
661
                if ($templateType  == 'bootstrap') {
662
                    $userTemplatesRss = Modulebuilder\Files\Templates\User\Bootstrap\Rss::getInstance();
0 ignored issues
show
Bug introduced by
The type XoopsModules\Modulebuild...ates\User\Bootstrap\Rss was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
663
                } else {
664
                    $userTemplatesRss = Modulebuilder\Files\Templates\User\Defstyle\Rss::getInstance();
665
                }
666
                $userTemplatesRss->write($module, $moduleDirname . '_rss.tpl');
667
                $ret[] = $userTemplatesRss->render();
668
            }
669
670
            // User Tag Files
671
            if (in_array(1, $tableTag)) {
672
                $userListTag = Modulebuilder\Files\User\UserListTag::getInstance();
673
                $userListTag->write($module, 'list.tag.php');
674
                $ret[]       = $userListTag->render();
675
                $userViewTag = Modulebuilder\Files\User\UserViewTag::getInstance();
676
                $userViewTag->write($module, 'view.tag.php');
677
                $ret[] = $userViewTag->render();
678
            }
679
            // User Index File
680
            $userIndex = Modulebuilder\Files\User\UserIndex::getInstance();
681
            $userIndex->write($module, $table, 'index.php');
682
            $ret[] = $userIndex->render();
683
            // Language Main File
684
            $languageMain = Modulebuilder\Files\Language\LanguageMain::getInstance();
685
            $languageMain->write($module, $tables, 'main.php');
686
            $ret[] = $languageMain->render();
687
            // User Templates Breadcrumbs File
688
            if ($templateType  == 'bootstrap') {
689
                $userTemplatesUserBreadcrumbs = Modulebuilder\Files\Templates\User\Bootstrap\Breadcrumbs::getInstance();
0 ignored issues
show
Bug introduced by
The type XoopsModules\Modulebuild...r\Bootstrap\Breadcrumbs was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
690
            } else {
691
                $userTemplatesUserBreadcrumbs = Modulebuilder\Files\Templates\User\Defstyle\Breadcrumbs::getInstance();
692
            }
693
            $userTemplatesUserBreadcrumbs->write($module, $moduleDirname . '_breadcrumbs.tpl');
694
            $ret[] = $userTemplatesUserBreadcrumbs->render();
695
        }
696
        // Css Admin Styles File
697
        $cssStyles = Modulebuilder\Files\Assets\Css\Admin\CssAdminStyles::getInstance();
698
        $cssStyles->write($module, 'style.css');
699
        $ret[] = $cssStyles->render();
700
        // Css Styles File
701
        $cssStyles = Modulebuilder\Files\Assets\Css\CssStyles::getInstance();
702
        $cssStyles->write($module, 'style.css');
703
        $ret[] = $cssStyles->render();
704
        // Include Jquery File
705
        $JavascriptJQuery = Modulebuilder\Files\Assets\Js\JavascriptJQuery::getInstance();
706
        $JavascriptJQuery->write($module, 'functions.js');
707
        $ret[] = $JavascriptJQuery->render();
708
        // Include Common File
709
        $includeCommon = Modulebuilder\Files\Includes\IncludeCommon::getInstance();
710
        $includeCommon->write($module, $table, 'common.php');
711
        $ret[] = $includeCommon->render();
712
        // Common Config File
713
        $includeConfig = Modulebuilder\Files\Config\ConfigConfig::getInstance();
714
        $includeConfig->write($module, $tables, 'config.php');
715
        $ret[] = $includeConfig->render();
716
        // Docs Changelog File
717
        $docsChangelog = Modulebuilder\Files\Docs\DocsChangelog::getInstance();
718
        $docsChangelog->write($module, 'changelog.txt');
719
        $ret[] = $docsChangelog->render();
720
        // Language Help File
721
        $languageHelp = Modulebuilder\Files\Language\LanguageHelp::getInstance();
722
        $languageHelp->write($module, 'help.html');
723
        $ret[] = $languageHelp->render();
724
        // User Xoops Version File
725
        $userXoopsVersion = Modulebuilder\Files\User\UserXoopsVersion::getInstance();
726
        $userXoopsVersion->write($module, $table, $tables, 'xoops_version.php');
727
        $ret[] = $userXoopsVersion->render();
728
729
        // Return Array
730
        return $ret;
731
    }
732
733
    /**
734
     * @public function setCommonFiles
735
     *
736
     * @param $module
737
     */
738
    public function setCommonFiles($module)
739
    {
740
741
        $moduleName = $module->getVar('mod_dirname');
742
        $upl_path   = TDMC_UPLOAD_REPOSITORY_PATH . '/' . mb_strtolower($moduleName);
743
744
        $patterns = [
745
            mb_strtolower('modulebuilder')          => mb_strtolower($moduleName),
746
            mb_strtoupper('modulebuilder')          => mb_strtoupper($moduleName),
747
            ucfirst(mb_strtolower('modulebuilder')) => ucfirst(mb_strtolower($moduleName)),
748
        ];
749
750
        $patKeys   = array_keys($patterns);
751
        $patValues = array_values($patterns);
752
753
        /* clone complete missing folders */
754
        $cloneFolders[] = [
0 ignored issues
show
Comprehensibility Best Practice introduced by
$cloneFolders was never initialized. Although not strictly required by PHP, it is generally a good practice to add $cloneFolders = array(); before regardless.
Loading history...
755
            'src'   => TDMC_PATH . '/files/commonfiles',
756
            'dst'   => $upl_path,
757
            'rcode' => true
758
        ];
759
        foreach ($cloneFolders as $folder) {
760
            Modulebuilder\Files\CreateClone::cloneFileFolder($folder['src'], $folder['dst'], $folder['rcode'], $patKeys, $patValues);
761
        }
762
        unset($cloneFolders);
763
764
        /* create missing folders for common files */
765
        $createFolders[] = $upl_path . '/testdata/' . $GLOBALS['xoopsConfig']['language'];
0 ignored issues
show
Comprehensibility Best Practice introduced by
$createFolders was never initialized. Although not strictly required by PHP, it is generally a good practice to add $createFolders = array(); before regardless.
Loading history...
766
        if ('english' !== $GLOBALS['xoopsConfig']['language']) {
767
            $createFolders[] = $upl_path . '/testdata/english';
768
            $createFolders[] = $upl_path . '/language/english';
769
        }
770
        foreach ($createFolders as $folder) {
771
            @mkdir($folder);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition for mkdir(). This can introduce security issues, and is generally not recommended. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unhandled  annotation

771
            /** @scrutinizer ignore-unhandled */ @mkdir($folder);

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
772
        }
773
        unset($createFolders);
774
775
        if ('english' !== $GLOBALS['xoopsConfig']['language']) {
776
            $cloneFolders[] = [
777
                'src'   => TDMC_PATH . '/files/commonfiles/language/english',
778
                'dst'   => $upl_path . '/language/' . $GLOBALS['xoopsConfig']['language'],
779
                'rcode' => true
780
            ];
781
            //copy back all language files to english language folder
782
            $cloneFolders[] = [
783
                'src'   => $upl_path . '/language/' . $GLOBALS['xoopsConfig']['language'],
784
                'dst'   => $upl_path . '/language/english',
785
                'rcode' => false
786
            ];
787
            foreach ($cloneFolders as $folder) {
788
                Modulebuilder\Files\CreateClone::cloneFileFolder($folder['src'], $folder['dst'], $folder['rcode'], $patKeys, $patValues);
789
            }
790
            unset($cloneFolders);
791
        }
792
793
        /* clone single missing files*/
794
        $cloneFiles[] = [
0 ignored issues
show
Comprehensibility Best Practice introduced by
$cloneFiles was never initialized. Although not strictly required by PHP, it is generally a good practice to add $cloneFiles = array(); before regardless.
Loading history...
795
            'src'   => TDMC_PATH . '/config/',
796
            'dst'   => $upl_path . '/config/',
797
            'file'  => 'admin.yml',
798
            'rcode' => true
799
        ];
800
        $cloneFiles[] = [
801
            'src'   => TDMC_PATH . '/config/',
802
            'dst'   => $upl_path . '/config/',
803
            'file'  => 'icons.php',
804
            'rcode' => true
805
        ];
806
        $cloneFiles[] = [
807
            'src'   => TDMC_PATH . '/config/',
808
            'dst'   => $upl_path . '/config/',
809
            'file'  => 'paths.php',
810
            'rcode' => true
811
        ];
812
        foreach ($cloneFiles as $file) {
813
            Modulebuilder\Files\CreateClone::cloneFile($file['src'] . $file['file'], $file['dst'] . $file['file'], $file['rcode'], $patKeys, $patValues);
814
        }
815
        unset($cloneFiles);
816
    }
817
818
    /**
819
     * @private function CopyRatingFiles
820
     *
821
     * @param $moduleName
822
     */
823
    private function CopyRatingFiles($moduleName)
824
    {
825
        $upl_path   = TDMC_UPLOAD_REPOSITORY_PATH . '/' . mb_strtolower($moduleName);
826
827
        $patterns = [
828
            mb_strtolower('modulebuilder')          => mb_strtolower($moduleName),
829
            mb_strtoupper('modulebuilder')          => mb_strtoupper($moduleName),
830
            ucfirst(mb_strtolower('modulebuilder')) => ucfirst(mb_strtolower($moduleName)),
831
        ];
832
833
        $patKeys   = array_keys($patterns);
834
        $patValues = array_values($patterns);
835
836
        /* clone complete missing folders */
837
        $cloneFolders[] = [
0 ignored issues
show
Comprehensibility Best Practice introduced by
$cloneFolders was never initialized. Although not strictly required by PHP, it is generally a good practice to add $cloneFolders = array(); before regardless.
Loading history...
838
            'src'   => TDMC_PATH . '/files/ratingfiles',
839
            'dst'   => $upl_path,
840
            'rcode' => true
841
        ];
842
        foreach ($cloneFolders as $folder) {
843
            Modulebuilder\Files\CreateClone::cloneFileFolder($folder['src'], $folder['dst'], $folder['rcode'], $patKeys, $patValues);
844
        }
845
        unset($cloneFolders);
846
    }
847
}
848