Response::parseResponseData()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 6
rs 10
cc 2
nc 2
nop 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