@@ 14-27 (lines=14) @@ | ||
11 | * Try to avoid using inline ifs. They conceal the complexity of your code. |
|
12 | * Furthermore they obstruct the expandability. Refactor your code and increase the readability. |
|
13 | */ |
|
14 | class ConditionalExpression extends AbstractRule implements MethodAware |
|
15 | { |
|
16 | /** |
|
17 | * @param AbstractNode|MethodNode $node |
|
18 | */ |
|
19 | public function apply(AbstractNode $node) |
|
20 | { |
|
21 | $conditionalExpressions = $node->findChildrenOfType('ConditionalExpression'); |
|
22 | ||
23 | foreach ($conditionalExpressions as $conditionalExpression) { |
|
24 | $this->addViolation($conditionalExpression); |
|
25 | } |
|
26 | } |
|
27 | } |
|
28 |
@@ 13-26 (lines=14) @@ | ||
10 | /** |
|
11 | * Try to avoid using switch-case statements. Use polymorphism instead. |
|
12 | */ |
|
13 | class SwitchStatement extends AbstractRule implements MethodAware |
|
14 | { |
|
15 | /** |
|
16 | * @param AbstractNode|MethodNode $node |
|
17 | */ |
|
18 | public function apply(AbstractNode $node) |
|
19 | { |
|
20 | $switchStatements = $node->findChildrenOfType('SwitchStatement'); |
|
21 | ||
22 | foreach ($switchStatements as $switchStatement) { |
|
23 | $this->addViolation($switchStatement); |
|
24 | } |
|
25 | } |
|
26 | } |
|
27 |