| Conditions | 7 |
| Paths | 27 |
| Total Lines | 35 |
| Code Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 29 |
| CRAP Score | 7 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 32 | public function pass(ClassMethod $methodStmt, Context $context) |
|
| 21 | { |
||
| 22 | 32 | if ($methodStmt->name == '__get') { |
|
| 23 | 1 | if (count($methodStmt->params) == 0) { |
|
| 24 | 1 | $context->notice( |
|
| 25 | 1 | 'magic_method_parameters', |
|
| 26 | 1 | 'Magic method __get must take 1 parameter at least', |
|
| 27 | 1 | $methodStmt, |
|
| 28 | Check::CHECK_SAFE |
||
| 29 | 1 | ); |
|
| 30 | 1 | } |
|
| 31 | 1 | } |
|
| 32 | |||
| 33 | 32 | if ($methodStmt->name == '__set') { |
|
| 34 | 1 | if (count($methodStmt->params) < 2) { |
|
| 35 | 1 | $context->notice( |
|
| 36 | 1 | 'magic_method_parameters', |
|
| 37 | 1 | 'Magic method __set must take 2 parameters at least', |
|
| 38 | 1 | $methodStmt, |
|
| 39 | Check::CHECK_SAFE |
||
| 40 | 1 | ); |
|
| 41 | 1 | } |
|
| 42 | 1 | } |
|
| 43 | |||
| 44 | 32 | if ($methodStmt->name == '__clone') { |
|
| 45 | 1 | if (count($methodStmt->params) > 0) { |
|
| 46 | 1 | $context->notice( |
|
| 47 | 1 | 'magic_method_parameters', |
|
| 48 | 1 | 'Magic method __clone cannot accept arguments', |
|
| 49 | 1 | $methodStmt, |
|
| 50 | Check::CHECK_SAFE |
||
| 51 | 1 | ); |
|
| 52 | 1 | } |
|
| 53 | 1 | } |
|
| 54 | 32 | } |
|
| 55 | |||
| 66 |