GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( f91a4c...f91a4c )
by Dave
39:26 queued 34:22
created

SectionProvider::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 11
loc 11
ccs 0
cts 0
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
crap 6
1
<?php
2
3
namespace SleepingOwl\Admin\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Config\Repository;
7
use SleepingOwl\Admin\Console\Installation\CreateSectionServiceProvider;
8
9
class SectionProvider extends Command
10
{
11
    /**
12
     * The console command name.
13
     *
14
     * @var string
15
     */
16
    protected $name = 'sleepingowl:section:provider';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Create [AdminSectionsServiceProvider] class';
24
25
    /**
26
     * @param Repository $files
27
     */
28 View Code Duplication
    public function fire(Repository $files)
0 ignored issues
show
Duplication introduced by
This method 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...
29
    {
30
        $installer = new CreateSectionServiceProvider($this, $files);
0 ignored issues
show
Documentation introduced by
$this is of type this<SleepingOwl\Admin\C...mmands\SectionProvider>, but the function expects a object<SleepingOwl\Admin...ommands\InstallCommand>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
31
        if ($installer->installed()) {
32
            $this->line('File <info>AdminSectionsServiceProvider</info> exists');
33
34
            return;
35
        }
36
37
        $installer->install();
38
    }
39
40
    /**
41
     * @param Repository $files
42
     */
43 View Code Duplication
    public function handle(Repository $files)
0 ignored issues
show
Duplication introduced by
This method 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...
44
    {
45
        $installer = new CreateSectionServiceProvider($this, $files);
0 ignored issues
show
Documentation introduced by
$this is of type this<SleepingOwl\Admin\C...mmands\SectionProvider>, but the function expects a object<SleepingOwl\Admin...ommands\InstallCommand>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
46
        if ($installer->installed()) {
47
            $this->line('File <info>AdminSectionsServiceProvider</info> exists');
48
49
            return;
50
        }
51
52
        $installer->install();
53
    }
54
}
55