Passed
Push — master ( e0f7b0...4354d2 )
by Vladimir
05:39 queued 20s
created

Config::_check()   A

Complexity

Conditions 3
Paths 1

Size

Total Lines 25
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 20
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 20
nc 1
nop 1
dl 0
loc 25
rs 9.6
c 0
b 0
f 0
ccs 20
cts 20
cp 1
crap 3
1
<?php
2
/*
0 ignored issues
show
Coding Style introduced by
You must use "/**" style comments for a file comment
Loading history...
3
 * This file is part of the `tvi/monitor-bundle` project.
4
 *
5
 * (c) https://github.com/turnaev/monitor-bundle/graphs/contributors
6
 *
7
 * For the full copyright and license information, please view the LICENSE.md
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Tvi\MonitorBundle\Check\php\ExtensionLoaded;
12
13
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
14
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
15
use Tvi\MonitorBundle\Check\CheckConfigAbstract;
16
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 Config extends CheckConfigAbstract
22
{
23
    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
php_extension description
26
TXT;
27
28
    const PATH = __DIR__;
29
30
    const GROUP = 'php';
31
    const CHECK_NAME = 'extension_loaded';
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
37
     */
38 41
    protected function _check(NodeDefinition $node): NodeDefinition
0 ignored issues
show
Coding Style introduced by
Protected method name "Config::_check" must not be prefixed with an underscore
Loading history...
39
    {
40
        $node = $node
41 41
            ->children()
42 41
                ->arrayNode('check')
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 16
Loading history...
43 41
                    ->beforeNormalization()
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
Loading history...
44 41
                    ->always(function ($value) {
0 ignored issues
show
Coding Style introduced by
Object operator not indented correctly; expected 12 spaces but found 20
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...
45 1
                        if(isset($value['extensionName']) && !is_array($value['extensionName'])) {
0 ignored issues
show
Coding Style introduced by
Expected "if (...) {\n"; found "if(...) {\n"
Loading history...
46 1
                            $value['extensionName'] = [$value['extensionName']];
47
                        }
48 1
                        return $value;
49 41
                    })->end()
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...
50 41
                    ->children()
51 41
                        ->arrayNode('extensionName')
52 41
                            ->prototype('scalar')->end()
53 41
                        ->end()
54 41
                    ->end()
55 41
                ->end()
56 41
            ->end();
57
58 41
        $this->_group($node);
59 41
        $this->_tags($node);
60 41
        $this->_label($node);
61
62 41
        return $node;
63
    }
64
}
65