Code Duplication    Length = 11-11 lines in 2 locations

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

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

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

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