Completed
Push — master ( 740e5d...aaff7d )
by Sullivan
02:35
created

PayboxException::getResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Nexy\PayboxDirect\Exception;
4
5
use Nexy\PayboxDirect\Response\ResponseInterface;
6
7
/**
8
 * @author Sullivan Senechal <[email protected]>
9
 */
10
final class PayboxException extends \RuntimeException
11
{
12
    /**
13
     * @var ResponseInterface
14
     */
15
    private $response;
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function __construct(ResponseInterface $response, \Exception $previous = null)
21
    {
22
        parent::__construct('', $response->getCode(), $previous);
23
24
        $this->message = sprintf('%05d: %s', $response->getCode(), $response->getComment());
25
        $this->response = $response;
26
    }
27
28
    /**
29
     * @return ResponseInterface
30
     */
31
    public function getResponse()
32
    {
33
        return $this->response;
34
    }
35
}
36