Completed
Push — master ( e68441...354a44 )
by Vincenzo
02:20
created

CreateSeederCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 50 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 16
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getHead() 0 9 1
A getStub() 16 16 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
4
namespace App\Lib\Slime\Console\Commands;
5
6
7
class CreateSeederCommand extends CreateMigrationCommand
8
{
9
    protected $prefix = 'S'; //stands for seeder
10
    protected $filePath = 'database/seeds/';
11
12
    protected function getHead()
13
    {
14
        $fileHead = '<?php'
15
            . PHP_EOL
16
            . PHP_EOL
17
            . 'use App\Lib\Slime\Interfaces\DatabaseHelpers\DbHelperInterface;'
18
            . PHP_EOL;
19
        return $fileHead;
20
    }
21
22 View Code Duplication
    protected function getStub()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
    {
24
        return PHP_EOL . 'class ' .
25
        $this->getIncrementalFileName() .
26
        ' implements DbHelperInterface {'
27
        . PHP_EOL
28
        . '
29
        public function run()
30
        {
31
        $faker = Faker\Factory::create();
32
        
33
        }
34
        '
35
        . PHP_EOL
36
        . '}';
37
    }
38
}