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.
Passed
Push — master ( 18e39d...348781 )
by Toby
36:48 queued 23:00
created

ExportControlCommand::exportData()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 18
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 5.0187

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 18
ccs 10
cts 11
cp 0.9091
rs 9.4222
cc 5
nc 5
nop 0
crap 5.0187
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace BristolSU\ControlDB\Export;
4
5
use BristolSU\ControlDB\Contracts\Repositories\Group;
6
use BristolSU\ControlDB\Contracts\Repositories\Position;
7
use BristolSU\ControlDB\Contracts\Repositories\Role;
8
use BristolSU\ControlDB\Contracts\Repositories\User;
9
use BristolSU\ControlDB\Export\Formatter\Role\SortByGroupName;
0 ignored issues
show
Bug introduced by
The type BristolSU\ControlDB\Expo...er\Role\SortByGroupName was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use BristolSU\ControlDB\Export\Formatter\Shared\SortByColumn;
11
use Illuminate\Console\Command;
12
use Symfony\Component\Console\Exception\InvalidArgumentException;
13
14
/**
15
 * Seed the database
16
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
17
class ExportControlCommand extends Command
18
{
19
    /**
20
     * Signature for the command
21
     * 
22
     * @var string 
23
     */
24
    protected $signature = 'control:export
25
                            {type : The type of resource to export}
26
                            {--exporter= : The name of the exporter to use}';
27
28
    /**
29
     * Name for the commmand
30
     * 
31
     * @var string 
32
     */
33
    protected $name = 'Export Control';
34
35
    /**
36
     * Description of the command
37
     * 
38
     * @var string 
39
     */
40
    protected $description = 'Export control to an external service';
41
42
    /**
43
     * Handle the command execution
44
     * 
45
     * Seed the database with fake data.
46
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
47 5
    public function handle()
48
    {
49 5
        Exporter::driver($this->option('exporter'))->export($this->exportData());
0 ignored issues
show
Bug introduced by
The method driver() does not exist on BristolSU\ControlDB\Export\Exporter. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
        Exporter::/** @scrutinizer ignore-call */ 
50
                  driver($this->option('exporter'))->export($this->exportData());
Loading history...
50 5
        $this->info('Export complete');
51 5
    }
52
53 5
    private function exportData()
0 ignored issues
show
Coding Style introduced by
Private method name "ExportControlCommand::exportData" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Missing doc comment for function exportData()
Loading history...
54
    {
55 5
        switch($this->argument('type')) {
56 5
            case 'user': 
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 8 spaces, found 12
Loading history...
57 2
                return app(User::class)->all();
58
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
59 3
            case 'group':
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 8 spaces, found 12
Loading history...
60 1
                return app(Group::class)->all();
61
                break;
62 2
            case 'role':
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 8 spaces, found 12
Loading history...
63 1
                return app(Role::class)->all();
64
                break;
65 1
            case 'position':
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 8 spaces, found 12
Loading history...
66 1
                return app(Position::class)->all();
67
                break;
68
            default:
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected 8 spaces, found 12
Loading history...
69
                throw new InvalidArgumentException(sprintf('The type option %s is not allowed.', $this->argument('type')));
0 ignored issues
show
Bug introduced by
It seems like $this->argument('type') can also be of type string[]; however, parameter $args of sprintf() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

69
                throw new InvalidArgumentException(sprintf('The type option %s is not allowed.', /** @scrutinizer ignore-type */ $this->argument('type')));
Loading history...
70
                break;
71
        }
72
    }
73
}