Optimize   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 1
cbo 2
dl 46
loc 46
ccs 10
cts 10
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A prompt() 4 4 1
A prepare() 4 4 1
A preview() 6 6 1
A finish() 4 4 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 Lanin\Laravel\SetupWizard\Commands\Steps;
2
3 View Code Duplication
class Optimize extends AbstractStep
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...
4
{
5
    /**
6
     * Return command prompt text.
7
     *
8
     * @return string
9
     */
10 2
    public function prompt()
11
    {
12 2
        return 'Do you want to optimize code?';
13
    }
14
15
    /**
16
     * Prepare step data.
17
     *
18
     * @return mixed
19
     */
20 2
    public function prepare()
21
    {
22 2
        return null;
23
    }
24
25
    /**
26
     * Preview results.
27
     *
28
     * @param  mixed $results
29
     * @return void
30
     */
31 2
    public function preview($results)
32
    {
33 2
        $this->command->info(
34
            'This command will be executed: <comment>php artisan optimize --force --no-interaction</comment>'
35 2
        );
36 2
    }
37
38
    /**
39
     * Finish step.
40
     *
41
     * @param  mixed $results
42
     * @return bool
43
     */
44 2
    public function finish($results)
45
    {
46 2
        return ! (bool) \Artisan::call('optimize', ['--force' => true, '--no-interaction' => true]);
47
    }
48
}