CheckBladeQueries::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 15
loc 15
rs 9.7666
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\CheckIsQuery;
8
use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter;
9
use Imanghafoori\LaravelMicroscope\Traits\LogsErrors;
10
11 View Code Duplication
class CheckBladeQueries 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:blade_queries {--d|detailed : Show files being checked}';
16
17
    protected $description = 'Checks db queries in blade files';
18
19
    public function handle(ErrorPrinter $errorPrinter)
20
    {
21
        event('microscope.start.command');
22
        $this->info('Checking blade files for db queries...');
23
24
        $errorPrinter->printer = $this->output;
25
26
        // checks the blade files for database queries.
27
        BladeFiles::check([CheckIsQuery::class]);
28
29
        $this->finishCommand($errorPrinter);
30
        $errorPrinter->printTime();
31
32
        return $errorPrinter->hasErrors() ? 1 : 0;
33
    }
34
}
35