Conditions | 2 |
Paths | 1 |
Total Lines | 29 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <? |
||
20 | public static function find(Collection $collection) { |
||
21 | $result = []; |
||
22 | |||
23 | (new PatternMatcher($collection)) |
||
24 | ->apply(new ClassPattern()) |
||
25 | ->apply(function (QuerySequence $q) use (&$result) { |
||
26 | |||
27 | |||
28 | $q->strict((new Strict())->valueIs(['public', 'protected', 'private'])); |
||
29 | $q->possible(T_WHITESPACE); |
||
30 | $q->possible('static'); |
||
31 | $q->possible(T_WHITESPACE); |
||
32 | $variable = $q->strict(T_VARIABLE); |
||
33 | |||
34 | $tokensToRemove = []; |
||
35 | $tokensToRemove[] = $q->possible(T_WHITESPACE); |
||
36 | $tokensToRemove[] = $q->strict('='); |
||
37 | $tokensToRemove[] = $q->possible(T_WHITESPACE); |
||
38 | $tokensToRemove[] = $q->strict('null'); |
||
39 | $tokensToRemove[] = $q->possible(T_WHITESPACE); |
||
40 | $q->strict(';'); |
||
41 | |||
42 | if ($q->isValid()) { |
||
43 | $result[] = new PropertyDefinition($variable, $tokensToRemove); |
||
44 | } |
||
45 | }); |
||
46 | |||
47 | return $result; |
||
48 | } |
||
49 | |||
50 | } |
Short opening tags are disabled in PHP’s default configuration. In such a case, all content of this file is output verbatim to the browser without being parsed, or executed.
As a precaution to avoid these problems better use the long opening tag
<?php
.