Completed
Pull Request — master (#193)
by Ryan
17:05 queued 09:54
created

LoadApplicationInstallers   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 42
loc 42
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A handle() 18 18 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 namespace Anomaly\Streams\Platform\Installer\Console\Command;
2
3
use Anomaly\Streams\Platform\Installer\Installer;
4
use Anomaly\Streams\Platform\Installer\InstallerCollection;
5
use App\Console\Kernel;
6
use Illuminate\Contracts\Bus\SelfHandling;
7
8
/**
9
 * Class LoadApplicationInstallers
10
 *
11
 * @link          http://anomaly.is/streams-platform
12
 * @author        AnomalyLabs, Inc. <[email protected]>
13
 * @author        Ryan Thompson <[email protected]>
14
 * @package       Anomaly\Streams\Platform\Installer\Console\Command
15
 */
16 View Code Duplication
class LoadApplicationInstallers implements SelfHandling
0 ignored issues
show
Duplication introduced by
This class 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...
17
{
18
19
    /**
20
     * The installer collection.
21
     *
22
     * @var InstallerCollection
23
     */
24
    protected $installers;
25
26
    /**
27
     * Create a new LoadApplicationInstallers instance.
28
     *
29
     * @param InstallerCollection $installers
30
     */
31
    public function __construct(InstallerCollection $installers)
32
    {
33
        $this->installers = $installers;
34
    }
35
36
    /**
37
     * Handle the command.
38
     */
39
    public function handle()
40
    {
41
        $this->installers->add(
42
            new Installer(
43
                'streams::installer.running_application_migrations',
44
                function (Kernel $console) {
45
                    $console->call(
46
                        'migrate',
47
                        [
48
                            '--force'     => true,
49
                            '--no-addons' => true,
50
                            '--path'      => 'vendor/anomaly/streams-platform/migrations/application'
51
                        ]
52
                    );
53
                }
54
            )
55
        );
56
    }
57
}
58