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