Code Duplication    Length = 5-5 lines in 16 locations

src/Eccube/Command/PluginCommand/EntityFromDbGenerator.php 1 location

@@ 97-101 (lines=5) @@
94
            foreach ($entityInfo as $path => $body) {
95
                $fullPath = $this->app['config']['root_dir'] . '/app/Plugin/' . $pluginCode . $path;
96
                file_put_contents($fullPath, $body);
97
                if (is_file($fullPath)) {
98
                    $fsList['file'][$fullPath] = true;
99
                } else {
100
                    $fsList['file'][$fullPath] = false;
101
                }
102
            }
103
        }
104
        $dirFileNg = array();

src/Eccube/Command/PluginCommand/EntityFromYamlGenerator.php 3 locations

@@ 101-105 (lines=5) @@
98
            $pathClass = $this->app['config']['root_dir'] . '/app/';
99
            $EntityGenerator->generate(array($MetadataInfo), $pathClass);
100
            $pathClass .= str_replace('\\', DIRECTORY_SEPARATOR, $MetadataInfo->name) . '.php';
101
            if (is_file($pathClass)) {
102
                $fsList['file'][$pathClass] = true;
103
            } else {
104
                $fsList['file'][$pathClass] = false;
105
            }
106
107
            //Repository作成
108
            $filename = $this->makeRepository($pluginCode, $MetadataInfo);
@@ 109-113 (lines=5) @@
106
107
            //Repository作成
108
            $filename = $this->makeRepository($pluginCode, $MetadataInfo);
109
            if (is_file($filename)) {
110
                $fsList['file'][$filename] = true;
111
            } else {
112
                $fsList['file'][$filename] = false;
113
            }
114
        }
115
116
        //Migration作成
@@ 124-128 (lines=5) @@
121
            $migPath = $codePath . '/Resource/doctrine/migration/Version' . $timeSt . '.php';
122
123
            file_put_contents($migPath, $migrationContent);
124
            if (is_file($migPath)) {
125
                $fsList['file'][$migPath] = true;
126
            } else {
127
                $fsList['file'][$migPath] = false;
128
            }
129
        }
130
131
        $dirFileNg = array();

src/Eccube/Command/PluginCommand/PluginGenerator.php 12 locations

@@ 233-237 (lines=5) @@
230
231
        $srcPath = $codePath . '/config.yml';
232
        file_put_contents($srcPath, Yaml::dump($config));
233
        if (is_file($srcPath)) {
234
            $fsList['file'][$srcPath] = true;
235
        } else {
236
            $fsList['file'][$srcPath] = false;
237
        }
238
239
        $author = $paramList['pluginName']['value'];
240
        $year = date('Y');
@@ 253-257 (lines=5) @@
250
251
        $srcPath = $codePath . '/PluginManager.php';
252
        file_put_contents($srcPath, $pluginFileAfter);
253
        if (is_file($srcPath)) {
254
            $fsList['file'][$srcPath] = true;
255
        } else {
256
            $fsList['file'][$srcPath] = false;
257
        }
258
259
        // ServiceProvider
260
        $pluginFileBefore = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/ServiceProvider.php');
@@ 277-281 (lines=5) @@
274
275
        $srcPath = $codePath . '/ServiceProvider/' . $code . 'ServiceProvider.php';
276
        file_put_contents($srcPath, $pluginFileAfter);
277
        if (is_file($srcPath)) {
278
            $fsList['file'][$srcPath] = true;
279
        } else {
280
            $fsList['file'][$srcPath] = false;
281
        }
282
283
        // ConfigController
284
        $pluginFileBefore = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/ConfigController.php');
@@ 303-307 (lines=5) @@
300
301
        $srcPath = $codePath . '/Controller/ConfigController.php';
302
        file_put_contents($srcPath, $pluginFileAfter);
303
        if (is_file($srcPath)) {
304
            $fsList['file'][$srcPath] = true;
305
        } else {
306
            $fsList['file'][$srcPath] = false;
307
        }
308
309
        // Controller
310
        $pluginFileBefore = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/Controller.php');
@@ 322-326 (lines=5) @@
319
320
        $srcPath = $codePath . '/Controller/' . $code . 'Controller.php';
321
        file_put_contents($srcPath, $pluginFileAfter);
322
        if (is_file($srcPath)) {
323
            $fsList['file'][$srcPath] = true;
324
        } else {
325
            $fsList['file'][$srcPath] = false;
326
        }
327
328
        // Form
329
        $pluginFileBefore = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/ConfigType.php');
@@ 348-352 (lines=5) @@
345
346
        $srcPath = $codePath . '/Form/Type/' . $code . 'ConfigType.php';
347
        file_put_contents($codePath . '/Form/Type/' . $code . 'ConfigType.php', $pluginFileAfter);
348
        if (is_file($srcPath)) {
349
            $fsList['file'][$srcPath] = true;
350
        } else {
351
            $fsList['file'][$srcPath] = false;
352
        }
353
354
        // Twig
355
        $pluginFileBefore = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/config.twig');
@@ 368-372 (lines=5) @@
365
366
        $srcPath = $codePath . '/Resource/template/admin/config.twig';
367
        file_put_contents($srcPath, $pluginFileAfter);
368
        if (is_file($srcPath)) {
369
            $fsList['file'][$srcPath] = true;
370
        } else {
371
            $fsList['file'][$srcPath] = false;
372
        }
373
374
        // index.twig
375
        $pluginFileBefore = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/index.twig');
@@ 388-392 (lines=5) @@
385
386
        $srcPath = $codePath . '/Resource/template/index.twig';
387
        file_put_contents($srcPath, $pluginFileAfter);
388
        if (is_file($srcPath)) {
389
            $fsList['file'][$srcPath] = true;
390
        } else {
391
            $fsList['file'][$srcPath] = false;
392
        }
393
394
        $onFunctions = array();
395
        $onEvents = array();
@@ 419-423 (lines=5) @@
416
        if (count($onEvents)) {
417
            $srcPath = $codePath . '/event.yml';
418
            file_put_contents($srcPath, str_replace('\'', '', Yaml::dump($onEvents)));
419
            if (is_file($srcPath)) {
420
                $fsList['file'][$srcPath] = true;
421
            } else {
422
                $fsList['file'][$srcPath] = false;
423
            }
424
425
            $pluginFileBefore = file_get_contents($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/EventHookpoint2.php');
426
@@ 443-447 (lines=5) @@
440
            $pluginFileAfter = preg_replace($from, $functions, $pluginFileAfter);
441
            $srcPath = $codePath . '/' . $code . 'Event.php';
442
            file_put_contents($srcPath, $pluginFileAfter);
443
            if (is_file($srcPath)) {
444
                $fsList['file'][$srcPath] = true;
445
            } else {
446
                $fsList['file'][$srcPath] = false;
447
            }
448
        }
449
450
        // config.ymlを再作成
@@ 459-463 (lines=5) @@
456
        $config['service'] = array($code . 'ServiceProvider');
457
        $srcPath = $codePath . '/config.yml';
458
        file_put_contents($srcPath, Yaml::dump($config));
459
        if (is_file($srcPath)) {
460
            $fsList['file'][$srcPath] = true;
461
        } else {
462
            $fsList['file'][$srcPath] = false;
463
        }
464
465
        // LICENSE
466
        $srcPath = $codePath . '/LICENSE';
@@ 468-472 (lines=5) @@
465
        // LICENSE
466
        $srcPath = $codePath . '/LICENSE';
467
        $file->copy($this->app['config']['root_dir'] . '/src/Eccube/Command/PluginCommand/Resource/LICENSE', $srcPath);
468
        if (is_file($srcPath)) {
469
            $fsList['file'][$srcPath] = true;
470
        } else {
471
            $fsList['file'][$srcPath] = false;
472
        }
473
474
        $dirFileNg = array();
475
        $dirFileOk = array();