1 | <?php |
||
8 | class IndentationLevelSniff implements PHP_CodeSniffer_Sniff |
||
9 | { |
||
10 | /** |
||
11 | * Indentations cannot be >= to this number. |
||
12 | * @var integer |
||
13 | */ |
||
14 | public $indentationLimit = 2; |
||
15 | |||
16 | /** |
||
17 | * The highest indentation level found. |
||
18 | * @var integer |
||
19 | */ |
||
20 | protected $maxIndentationFound; |
||
21 | |||
22 | /** |
||
23 | * Returns the token types that this sniff is interested in. |
||
24 | * @return array |
||
25 | */ |
||
26 | public function register() |
||
30 | |||
31 | /** |
||
32 | * Processes the tokens that this sniff is interested in. |
||
33 | * |
||
34 | * @param PHP_CodeSniffer_File $phpcsFile The file where the token was found. |
||
35 | * @param integer $stackPtr The position in the stack where |
||
36 | * the token was found. |
||
37 | * @return void |
||
38 | */ |
||
39 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
||
58 | |||
59 | /** |
||
60 | * Inspect the tokens in the scope of the provided $token. |
||
61 | * @param array $token Token Data. |
||
62 | * @param array $tokens Tokens. |
||
63 | * @return void |
||
64 | */ |
||
65 | protected function inspectScope(array $token, array $tokens) |
||
79 | |||
80 | /** |
||
81 | * Remove the bodies of given token type from the scope. |
||
82 | * @param array $scope The tokens in a scope. |
||
83 | * @param string $type The type of token to remove from the scope. |
||
84 | * @return array $scope The tokens scope without the removed tokens. |
||
85 | */ |
||
86 | protected function removeTokenScopes(array $scope, $type) |
||
99 | |||
100 | /** |
||
101 | * Produce the error message. |
||
102 | * @return string |
||
103 | */ |
||
104 | protected function getErrorMessage() |
||
114 | } |
||
115 |