Completed
Pull Request — master (#3)
by Pavel
09:01
created

RequestImpl   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 2
A getAttributes() 4 4 1
A getMethod() 4 4 1
A getParameters() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: batanov.pavel
5
 * Date: 16.05.2016
6
 * Time: 11:51
7
 */
8
9
namespace Bankiru\Api\Rpc\Tests\Fixtures\Rpc;
10
11
use Bankiru\Api\Rpc\Http\RequestInterface;
12
use Symfony\Component\HttpFoundation\ParameterBag;
13
14 View Code Duplication
class RequestImpl implements RequestInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    /** @var  ParameterBag */
17
    private $attributes;
18
    /** @var  string */
19
    private $method;
20
    /** @var  array|\stdClass */
21
    private $parameters;
22
23
    /**
24
     * RequestImpl constructor.
25
     *
26
     * @param ParameterBag    $attributes
27
     * @param string          $method
28
     * @param array|\stdClass $parameters
29
     */
30 7
    public function __construct($method, $parameters, ParameterBag $attributes = null)
31
    {
32 7
        $this->attributes = $attributes ?: new ParameterBag();
33 7
        $this->method     = $method;
34 7
        $this->parameters = $parameters;
35 7
    }
36
37
    /** {@inheritdoc} */
38 7
    public function getAttributes()
39
    {
40 7
        return $this->attributes;
41
    }
42
43
    /** {@inheritdoc} */
44 7
    public function getMethod()
45
    {
46 7
        return $this->method;
47
    }
48
49
    /** {@inheritdoc} */
50 7
    public function getParameters()
51
    {
52 7
        return $this->parameters;
53
    }
54
}
55