AttributeDumper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 27
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A visitState() 0 7 2
A getStructure() 0 3 1
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 "AttributeDumper.php" doesn't match the expected filename "attributedumper.php"
Loading history...
2
3
namespace Star\Component\State\Visitor;
4
5
use Star\Component\State\StateVisitor;
6
7
final class AttributeDumper implements StateVisitor
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
8
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class AttributeDumper
Loading history...
9
    /**
10
     * An array having the state name as key and the attributes of this state.
11
     * @var string[][]
0 ignored issues
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
12
     */
13
    private $structure = [];
0 ignored issues
show
Coding Style introduced by
Private member variable "structure" 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 "structure" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Short array syntax is not allowed
Loading history...
14
15
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
16
     * @return string[][]
17
     */
18 1
    public function getStructure(): array
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
19
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
20 1
        return $this->structure;
21
    }
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 getStructure()
Loading history...
22
23
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
24
     * @param string $name
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 3 spaces after parameter type; 1 found
Loading history...
25
     * @param string[] $attributes
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
26
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
27 1
    public function visitState(string $name, array $attributes): void
28
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
29 1
        if (! isset($this->structure[$name])) {
30 1
            $this->structure[$name] = [];
0 ignored issues
show
Coding Style introduced by
Short array syntax is not allowed
Loading history...
31
        }
32
33 1
        $this->structure[$name] = array_unique(array_merge($this->structure[$name], $attributes));
34 1
    }
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 visitState()
Loading history...
35
}
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...
36