RequestParserChain   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 35
ccs 12
cts 12
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 8 3
A supports() 0 4 1
A __construct() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the PostmanGeneratorBundle package.
5
 *
6
 * (c) Vincent Chalamon <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace PostmanGeneratorBundle\RequestParser;
13
14
use PostmanGeneratorBundle\Model\Request;
15
16
class RequestParserChain implements RequestParserInterface
17
{
18
    /**
19
     * @var RequestParserInterface[]
20
     */
21
    private $parsers = [];
22
23
    /**
24
     * @param RequestParserInterface[] $parsers
25
     */
26 2
    public function __construct(array $parsers)
27
    {
28 2
        $this->parsers = $parsers;
29 2
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 1
    public function parse(Request $request)
35
    {
36 1
        foreach ($this->parsers as $parser) {
37 1
            if ($parser->supports($request)) {
38 1
                $parser->parse($request);
39 1
            }
40 1
        }
41 1
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 1
    public function supports(Request $request)
47
    {
48 1
        return true;
49
    }
50
}
51