Test Failed
Pull Request — master (#11)
by Pavel
08:20
created

Specification/RichJsonRpcRequest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Bankiru\Api\JsonRpc\Specification;
4
5
use Bankiru\Api\JsonRpc\BankiruJsonRpcServerBundle;
6
use Bankiru\Api\Rpc\RpcRequestInterface;
7
use ScayTrase\Api\JsonRpc\JsonRpcRequestInterface;
8
use Symfony\Component\HttpFoundation\ParameterBag;
9
10
final class RichJsonRpcRequest implements RpcRequestInterface, JsonRpcRequestInterface
11
{
12
    /** @var  JsonRpcRequestInterface */
13
    private $request;
14
    /** @var  ParameterBag */
15
    private $attributes;
16
17
    /**
18
     * RichJsonRpcRequest constructor.
19
     *
20
     * @param JsonRpcRequestInterface $request
21
     * @param ParameterBag            $attributes
22
     */
23 7
    public function __construct(JsonRpcRequestInterface $request, ParameterBag $attributes = null)
24
    {
25 7
        $this->request    = $request;
26 7
        $this->attributes = $attributes ?: new ParameterBag();
27
    }
28 7
29 7
    /** {@inheritdoc} */
30 7
    public function isNotification()
31 7
    {
32
        return $this->request->isNotification();
33
    }
34 7
35
    /** {@inheritdoc} */
36 7
    public function getAttributes()
37
    {
38
        return $this->attributes;
39
    }
40 7
41
    /** {@inheritdoc} */
42 7 View Code Duplication
    public function jsonSerialize()
0 ignored issues
show
This method 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...
43
    {
44
        return [
45
            self::VERSION_FIELD    => $this->getVersion(),
46 1
            self::METHOD_FIELD     => $this->getMethod(),
47
            self::PARAMETERS_FIELD => $this->getParameters(),
48
            self::ID_FIELD         => $this->getId(),
49 1
        ];
50 1
    }
51 1
52 1
    /** {@inheritdoc} */
53 1
    public function getVersion()
54
    {
55
        return BankiruJsonRpcServerBundle::JSONRPC_VERSION;
56
    }
57 1
58
    /** {@inheritdoc} */
59 1
    public function getMethod()
60
    {
61
        return $this->request->getMethod();
62
    }
63 7
64
    /** {@inheritdoc} */
65 7
    public function getParameters()
66
    {
67
        return $this->request->getParameters();
68
    }
69 6
70
    /** {@inheritdoc} */
71 6
    public function getId()
72
    {
73
        return $this->request->getId();
74
    }
75
}
76