ErrorResponseException::getCustomerMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cakasim\Payone\Sdk\Api\Client;
6
7
use Exception;
8
9
/**
10
 * Exception which is thrown because of an
11
 * error response from the PAYONE API.
12
 *
13
 * @author Fabian Böttcher <[email protected]>
14
 * @since 0.1.0
15
 */
16
class ErrorResponseException extends Exception implements ErrorResponseExceptionInterface
17
{
18
    /**
19
     * @var string The customer message.
20
     */
21
    protected $customerMessage;
22
23
    /**
24
     * Constructs the exception from
25
     * PAYONE API error information.
26
     *
27
     * @param int $code The PAYONE API error code.
28
     * @param string $message The internal PAYONE API message.
29
     * @param string $customerMessage The customer PAYONE API message.
30
     */
31
    public function __construct(int $code, string $message, string $customerMessage)
32
    {
33
        parent::__construct($message, $code, null);
34
        $this->customerMessage = $customerMessage;
35
    }
36
37
    /**
38
     * @inheritDoc
39
     */
40
    public function getCustomerMessage(): string
41
    {
42
        return $this->customerMessage;
43
    }
44
}
45