Completed
Push — master ( c5de01...c9c19d )
by
unknown
07:34 queued 05:10
created

MethodMatchingPolicy::match()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace Coduo\TuTu\Request;
4
5
use Coduo\TuTu\Config\Element;
6
use Symfony\Component\HttpFoundation\Request;
7
8
class MethodMatchingPolicy implements MatchingPolicy
9
{
10
    /**
11
     * @param Request $request
12
     * @param Element $config
13
     * @return bool
14
     */
15
    public function match(Request $request, Element $config)
16
    {
17
        if (!count($config->getRequest()->getAllowedMethods())) {
18
            return true;
19
        }
20
21
        return in_array($request->getMethod(), $config->getRequest()->getAllowedMethods(), true);
22
    }
23
}
24