Code Duplication    Length = 11-11 lines in 2 locations

src/RunOpenCode/AbstractBuilder/Ast/Metadata/TraitMetadata.php 1 location

@@ 175-185 (lines=11) @@
172
     */
173
    public function getPublicMethod($name, $traverse = true)
174
    {
175
        foreach ($this->methods as $method) {
176
177
            if ($name === $method->getName()) {
178
179
                if ($method->isPublic()) {
180
                    return $method;
181
                }
182
183
                throw new RuntimeException(sprintf('Method "%s()" for trait "%s" exists, but it is not public.', $name, $this->name));
184
            }
185
        }
186
187
        if ($traverse && $this->hasTraits()) {
188

src/RunOpenCode/AbstractBuilder/Ast/Metadata/ClassMetadata.php 1 location

@@ 263-273 (lines=11) @@
260
     */
261
    public function getPublicMethod($name, $traverse = true)
262
    {
263
        foreach ($this->methods as $method) {
264
265
            if ($name === $method->getName()) {
266
267
                if ($method->isPublic()) {
268
                    return $method;
269
                }
270
271
                throw new RuntimeException(sprintf('Method "%s()" for class "%s" exists, but it is not public.', $name, $this->name));
272
            }
273
        }
274
275
        if ($traverse && $this->hasTraits()) {
276