Completed
Push — master ( 3ccb4d...f0ec0e )
by Vladimir
05:12
created

Plugin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 30
dl 0
loc 46
ccs 23
cts 23
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A _check() 0 29 2
1
<?php
2
3
/**
4
 * This file is part of the `tvi/monitor-bundle` project.
5
 *
6
 * (c) https://github.com/turnaev/monitor-bundle/graphs/contributors
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
Coding Style introduced by
Missing @link tag in file comment
Loading history...
11
12
namespace Tvi\MonitorBundle\Check\fs\YamlFile;
13
14
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
15
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
16
use Tvi\MonitorBundle\Check\CheckPluginAbstract;
17
18
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
19
 * @author Vladimir Turnaev <[email protected]>
20
 */
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 @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
21
class Plugin extends CheckPluginAbstract
22
{
23
    public const DESCR =
0 ignored issues
show
Coding Style introduced by
Multi-line assignments must have the equal sign on the second line
Loading history...
24
<<<'TXT'
0 ignored issues
show
Coding Style introduced by
Line indented incorrectly; expected at least 4 spaces, found 0
Loading history...
25
yaml_file description
26
TXT;
27
28
    public const PATH = __DIR__;
29
30
    public const GROUP = 'fs';
31
    public const CHECK_NAME = 'yaml_file';
32
33
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
34
     * @param NodeDefinition|ArrayNodeDefinition $node
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
35
     *
36
     * @return NodeDefinition|ArrayNodeDefinition
37
     */
38 45
    protected function _check(NodeDefinition $node): NodeDefinition
0 ignored issues
show
Coding Style introduced by
Protected method name "Plugin::_check" must not be prefixed with an underscore
Loading history...
39
    {
40
        $node = $node
41 45
            ->children()
42 45
                ->arrayNode('check')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
43 45
                    ->children()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
44 45
                        ->arrayNode('files')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 24
Loading history...
45 45
                            ->isRequired()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 28
Loading history...
46 45
                            ->beforeNormalization()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 28
Loading history...
47 45
                                ->ifString()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 32
Loading history...
48 45
                                ->then(static function ($value) {
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 32
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
49 1
                                    if (\is_string($value)) {
50 1
                                        $value = [$value];
51
                                    }
52
53 1
                                    return $value;
54 45
                                })
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
55 45
                                ->end()
56 45
                            ->prototype('scalar')->end()
57 45
                        ->end()
58 45
                    ->end()
59 45
                ->end()
60 45
            ->end();
61
62 45
        $this->_group($node);
63 45
        $this->_tags($node);
64 45
        $this->_label($node);
65
66 45
        return $node;
67
    }
68
}
69