Completed
Push — master ( 91799e...396800 )
by Kirill
09:48
created

State   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 27
loc 27
ccs 0
cts 17
cp 0
rs 10
c 1
b 0
f 0
wmc 4
lcom 1
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A getStatus() 4 4 1
A getOrderId() 4 4 1
A getPaymentId() 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 declare(strict_types=1);
2
3
namespace Personnage\Tinkoff\SDK\Response;
4
5
use function Personnage\Tinkoff\SDK\message_get_body;
6
use Psr\Http\Message\ResponseInterface;
7
8 View Code Duplication
final class State extends Response
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...
9
{
10
    use HasPsr7Response;
11
12
    private $body;
13
14
    public function __construct(ResponseInterface $response)
15
    {
16
        $this->body = message_get_body($response);
17
        $this->setPsr7Response($response);
18
    }
19
20
    public function getStatus()
21
    {
22
        return $this->body['Status'] ?? null;
23
    }
24
25
    public function getOrderId()
26
    {
27
        return $this->body['OrderId'] ?? null;
28
    }
29
30
    public function getPaymentId()
31
    {
32
        return $this->body['PaymentId'] ?? null;
33
    }
34
}
35