Passed
Push — master ( 624c72...422b2f )
by Vladimir
06:35
created

CheckPluginAbstract::_descr()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
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;
13
14
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
15
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
16
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
17
use Tvi\MonitorBundle\Exception\FeatureRequired;
18
19
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
20
 * @author Vladimir Turnaev <[email protected]>
21
 */
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...
22
abstract class CheckPluginAbstract implements CheckPluginInterface
23
{
24
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
25
     * @throws FeatureRequired
26
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
27 32
    public function checkRequirements()
28
    {
29 32
    }
30
31
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $builder should have a doc-comment as per coding-style.
Loading history...
32
     * @return NodeDefinition|ArrayNodeDefinition
33
     */
34 49
    public function checkConf(TreeBuilder $builder): NodeDefinition
35
    {
36
        $node = $builder
37 49
            ->root(static::CHECK_NAME, 'array')
38 49
            ->info(static::DESCR); //--
39
40 49
        $this->_check($node);
41
42 49
        return $node;
43
    }
44
45
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $builder should have a doc-comment as per coding-style.
Loading history...
46
     * @return NodeDefinition|ArrayNodeDefinition
47
     */
48 49
    public function checkFactoryConf(TreeBuilder $builder): NodeDefinition
49
    {
50
        $node = $builder
51 49
            ->root(static::CHECK_NAME.'_factory', 'array')
52 49
            ->info(static::DESCR)
53 49
            ->children()
54 49
                ->arrayNode('items')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
55 49
                    ->useAttributeAsKey('key')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
56 49
                    ->prototype('array'); //--
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
57 49
        $node = $this->_check($node)
58 49
                    ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
59 49
                ->end()
0 ignored issues
show
Bug introduced by
The method end() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of said class. However, the method does not exist in Symfony\Component\Config...ion\Builder\TreeBuilder. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

59
                ->/** @scrutinizer ignore-call */ end()
Loading history...
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
60 49
            ->end();
61
62 49
        $this->_addition($node);
63
64 49
        return $node;
65
    }
66
67
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
68
     * @param NodeDefinition|ArrayNodeDefinition $node
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
69
     *
70
     * @return NodeDefinition|ArrayNodeDefinition
71
     */
72 49
    protected function _addition(NodeDefinition $node): NodeDefinition
0 ignored issues
show
Coding Style introduced by
Protected method name "CheckPluginAbstract::_addition" must not be prefixed with an underscore
Loading history...
73
    {
74 49
        $this->_group($node);
75 49
        $this->_tags($node);
76 49
        $this->_label($node);
77 49
        $this->_descr($node);
78
79 49
        return $node;
80
    }
81
82
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
83
     * @param NodeDefinition|ArrayNodeDefinition $node
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
84
     *
85
     * @return NodeDefinition|ArrayNodeDefinition
86
     */
87
    abstract protected function _check(NodeDefinition $node): NodeDefinition;
0 ignored issues
show
Coding Style introduced by
Protected method name "CheckPluginAbstract::_check" must not be prefixed with an underscore
Loading history...
88
89
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
90
     * @param NodeDefinition|ArrayNodeDefinition $node
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
91
     *
92
     * @return NodeDefinition|ArrayNodeDefinition
93
     */
94 49
    protected function _label(NodeDefinition $node): NodeDefinition
0 ignored issues
show
Coding Style introduced by
Protected method name "CheckPluginAbstract::_label" must not be prefixed with an underscore
Loading history...
95
    {
96
        return $node
97 49
            ->children()
98 49
                ->scalarNode('label')->defaultNull()->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
99 49
            ->end();
100
    }
101
102
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
103
     * @param NodeDefinition|ArrayNodeDefinition $node
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
104
     *
105
     * @return NodeDefinition|ArrayNodeDefinition
106
     */
107 49
    protected function _group(NodeDefinition $node): NodeDefinition
0 ignored issues
show
Coding Style introduced by
Protected method name "CheckPluginAbstract::_group" must not be prefixed with an underscore
Loading history...
108
    {
109
        return $node
110 49
            ->children()
111 49
                ->scalarNode('group')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
112 49
                    ->cannotBeEmpty()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
113 49
                ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
114 49
                ->scalarNode('_group')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
115 49
                    ->defaultValue(static::GROUP)
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
116 49
                    ->cannotBeOverwritten()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
117 49
                ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
118 49
            ->end();
119
    }
120
121
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
122
     * @param NodeDefinition|ArrayNodeDefinition $node
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
123
     *
124
     * @return NodeDefinition|ArrayNodeDefinition
125
     */
126 49
    protected function _tags(NodeDefinition $node): NodeDefinition
0 ignored issues
show
Coding Style introduced by
Protected method name "CheckPluginAbstract::_tags" must not be prefixed with an underscore
Loading history...
127
    {
128
        return $node
129 49
            ->children()
130 49
                ->arrayNode('tags')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
131 49
                    ->prototype('scalar')->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
132 49
                ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
133 49
            ->end();
134
    }
135
136
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
137
     * @param NodeDefinition|ArrayNodeDefinition $node
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
138
     *
139
     * @return NodeDefinition|ArrayNodeDefinition
140
     */
141 49
    protected function _descr(NodeDefinition $node): NodeDefinition
0 ignored issues
show
Coding Style introduced by
Protected method name "CheckPluginAbstract::_descr" must not be prefixed with an underscore
Loading history...
142
    {
143
        return $node
144 49
            ->children()
145 49
                ->scalarNode('descr')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
146 49
                    ->defaultNull()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
147 49
                ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
148 49
            ->end();
149
    }
150
}
151