Completed
Push — master ( 295638...aca6e3 )
by Vladimir
05:35
created

CheckPluginAbstract::checkFactoryConf()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 19
ccs 15
cts 15
cp 1
rs 9.7666
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\NodeDefinition;
15
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
16
use Tvi\MonitorBundle\Exception\FeatureRequired;
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
abstract class CheckPluginAbstract implements CheckPluginInterface
22
{
23
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
24
     * @throws FeatureRequired
25
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
26 32
    public function checkRequirements()
27
    {
28 32
    }
29
30 45
    public function checkConf(TreeBuilder $builder): NodeDefinition
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function checkConf()
Loading history...
31
    {
32
        $node = $builder
33 45
            ->root(static::CHECK_NAME, 'array')
34 45
            ->info(static::DESCR); //--
35
36 45
        $this->_check($node);
37
38 45
        return $node;
39
    }
40
41 45
    public function checkFactoryConf(TreeBuilder $builder): NodeDefinition
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function checkFactoryConf()
Loading history...
42
    {
43
        $node = $builder
44 45
            ->root(static::CHECK_NAME.'_factory', 'array')
45 45
            ->info(static::DESCR)
46 45
            ->children()
47 45
                ->arrayNode('items')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
48 45
                    ->useAttributeAsKey('key')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
49 45
                    ->prototype('array'); //--
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
50 45
        $node = $this->_check($node)
51 45
                    ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
52 45
                ->/* @scrutinizer ignore-call */ end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
53 45
            ->end();
54
55 45
        $this->_group($node);
56 45
        $this->_tags($node);
57 45
        $this->_label($node);
58
59 45
        return $node;
60
    }
61
62
    abstract protected function _check(NodeDefinition $node): NodeDefinition;
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function _check()
Loading history...
Coding Style introduced by
Protected method name "CheckPluginAbstract::_check" must not be prefixed with an underscore
Loading history...
63
64 45
    protected function _label(NodeDefinition $node): NodeDefinition
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function _label()
Loading history...
Coding Style introduced by
Protected method name "CheckPluginAbstract::_label" must not be prefixed with an underscore
Loading history...
65
    {
66
        return $node
67 45
            ->children()
68 45
                ->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...
69 45
            ->end();
70
    }
71
72 45
    protected function _group(NodeDefinition $node): NodeDefinition
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function _group()
Loading history...
Coding Style introduced by
Protected method name "CheckPluginAbstract::_group" must not be prefixed with an underscore
Loading history...
73
    {
74
        return $node
75 45
            ->children()
76 45
                ->scalarNode('group')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
77 45
                    ->defaultValue(static::GROUP)
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
78 45
                    ->cannotBeEmpty()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
79 45
                ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
80 45
            ->end();
81
    }
82
83 45
    protected function _tags(NodeDefinition $node): NodeDefinition
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function _tags()
Loading history...
Coding Style introduced by
Protected method name "CheckPluginAbstract::_tags" must not be prefixed with an underscore
Loading history...
84
    {
85
        return $node
86 45
            ->children()
87 45
                ->arrayNode('tags')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
88 45
                    ->prototype('scalar')->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
89 45
                ->end()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
90 45
            ->end();
91
    }
92
}
93