Code Duplication    Length = 18-20 lines in 2 locations

src/filter/AccessFilter.php 2 locations

@@ 166-183 (lines=18) @@
163
     * @return bool
164
     * @throws Exception
165
     */
166
    protected function matchRole($rule)
167
    {
168
        if (empty($rule['roles'])) {
169
            return true;
170
        }
171
172
        if (!is_array($rule['roles'])) {
173
            $rule['roles'][] = $rule['roles'];
174
        }
175
176
        /** @noinspection ForeachSourceInspection */
177
        foreach ($rule['roles'] AS $role) {
178
            if ($this->user->check($role)) {
179
                return true;
180
            }
181
        }
182
183
        return false;
184
    }
185
186
    /**
@@ 229-248 (lines=20) @@
226
     * @return bool
227
     * @throws Exception
228
     */
229
    protected function matchVerb($rule)
230
    {
231
        if (empty($rule['verb'])) {
232
            return true;
233
        }
234
235
        if (!is_array($rule['verb'])) {
236
            $rule['verb'][] = $rule['verb'];
237
        }
238
239
        $verb = $this->request->getMethod();
240
241
        /** @noinspection ForeachSourceInspection */
242
        foreach ($rule['verb'] AS $v) {
243
            if ($v === $verb) {
244
                return true;
245
            }
246
        }
247
248
        return false;
249
    }
250
251
    /**