Completed
Push — master ( 7cb383...bf8a98 )
by Alexander
02:20
created

ControlSignatureSniff   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 50
rs 10
c 0
b 0
f 0
ccs 0
cts 20
cp 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getPatterns() 0 17 1
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 34 and the first side effect is on line 18.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * CodingStandard_Sniffs_ControlStructures_ControlSignatureSniff.
4
 *
5
 * PHP version 5
6
 *
7
 * @category PHP
8
 * @package  PHP_CodeSniffer
9
 * @author   Greg Sherwood <[email protected]>
10
 * @author   Marc McIntyre <[email protected]>
11
 * @author   Alexander Obuhovich <[email protected]>
12
 * @license  https://github.com/aik099/CodingStandard/blob/master/LICENSE BSD 3-Clause
13
 * @link     https://github.com/aik099/CodingStandard
14
 */
15
16
// @codeCoverageIgnoreStart
17
if (class_exists('PHP_CodeSniffer_Standards_AbstractPatternSniff', true) === false) {
18
    $error = 'Class PHP_CodeSniffer_Standards_AbstractPatternSniff not found';
19
    throw new PHP_CodeSniffer_Exception($error);
20
}
21
// @codeCoverageIgnoreEnd
22
23
/**
24
 * Verifies that control statements conform to their coding standards.
25
 *
26
 * @category PHP
27
 * @package  PHP_CodeSniffer
28
 * @author   Greg Sherwood <[email protected]>
29
 * @author   Marc McIntyre <[email protected]>
30
 * @author   Alexander Obuhovich <[email protected]>
31
 * @license  https://github.com/aik099/CodingStandard/blob/master/LICENSE BSD 3-Clause
32
 * @link     https://github.com/aik099/CodingStandard
33
 */
34
class CodingStandard_Sniffs_ControlStructures_ControlSignatureSniff extends
0 ignored issues
show
Coding Style introduced by
This class is not in CamelCase format.

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
35
 PHP_CodeSniffer_Standards_AbstractPatternSniff
36
{
37
38
    /**
39
     * A list of tokenizers this sniff supports.
40
     *
41
     * @var array
42
     */
43
    public $supportedTokenizers = array(
44
                                   'PHP',
45
                                   'JS',
46
                                  );
47
48
49
    /**
50
     * Constructs a PEAR_Sniffs_ControlStructures_ControlSignatureSniff.
51
     */
52
    public function __construct()
53
    {
54
        parent::__construct(true);
55
56
    }//end __construct()
57
58
59
    /**
60
     * Returns the patterns that this test wishes to verify.
61
     *
62
     * @return string[]
63
     */
64
    protected function getPatterns()
65
    {
66
        return array(
67
                'do {EOL...} while (...);EOL',
68
                'while (...) {EOL',
69
                'switch (...) {EOL',
70
                'for (...) {EOL',
71
                'if (...) {EOL',
72
                'foreach (...) {EOL',
73
                '}EOLelseif (...) {EOL',
74
                '}EOLelse {EOL',
75
                'do {EOL',
76
                'try {EOL',
77
                '}EOLcatch (...) {EOL'
78
               );
79
80
    }//end getPatterns()
81
82
83
}//end class
84