PayboxException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getResponse() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Nexylan packages.
5
 *
6
 * (c) Nexylan SAS <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Nexy\PayboxDirect\Exception;
13
14
use Nexy\PayboxDirect\Response\ResponseInterface;
15
16
/**
17
 * @author Sullivan Senechal <[email protected]>
18
 */
19
final class PayboxException extends \RuntimeException
20
{
21
    /**
22
     * @var ResponseInterface
23
     */
24
    private $response;
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function __construct(ResponseInterface $response, \Exception $previous = null)
30
    {
31
        parent::__construct('', $response->getCode(), $previous);
32
33
        $this->message = sprintf('%05d: %s', $response->getCode(), $response->getComment());
34
        $this->response = $response;
35
    }
36
37
    /**
38
     * @return ResponseInterface
39
     */
40
    public function getResponse()
41
    {
42
        return $this->response;
43
    }
44
}
45