CheckExtractBladeIncludes::startWarning()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 7
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Imanghafoori\LaravelMicroscope\Commands;
4
5
use Illuminate\Console\Command;
6
use Imanghafoori\LaravelMicroscope\BladeFiles;
7
use Imanghafoori\LaravelMicroscope\Checks\ExtractBladePartial;
8
use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter;
9
use Imanghafoori\LaravelMicroscope\Traits\LogsErrors;
10
11 View Code Duplication
class CheckExtractBladeIncludes extends Command
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...
12
{
13
    use LogsErrors;
14
15
    protected $signature = 'check:extract_blades';
16
17
    protected $description = 'Checks to extract blade partials';
18
19
    public function handle(ErrorPrinter $errorPrinter)
20
    {
21
        if (! $this->startWarning()) {
22
            return;
23
        }
24
25
        event('microscope.start.command');
26
27
        $errorPrinter->printer = $this->output;
28
29
        BladeFiles::check([ExtractBladePartial::class]);
30
31
        $this->info('Blade files extracted.');
32
    }
33
34
    private function startWarning()
35
    {
36
        $this->info('Checking to extract blade partials...');
37
        $this->warn('This command is going to make changes to your files!');
38
39
        return $this->output->confirm('Do you have committed everything in git?', true);
40
    }
41
}
42