Code Duplication    Length = 8-8 lines in 2 locations

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

@@ 47-54 (lines=8) @@
44
    public function leaveNode(Node $node)
45
    {
46
        if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Function_ || $node instanceof Stmt\Trait_) {
47
            if ($node instanceof Stmt\Class_ || $node instanceof Stmt\Trait_) {
48
                $name = (string)(isset($node->namespacedName) ? $node->namespacedName : 'anonymous@' . spl_object_hash($node));
49
                $classOrFunction = $this->metrics->get($name);
50
            } else {
51
                $name = (string)$node->name;
52
                $classOrFunction = new FunctionMetric($name);
53
                $this->metrics->attach($classOrFunction);
54
            }
55
56
            if ($classOrFunction === null) {
57
                throw new MetricNullException($name, self::class);

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

@@ 38-45 (lines=8) @@
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
                $name = (string)$node->name;
43
                $classOrFunction = new FunctionMetric($name);
44
                $this->metrics->attach($classOrFunction);
45
            }
46
47
            if ($classOrFunction === null) {
48
                throw new MetricNullException($name, self::class);