hooksEnabledWithEnabledTools()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 75

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 75
rs 8.5454
c 0
b 0
f 0
cc 1
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace PhpGitHooks\Module\Configuration\Tests\Stub;
4
5
use PhpGitHooks\Module\Configuration\Service\HookQuestions;
6
7
class ConfigArrayDataStub
8
{
9
    const PHPCS_STANDARD = 'PSR2';
10
    const PHPUNIT_OPTIONS = '--suite default';
11
    const RIGHT_MESSAGE = 'good job';
12
    const REGULAR_EXPRESSION = '#[0-9]{2,7}';
13
    const ERROR_MESSAGE = 'fix your code';
14
    const PHPMD_OPTIONS = '--minimumpriority 1';
15
    const PHPCSFIXER_OPTIONS = '--diff';
16
    const MINIMUM_COVERAGE = 90.00;
17
    const EMPTY_STRING = '';
18
19
    /**
20
     * @return array
21
     */
22
    public static function hooksEnabledWithEnabledTools()
23
    {
24
        return [
25
            'pre-commit' => [
26
                'enabled' => true,
27
                'execute' => [
28
                    'composer' => true,
29
                    'jsonlint' => true,
30
                    'phplint' => true,
31
                    'phpmd' => [
32
                        'enabled' => true,
33
                        'options' => self::PHPMD_OPTIONS
34
                    ],
35
                    'phpcs' => [
36
                        'enabled' => true,
37
                        'standard' => static::PHPCS_STANDARD,
38
                        'ignore' => static::EMPTY_STRING,
39
                    ],
40
                    'php-cs-fixer' => [
41
                        'enabled' => true,
42
                        'levels' => [
43
                            'psr0' => true,
44
                            'psr1' => true,
45
                            'psr2' => true,
46
                            'symfony' => true,
47
                        ],
48
                        'options' => static::PHPCSFIXER_OPTIONS,
49
                    ],
50
                    'phpunit' => [
51
                        'enabled' => true,
52
                        'random-mode' => true,
53
                        'options' => static::PHPUNIT_OPTIONS,
54
                        'strict-coverage' => [
55
                            'enabled' => true,
56
                            'minimum' => self::MINIMUM_COVERAGE
57
                        ],
58
                        'guard-coverage' => [
59
                            'enabled' => true,
60
                            'message' => self::ERROR_MESSAGE
61
                        ],
62
                    ],
63
                ],
64
                'message' => [
65
                    'right-message' => static::RIGHT_MESSAGE,
66
                    'error-message' => static::ERROR_MESSAGE,
67
                ],
68
            ],
69
            'commit-msg' => [
70
                'enabled' => true,
71
                'regular-expression' => static::REGULAR_EXPRESSION,
72
            ],
73
            'pre-push' => [
74
                'enabled' => true,
75
                'execute' => [
76
                    'phpunit' => [
77
                        'enabled' => true,
78
                        'random-mode' => true,
79
                        'options' => static::PHPUNIT_OPTIONS,
80
                        'strict-coverage' => [
81
                            'enabled' => true,
82
                            'minimum' => self::MINIMUM_COVERAGE
83
                        ],
84
                        'guard-coverage' => [
85
                            'enabled' => true,
86
                            'message' => self::ERROR_MESSAGE
87
                        ],
88
                    ]
89
                ],
90
                'message' => [
91
                    'right-message' => HookQuestions::PRE_PUSH_RIGHT_MESSAGE_DEFAULT,
92
                    'error-message' => HookQuestions::PRE_PUSH_ERROR_MESSAGE_DEFAULT,
93
                ]
94
            ]
95
        ];
96
    }
97
}
98