Conditions | 6 |
Paths | 5 |
Total Lines | 31 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
1 | <?php |
||
21 | public function pass(FuncCall $funcCall, Context $context) |
||
22 | { |
||
23 | $compiler = $context->getExpressionCompiler(); |
||
24 | $funcNameCompiledExpression = $compiler->compile($funcCall->name); |
||
|
|||
25 | |||
26 | if ($funcNameCompiledExpression->isString() && $funcNameCompiledExpression->isCorrectValue()) { |
||
27 | $name = $funcNameCompiledExpression->getValue(); |
||
28 | } else { |
||
29 | $context->debug( |
||
30 | 'Unexpected function name type ' . $funcNameCompiledExpression->getType(), |
||
31 | $funcCall->name |
||
32 | ); |
||
33 | |||
34 | return false; |
||
35 | } |
||
36 | |||
37 | if (isset($this->map[$name])) { |
||
38 | if ($funcCall->getDocComment()) { |
||
39 | $phpdoc = new \phpDocumentor\Reflection\DocBlock($funcCall->getDocComment()->getText()); |
||
40 | if ($phpdoc->hasTag('expected')) { |
||
41 | return true; |
||
42 | } |
||
43 | } |
||
44 | |||
45 | $context->notice( |
||
46 | 'debug.code', |
||
47 | sprintf('Function %s() is a debug code, please don`t use it in production.', $name), |
||
48 | $funcCall |
||
49 | ); |
||
50 | } |
||
51 | } |
||
52 | } |
||
53 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.