| Conditions | 6 |
| Paths | 4 |
| Total Lines | 31 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 3 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 23 | public function visitPhpFunctionCall(FuncCall $funcCall, Context $context) |
||
| 24 | { |
||
| 25 | $compiler = new Expression($context); |
||
| 26 | $funcNameCompiledExpression = $compiler->compile($funcCall->name); |
||
|
|
|||
| 27 | |||
| 28 | if ($funcNameCompiledExpression->isString() && $funcNameCompiledExpression->isCorrectValue()) { |
||
| 29 | $name = $funcNameCompiledExpression->getValue(); |
||
| 30 | } else { |
||
| 31 | $context->debug( |
||
| 32 | 'Unexpected function name type ' . $funcNameCompiledExpression->getType(), |
||
| 33 | $funcCall->name |
||
| 34 | ); |
||
| 35 | |||
| 36 | return false; |
||
| 37 | } |
||
| 38 | |||
| 39 | if (isset($this->map[$name])) { |
||
| 40 | /** |
||
| 41 | * Exclusion via intval with 2 args intval($number, int $base = 10); |
||
| 42 | */ |
||
| 43 | if ($name == 'intval' && count($funcCall->args) > 1) { |
||
| 44 | return; |
||
| 45 | } |
||
| 46 | |||
| 47 | $context->notice( |
||
| 48 | 'fcall.cast', |
||
| 49 | sprintf('Please use (%s) cast instead of function call.', $this->map[$name]), |
||
| 50 | $funcCall |
||
| 51 | ); |
||
| 52 | } |
||
| 53 | } |
||
| 54 | } |
||
| 55 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.