SelectServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 23
ccs 0
cts 7
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 18 2
1
<?php
0 ignored issues
show
Coding Style introduced by
This file is missing a doc comment.
Loading history...
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Coding Style introduced by
Filename "SelectServiceProvider.php" doesn't match the expected filename "selectserviceprovider.php"
Loading history...
2
namespace EddIriarte\Console\Providers;
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
use EddIriarte\Console\Helpers\SelectionHelper;
5
use EddIriarte\Console\Inputs\CheckboxInput;
6
use EddIriarte\Console\Inputs\RadioInput;
7
use Illuminate\Console\Command;
0 ignored issues
show
Bug introduced by
The type Illuminate\Console\Command 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...
8
use Illuminate\Support\ServiceProvider;
9
10
/**
11
 * Class ConsoleSelectServiceProvider
12
 *
13
 * @package EddIriarte\Console\Providers
0 ignored issues
show
Coding Style Documentation introduced by
@package tag is not allowed in class comment
Loading history...
14
 * @author Eduardo Iriarte <eddiriarte[at]gmail[dot]com>
0 ignored issues
show
Coding Style Documentation introduced by
@author tag is not allowed in class comment
Loading history...
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
15
 */
0 ignored issues
show
Coding Style introduced by
Missing @category 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...
16
class SelectServiceProvider extends ServiceProvider
17
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class SelectServiceProvider
Loading history...
18
    /**
19
     * {@inheritdoc}
20
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
21
    public function boot()
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
22
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
23
        /*
24
         * Returns a select builder.
0 ignored issues
show
Coding Style introduced by
First line of comment not aligned correctly; expected 12 spaces but found 9
Loading history...
25
         *
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 12 spaces but found 9
Loading history...
26
         * @param  string $message
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 12 spaces but found 9
Loading history...
27
         * @param  array $options
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 12 spaces but found 9
Loading history...
28
         * @param  bool $allowMultiple
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 12 spaces but found 9
Loading history...
29
         *
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 12 spaces but found 9
Loading history...
30
         * @return array
0 ignored issues
show
Coding Style introduced by
Comment line indented incorrectly; expected at least 12 spaces but found 9
Loading history...
31
         */
0 ignored issues
show
Coding Style introduced by
Last line of comment aligned incorrectly; expected 8 spaces but found 9
Loading history...
Coding Style introduced by
Empty line required after block comment
Loading history...
32
        Command::macro(
33
            'select',
34
            function (string $message = '', array $options = [], bool $allowMultiple = true) {
0 ignored issues
show
Coding Style introduced by
Short array syntax is not allowed
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of true please use TRUE.
Loading history...
35
                $helper = new SelectionHelper($this->input, $this->output);
0 ignored issues
show
Bug Best Practice introduced by
The property output does not exist on EddIriarte\Console\Providers\SelectServiceProvider. Did you maybe forget to declare it?
Loading history...
Bug Best Practice introduced by
The property input does not exist on EddIriarte\Console\Providers\SelectServiceProvider. Did you maybe forget to declare it?
Loading history...
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
36
                $question = $allowMultiple ? new CheckboxInput($message, $options) : new RadioInput($message, $options);
0 ignored issues
show
Coding Style introduced by
The value of a comparison must not be assigned to a variable
Loading history...
Coding Style introduced by
Inline IF statements are not allowed
Loading history...
Coding Style introduced by
Inline shorthand IF statement requires brackets around comparison
Loading history...
37
38
                return $helper->select($question);
39
            }
40
        );
41
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end boot()
Loading history...
42
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
43