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

PayboxException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 4
Bugs 0 Features 2
Metric Value
wmc 2
c 4
b 0
f 2
lcom 0
cbo 1
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getResponse() 0 4 1
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