Code Duplication    Length = 7-12 lines in 2 locations

src/Visitor/AddMagicGetMethod.php 1 location

@@ 39-45 (lines=7) @@
36
        return null;
37
    }
38
39
    private function buildGetExpression(): Node\Stmt\If_
40
    {
41
        $resolved = Expressions::resolveMethodCall('this', $this->resolverProperty, $this->resolveMethod);
42
        $stmt = new Node\Stmt\Return_(new Node\Expr\PropertyFetch($resolved, '{$name}'));
43
44
        return Expressions::throwExceptionOnNull($resolved, $stmt);
45
    }
46
}

src/Visitor/AddMagicSetMethod.php 1 location

@@ 39-50 (lines=12) @@
36
        return null;
37
    }
38
39
    private function buildSetExpression(): Node\Stmt\If_
40
    {
41
        $resolved = Expressions::resolveMethodCall('this', $this->resolverProperty, $this->resolveMethod);
42
        $stmt = new Node\Stmt\Expression(
43
            new Node\Expr\Assign(
44
                new Node\Expr\PropertyFetch($resolved, '{$name}'),
45
                new Node\Expr\Variable('value')
46
            )
47
        );
48
49
        return Expressions::throwExceptionOnNull($resolved, $stmt);
50
    }
51
}