SetAutoIncrement   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 8 2
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