UriRequestParser   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 20
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 4 1
A supports() 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 UriRequestParser implements RequestParserInterface
17
{
18
    const PATTERN = '/\/({id})$/';
19
20
    /**
21
     * {@inheritdoc}
22
     */
23 1
    public function parse(Request $request)
24
    {
25 1
        $request->setUrl(preg_replace(self::PATTERN, '/1', $request->getUrl()));
26 1
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 2
    public function supports(Request $request)
32
    {
33 2
        return 1 === preg_match(self::PATTERN, $request->getUrl());
34
    }
35
}
36