| Conditions | 2 |
| Paths | 1 |
| Total Lines | 29 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 21 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 15 | public static function find(Collection $collection) { |
|
| 21 | 15 | $result = []; |
|
| 22 | |||
| 23 | 15 | (new PatternMatcher($collection)) |
|
| 24 | 15 | ->apply(new ClassPattern()) |
|
| 25 | 15 | ->apply(function (QuerySequence $q) use (&$result) { |
|
| 26 | |||
| 27 | |||
| 28 | 13 | $q->strict((new Strict())->valueIs(['public', 'protected', 'private'])); |
|
| 29 | 13 | $q->possible(T_WHITESPACE); |
|
| 30 | 13 | $q->possible('static'); |
|
| 31 | 13 | $q->possible(T_WHITESPACE); |
|
| 32 | 13 | $variable = $q->strict(T_VARIABLE); |
|
| 33 | |||
| 34 | 13 | $tokensToRemove = []; |
|
| 35 | 13 | $tokensToRemove[] = $q->possible(T_WHITESPACE); |
|
| 36 | 13 | $tokensToRemove[] = $q->strict('='); |
|
| 37 | 13 | $tokensToRemove[] = $q->possible(T_WHITESPACE); |
|
| 38 | 13 | $tokensToRemove[] = $q->strict('null'); |
|
| 39 | 13 | $tokensToRemove[] = $q->possible(T_WHITESPACE); |
|
| 40 | 13 | $q->strict(';'); |
|
| 41 | |||
| 42 | 13 | if ($q->isValid()) { |
|
| 43 | 10 | $result[] = new PropertyDefinition($variable, $tokensToRemove); |
|
| 44 | } |
||
| 45 | 15 | }); |
|
| 46 | |||
| 47 | 15 | return $result; |
|
| 48 | } |
||
| 49 | |||
| 50 | } |