Code Duplication    Length = 11-11 lines in 2 locations

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

@@ 167-177 (lines=11) @@
164
     */
165
    public function getPublicMethod($name, $traverse = true)
166
    {
167
        foreach ($this->methods as $method) {
168
169
            if ($name === $method->getName()) {
170
171
                if ($method->isPublic()) {
172
                    return $method;
173
                }
174
175
                throw new RuntimeException(sprintf('Method "%s()" for trait "%s" exists, but it is not public.', $name, $this->name));
176
            }
177
        }
178
179
        if ($traverse && $this->hasTraits()) {
180

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

@@ 254-264 (lines=11) @@
251
     */
252
    public function getPublicMethod($name, $traverse = true)
253
    {
254
        foreach ($this->methods as $method) {
255
256
            if ($name === $method->getName()) {
257
258
                if ($method->isPublic()) {
259
                    return $method;
260
                }
261
262
                throw new RuntimeException(sprintf('Method "%s()" for class "%s" exists, but it is not public.', $name, $this->name));
263
            }
264
        }
265
266
        if ($traverse && $this->hasTraits()) {
267