Completed
Pull Request — master (#38)
by Pádraic
02:50
created

OperationExtension   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 1
dl 0
loc 27
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B extend() 0 21 8
1
<?php
2
3
namespace PHPMND\Extension;
4
5
use PhpParser\Node;
6
use PhpParser\Node\Expr\BinaryOp\Div;
7
use PhpParser\Node\Expr\BinaryOp\Minus;
8
use PhpParser\Node\Expr\BinaryOp\Mod;
9
use PhpParser\Node\Expr\BinaryOp\Mul;
10
use PhpParser\Node\Expr\BinaryOp\Plus;
11
use PhpParser\Node\Expr\BinaryOp\Pow;
12
use PhpParser\Node\Expr\BinaryOp\ShiftLeft;
13
use PhpParser\Node\Expr\BinaryOp\ShiftRight;
14
15
/**
16
 * Class OperationExtension
17
 *
18
 * @package PHPMND\Extension
19
 */
20
class OperationExtension implements Extension
21
{
22
    /**
23
     * @inheritdoc
24
     */
25
    public function extend(Node $node)
26
    {
27
        $parentNode = $node->getAttribute('parent');
28
29
        return
30
            $parentNode instanceof Mul
31
            ||
32
            $parentNode instanceof Div
33
            ||
34
            $parentNode instanceof Plus
35
            ||
36
            $parentNode instanceof Minus
37
            ||
38
            $parentNode instanceof Mod
39
            ||
40
            $parentNode instanceof ShiftLeft
41
            ||
42
            $parentNode instanceof ShiftRight
43
            ||
44
            $parentNode instanceof Pow;
45
    }
46
}
47