Code Duplication    Length = 7-7 lines in 2 locations

src/Hal/Metric/Class_/Text/HalsteadVisitor.php 1 location

@@ 48-54 (lines=7) @@
45
    public function leaveNode(Node $node)
46
    {
47
        if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Function_ || $node instanceof Stmt\Trait_) {
48
            if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) {
49
                $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.spl_object_hash($node));
50
                $classOrFunction = $this->metrics->get($name);
51
            } else {
52
                $classOrFunction = new FunctionMetric((string) $node->name);
53
                $this->metrics->attach($classOrFunction);
54
            }
55
56
            // search for operands and operators
57
            $operands = [];

src/Hal/Metric/Class_/Text/LengthVisitor.php 1 location

@@ 38-44 (lines=7) @@
35
    public function leaveNode(Node $node)
36
    {
37
        if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Function_ || $node instanceof Stmt\Trait_) {
38
            if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) {
39
                $name = (string) (isset($node->namespacedName) ? $node->namespacedName : 'anonymous@'.spl_object_hash($node));
40
                $classOrFunction = $this->metrics->get($name);
41
            } else {
42
                $classOrFunction = new FunctionMetric((string) $node->name);
43
                $this->metrics->attach($classOrFunction);
44
            }
45
46
47
            $prettyPrinter = new PrettyPrinter\Standard();