Code Duplication    Length = 11-11 lines in 2 locations

src/RunOpenCode/AbstractBuilder/Ast/Metadata/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/Metadata/TraitMetadata.php 1 location

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