Passed
Pull Request — master (#9)
by Pavel
05:47
created

Request::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 3
crap 2
1
<?php
2
3
namespace Bankiru\Api\Rpc\Test\Impl;
4
5
use Bankiru\Api\Rpc\RpcRequestInterface;
6
use Symfony\Component\HttpFoundation\ParameterBag;
7
8
final class Request implements RpcRequestInterface
9
{
10
    /** @var  ParameterBag */
11
    private $attributes;
12
    /** @var  string */
13
    private $method;
14
    /** @var  array|\stdClass */
15
    private $parameters;
16
17
    /**
18
     * Request constructor.
19
     *
20
     * @param ParameterBag    $attributes
21
     * @param string          $method
22
     * @param array|\stdClass $parameters
23
     */
24 9
    public function __construct($method, $parameters, ParameterBag $attributes = null)
25
    {
26 9
        $this->attributes = $attributes ?: new ParameterBag();
27 9
        $this->method     = $method;
28 9
        $this->parameters = $parameters;
29 9
    }
30
31
    /** {@inheritdoc} */
32 9
    public function getAttributes()
33
    {
34 9
        return $this->attributes;
35
    }
36
37
    /** {@inheritdoc} */
38 9
    public function getMethod()
39
    {
40 9
        return $this->method;
41
    }
42
43
    /** {@inheritdoc} */
44 8
    public function getParameters()
45
    {
46 8
        return $this->parameters;
47
    }
48
}
49