Code Duplication    Length = 8-9 lines in 3 locations

tutu/src/Coduo/TuTu/Request/HeadersMatchingPolicy.php 1 location

@@ 32-40 (lines=9) @@
29
            return true;
30
        }
31
32
        foreach ($config->getRequest()->getHeaders() as $headerName => $headerValuePattern) {
33
            if (!$request->headers->has($headerName)) {
34
                return false;
35
            }
36
37
            if (!$this->phpMatcher->match($request->headers->get($headerName), $headerValuePattern)) {
38
                return false;
39
            }
40
        }
41
42
        return true;
43
    }

tutu/src/Coduo/TuTu/Request/ParameterMatchingPolicy.php 2 locations

@@ 32-39 (lines=8) @@
29
            return true;
30
        }
31
32
        foreach ($config->getRequest()->getQueryParameters() as $name => $valuePattern) {
33
            if (!$request->query->has($name)) {
34
                return false;
35
            }
36
            if (!$this->phpMatcher->match($request->query->get($name), $valuePattern)) {
37
                return false;
38
            }
39
        }
40
41
        foreach ($config->getRequest()->getBodyParameters() as $name => $valuePattern) {
42
            if (!$request->request->has($name)) {
@@ 41-49 (lines=9) @@
38
            }
39
        }
40
41
        foreach ($config->getRequest()->getBodyParameters() as $name => $valuePattern) {
42
            if (!$request->request->has($name)) {
43
                return false;
44
            }
45
46
            if (!$this->phpMatcher->match($request->request->get($name), $valuePattern)) {
47
                return false;
48
            }
49
        }
50
51
        return true;
52
    }