Code Duplication    Length = 7-8 lines in 2 locations

src/Factory/AbstractDriver.php 1 location

@@ 119-125 (lines=7) @@
116
     */
117
    protected function removeMethod(Class_ $part, string $name)
118
    {
119
        foreach ($part->stmts as $key => $statement) {
120
            if ($statement instanceof ClassMethod) {
121
                if ($statement->name === $name) {
122
                    unset($part->stmts[$key]);
123
                }
124
            }
125
        }
126
    }
127
128
    /**

src/Factory/AllArgsConstructorDriver.php 1 location

@@ 45-52 (lines=8) @@
42
                // remove constructor
43
                $this->removeConstructor($part);
44
                $part->stmts[] = $this->createConstructor();
45
                foreach ($part->stmts as $key => $statement) {
46
                    if ($statement instanceof ClassMethod) {
47
                        if ('__construct' !== $statement->name) {
48
                            unset($part->stmts[$key]);
49
                            $part->stmts[] = $statement;
50
                        }
51
                    }
52
                }
53
            }
54
        }
55