SetAutoIncrement::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Sausin\DBSetAutoIncrement\Listeners;
4
5
use Illuminate\Contracts\Queue\ShouldQueue;
6
use Illuminate\Database\Events\MigrationsEnded;
7
use Illuminate\Support\Facades\Artisan;
8
use Illuminate\Support\Facades\Config;
9
10
class SetAutoIncrement
11
{
12
    /** @var string */
13
    public $action;
14
15
    /**
16
     * Create the event listener.
17
     *
18
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
19
     */
20
    public function __construct()
21
    {
22
        $this->action = Config::get('auto-increment.action', 'auto');
23
    }
24
25
    /**
26
     * Handle the event.
27
     *
28
     * @param  MigrationsEnded  $event
29
     * @return void
30
     */
31
    public function handle(MigrationsEnded $event)
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
32
    {
33
        if ($this->action !== 'auto') {
34
            return;
35
        }
36
37
        Artisan::call('db:set-auto-increment');
38
    }
39
}
40