Code Duplication    Length = 5-5 lines in 14 locations

src/Eccube/Command/GeneratorCommand/AbstractPluginGenerator.php 3 locations

@@ 324-328 (lines=5) @@
321
            $EntityGenerator->generate(array($class), $appPath);
322
323
            $filename = $appPath.str_replace('\\', DIRECTORY_SEPARATOR, $class->name).'.php';
324
            if (is_file($filename)) {
325
                $fsList['file'][$filename] = true;
326
            } else {
327
                $fsList['file'][$filename] = false;
328
            }
329
330
            // Repository作成
331
            $RepositoryGenerator = new EntityRepositoryGenerator();
@@ 335-339 (lines=5) @@
332
            $RepositoryGenerator->writeEntityRepositoryClass($class->customRepositoryClassName, $appPath);
333
334
            $filename = $appPath.str_replace('\\', DIRECTORY_SEPARATOR, $class->customRepositoryClassName).'.php';
335
            if (is_file($filename)) {
336
                $fsList['file'][$filename] = true;
337
            } else {
338
                $fsList['file'][$filename] = false;
339
            }
340
        }
341
342
    }
@@ 362-366 (lines=5) @@
359
            $migPath = $codePath.'/Resource/doctrine/migration/Version'.$date.'.php';
360
361
            file_put_contents($migPath, $migrationContent);
362
            if (is_file($migPath)) {
363
                $fsList['file'][$migPath] = true;
364
            } else {
365
                $fsList['file'][$migPath] = false;
366
            }
367
        }
368
    }
369

src/Eccube/Command/GeneratorCommand/PluginGenerator.php 11 locations

@@ 260-264 (lines=5) @@
257
258
        $srcPath = $codePath.'/config.yml';
259
        file_put_contents($srcPath, Yaml::dump($config));
260
        if (is_file($srcPath)) {
261
            $fsList['file'][$srcPath] = true;
262
        } else {
263
            $fsList['file'][$srcPath] = false;
264
        }
265
266
        $author = $paramList['author']['value'];
267
        $year = date('Y');
@@ 280-284 (lines=5) @@
277
278
        $srcPath = $codePath.'/PluginManager.php';
279
        file_put_contents($srcPath, $pluginFileAfter);
280
        if (is_file($srcPath)) {
281
            $fsList['file'][$srcPath] = true;
282
        } else {
283
            $fsList['file'][$srcPath] = false;
284
        }
285
286
        // ServiceProvider
287
        $pluginFileBefore = file_get_contents($this->app['config']['root_dir'].'/src/Eccube/Command/GeneratorCommand/generatortemplate/ServiceProvider.php');
@@ 306-310 (lines=5) @@
303
304
        $srcPath = $codePath.'/ServiceProvider/'.$code.'ServiceProvider.php';
305
        file_put_contents($srcPath, $pluginFileAfter);
306
        if (is_file($srcPath)) {
307
            $fsList['file'][$srcPath] = true;
308
        } else {
309
            $fsList['file'][$srcPath] = false;
310
        }
311
312
        // ConfigController
313
        $pluginFileBefore = file_get_contents($this->app['config']['root_dir'].'/src/Eccube/Command/GeneratorCommand/generatortemplate/ConfigController.php');
@@ 332-336 (lines=5) @@
329
330
        $srcPath = $codePath.'/Controller/ConfigController.php';
331
        file_put_contents($srcPath, $pluginFileAfter);
332
        if (is_file($srcPath)) {
333
            $fsList['file'][$srcPath] = true;
334
        } else {
335
            $fsList['file'][$srcPath] = false;
336
        }
337
338
        // Controller
339
        $pluginFileBefore = file_get_contents($this->app['config']['root_dir'].'/src/Eccube/Command/GeneratorCommand/generatortemplate/Controller.php');
@@ 351-355 (lines=5) @@
348
349
        $srcPath = $codePath.'/Controller/'.$code.'Controller.php';
350
        file_put_contents($srcPath, $pluginFileAfter);
351
        if (is_file($srcPath)) {
352
            $fsList['file'][$srcPath] = true;
353
        } else {
354
            $fsList['file'][$srcPath] = false;
355
        }
356
357
        // Form
358
        $pluginFileBefore = file_get_contents($this->app['config']['root_dir'].'/src/Eccube/Command/GeneratorCommand/generatortemplate/ConfigType.php');
@@ 377-381 (lines=5) @@
374
375
        $srcPath = $codePath.'/Form/Type/'.$code.'ConfigType.php';
376
        file_put_contents($codePath.'/Form/Type/'.$code.'ConfigType.php', $pluginFileAfter);
377
        if (is_file($srcPath)) {
378
            $fsList['file'][$srcPath] = true;
379
        } else {
380
            $fsList['file'][$srcPath] = false;
381
        }
382
383
        // Twig
384
        $pluginFileBefore = file_get_contents($this->app['config']['root_dir'].'/src/Eccube/Command/GeneratorCommand/generatortemplate/config.twig');
@@ 397-401 (lines=5) @@
394
395
        $srcPath = $codePath.'/Resource/template/admin/config.twig';
396
        file_put_contents($srcPath, $pluginFileAfter);
397
        if (is_file($srcPath)) {
398
            $fsList['file'][$srcPath] = true;
399
        } else {
400
            $fsList['file'][$srcPath] = false;
401
        }
402
403
        // index.twig
404
        $pluginFileBefore = file_get_contents($this->app['config']['root_dir'].'/src/Eccube/Command/GeneratorCommand/generatortemplate/index.twig');
@@ 417-421 (lines=5) @@
414
415
        $srcPath = $codePath.'/Resource/template/index.twig';
416
        file_put_contents($srcPath, $pluginFileAfter);
417
        if (is_file($srcPath)) {
418
            $fsList['file'][$srcPath] = true;
419
        } else {
420
            $fsList['file'][$srcPath] = false;
421
        }
422
423
        $onFunctions = array();
424
        $eventKeys = array();
@@ 450-454 (lines=5) @@
447
        if (count($onEvents)) {
448
            $srcPath = $codePath.'/event.yml';
449
            file_put_contents($srcPath, str_replace('\'', '', Yaml::dump($onEvents)));
450
            if (is_file($srcPath)) {
451
                $fsList['file'][$srcPath] = true;
452
            } else {
453
                $fsList['file'][$srcPath] = false;
454
            }
455
456
            $pluginFileBefore = file_get_contents($this->app['config']['root_dir'].'/src/Eccube/Command/GeneratorCommand/generatortemplate/Event.php');
457
@@ 491-495 (lines=5) @@
488
            $pluginFileAfter = preg_replace($from, $functions, $pluginFileAfter);
489
            $srcPath = $codePath.'/'.$code.'Event.php';
490
            file_put_contents($srcPath, $pluginFileAfter);
491
            if (is_file($srcPath)) {
492
                $fsList['file'][$srcPath] = true;
493
            } else {
494
                $fsList['file'][$srcPath] = false;
495
            }
496
        }
497
498
        // LICENSE
@@ 501-505 (lines=5) @@
498
        // LICENSE
499
        $srcPath = $codePath.'/LICENSE';
500
        $file->copy($this->app['config']['root_dir'].'/src/Eccube/Command/GeneratorCommand/generatortemplate/LICENSE', $srcPath);
501
        if (is_file($srcPath)) {
502
            $fsList['file'][$srcPath] = true;
503
        } else {
504
            $fsList['file'][$srcPath] = false;
505
        }
506
507
        $this->completeMessage($fsList);
508