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

MethodMatchingPolicy   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A match() 0 8 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