Code Duplication    Length = 11-11 lines in 2 locations

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

@@ 246-256 (lines=11) @@
243
     */
244
    public function getPublicMethod($name, $traverse = true)
245
    {
246
        foreach ($this->methods as $method) {
247
248
            if ($name === $method->getName()) {
249
250
                if ($method->isPublic()) {
251
                    return $method;
252
                }
253
254
                throw new RuntimeException(sprintf('Method "%s()" for class "%s" exists, but it is not public.', $name, $this->name));
255
            }
256
        }
257
258
        if ($traverse && $this->hasTraits()) {
259

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