OneToOneTransition::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php declare(strict_types=1);
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 "OneToOneTransition.php" doesn't match the expected filename "onetoonetransition.php"
Loading history...
2
3
namespace Star\Component\State\Transitions;
4
5
use Star\Component\State\RegistryBuilder;
6
use Star\Component\State\StateTransition;
7
8
final class OneToOneTransition implements StateTransition
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
9
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class OneToOneTransition
Loading history...
10
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
11
     * @var string
12
     */
13
    private $name;
0 ignored issues
show
Coding Style introduced by
Private member variable "name" must contain a leading underscore
Loading history...
Coding Style introduced by
Expected 1 blank line before member var; 0 found
Loading history...
Coding Style introduced by
Private member variable "name" must be prefixed with an underscore
Loading history...
14
15
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
16
     * @var string
17
     */
18
    private $from;
0 ignored issues
show
Coding Style introduced by
Private member variable "from" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "from" must be prefixed with an underscore
Loading history...
19
20
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
21
     * @var string
22
     */
23
    private $to;
0 ignored issues
show
Coding Style introduced by
Private member variable "to" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "to" must be prefixed with an underscore
Loading history...
24
25 48
    public function __construct(string $name, string $from, string $to)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
Coding Style introduced by
Missing function doc comment
Loading history...
26
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
27 48
        $this->name = $name;
28 48
        $this->from = $from;
29 48
        $this->to = $to;
0 ignored issues
show
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...
30 48
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 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 __construct()
Loading history...
31
32 47
    public function getName(): string
0 ignored issues
show
Coding Style introduced by
Missing function doc comment
Loading history...
33
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
34 47
        return $this->name;
35
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 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 getName()
Loading history...
36
37 47
    public function onRegister(RegistryBuilder $registry): void
0 ignored issues
show
Coding Style introduced by
Missing function doc comment
Loading history...
38
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
39 47
        $registry->registerStartingState($this->name, $this->from, []);
0 ignored issues
show
Coding Style introduced by
Short array syntax is not allowed
Loading history...
40 47
        $registry->registerDestinationState($this->name, $this->to, []);
0 ignored issues
show
Coding Style introduced by
Short array syntax is not allowed
Loading history...
41 47
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 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 onRegister()
Loading history...
42
43
    public function getDestinationState(): string
0 ignored issues
show
Coding Style introduced by
Missing function doc comment
Loading history...
44
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
45
        return $this->to;
46
    }
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 getDestinationState()
Loading history...
47
}
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...
48