Code Duplication    Length = 24-24 lines in 2 locations

src/RunOpenCode/AbstractBuilder/Ast/Metadata/TraitMetadata.php 2 locations

@@ 105-128 (lines=24) @@
102
     *
103
     * @return bool
104
     */
105
    public function hasMethod($name, $traverse = true)
106
    {
107
        foreach ($this->methods as $method) {
108
109
            if ($name === $method->getName()) {
110
                return true;
111
            }
112
        }
113
114
        if ($traverse && $this->hasTraits()) {
115
116
            /**
117
             * @var TraitMetadata $trait
118
             */
119
            foreach ($this->traits as $trait) {
120
121
                if ($trait->hasMethod($name, $traverse)) {
122
                    return true;
123
                }
124
            }
125
        }
126
127
        return false;
128
    }
129
130
    /**
131
     * Check if trait has public method, with optional trait traverse.
@@ 138-161 (lines=24) @@
135
     *
136
     * @return bool
137
     */
138
    public function hasPublicMethod($name, $traverse = true)
139
    {
140
        foreach ($this->methods as $method) {
141
142
            if ($name === $method->getName()) {
143
                return $method->isPublic();
144
            }
145
        }
146
147
        if ($traverse && $this->hasTraits()) {
148
149
            /**
150
             * @var TraitMetadata $trait
151
             */
152
            foreach ($this->traits as $trait) {
153
154
                if ($trait->hasPublicMethod($name, $traverse)) {
155
                    return true;
156
                }
157
            }
158
        }
159
160
        return false;
161
    }
162
163
    /**
164
     * Get public method for trait, with optional trait traverse.