CheckboxInput::select()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 10
cc 3
nc 3
nop 1
crap 3
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 "CheckboxInput.php" doesn't match the expected filename "checkboxinput.php"
Loading history...
2
namespace EddIriarte\Console\Inputs;
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
use EddIriarte\Console\Inputs\AbstractSelect;
5
use EddIriarte\Console\Inputs\Exceptions\UnknownOption;
6
7
/**
8
 * Class CheckboxInput
9
 * @package EddIriarte\Console\Inputs
0 ignored issues
show
Coding Style Documentation introduced by
@package tag is not allowed in class comment
Loading history...
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
10
 * @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...
11
 */
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...
12
class CheckboxInput extends AbstractSelect
13
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class CheckboxInput
Loading history...
14
    /**
0 ignored issues
show
Coding Style introduced by
Parameter $option should have a doc-comment as per coding-style.
Loading history...
15
     * {@inheritdoc}
16
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
Coding Style Documentation introduced by
Missing @throws tag in function comment
Loading history...
17 7
    public function select(string $option): void
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
18
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
19 7
        if (empty(array_intersect($this->options, [$option]))) {
0 ignored issues
show
Coding Style introduced by
Short array syntax is not allowed
Loading history...
20 1
            throw new UnknownOption($option);
21
        }
22
23 6
        if ($this->isSelected($option)) {
24 1
            $this->selections = array_values(array_diff($this->selections, [$option]));
0 ignored issues
show
Coding Style introduced by
Short array syntax is not allowed
Loading history...
25
        } else {
26 6
            $this->selections[] = $option;
27
        }
28 6
    }
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 select()
Loading history...
29
}
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...
30