UnknownResponseException::getResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
/**
3
 * This file is part of graze/gigya-client
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/gigya-client/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/gigya-client
12
 */
13
14
namespace Graze\Gigya\Exception;
15
16
use Exception;
17
use Psr\Http\Message\ResponseInterface as GuzzleResponseInterface;
18
19
class UnknownResponseException extends Exception
20
{
21
    /**
22
     * @var GuzzleResponseInterface
23
     */
24
    private $response;
25
26
    /**
27
     * @param GuzzleResponseInterface|null $response
28
     * @param string                       $message
29
     * @param Exception|null               $previous
30
     */
31 4
    public function __construct(GuzzleResponseInterface $response = null, $message = '', Exception $previous = null)
32
    {
33 4
        $message = "The contents of the response could not be determined. {$message}" .
34 4
            ($response ? "\n Body:\n" . $response->getBody()->getContents() : '');
35
36 4
        $this->response = $response;
37
38 4
        parent::__construct($message, 0, $previous);
39 4
    }
40
41
    /**
42
     * @return GuzzleResponseInterface
43
     */
44 1
    public function getResponse()
45
    {
46 1
        return $this->response;
47
    }
48
}
49