Response   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 2
b 0
f 0
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parseResponseData() 0 6 2
A getStatus() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cakasim\Payone\Sdk\Api\Message;
6
7
/**
8
 * The implementation of the API response interface.
9
 *
10
 * @author Fabian Böttcher <[email protected]>
11
 * @since 0.1.0
12
 */
13
class Response extends AbstractMessage implements ResponseInterface
14
{
15
    /**
16
     * Returns the status of the response.
17
     *
18
     * @return string|null The status or null if not set.
19
     */
20
    public function getStatus(): ?string
21
    {
22
        return $this->getParameter('status');
23
    }
24
25
    /**
26
     * @inheritDoc
27
     */
28
    public function parseResponseData($data): void
29
    {
30
        if (is_array($data)) {
31
            $this->parameters = $data;
32
        } else {
33
            throw new \RuntimeException(sprintf("Cannot parse response data of type '%s'.", gettype($data)));
34
        }
35
    }
36
}
37