Code Duplication    Length = 11-11 lines in 2 locations

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

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

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