Completed
Push — master ( 3a74af...b425be )
by Matthias
13s
created

RequestException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: gorkalaucirica
5
 * Date: 09/07/14
6
 * Time: 12:33
7
 */
8
9
namespace SolutionDrive\HipchatAPIv2Client\Exception;
10
11
12
class RequestException extends \Exception
13
{
14
    protected $responseCode;
15
16
    protected $message;
17
18
    protected $type;
19
20
    /**
21
     * Request exception constructor
22
     *
23
     * @param string $response json_decoded array with the error response given by the server
24
     */
25
    public function __construct($response)
26
    {
27
        $error = $response['error'];
28
        $this->responseCode = $error['code'];
29
        $this->message = $error['message'];
30
        $this->type = $error['type'];
31
    }
32
33
    /**
34
     * Returns responseCode
35
     *
36
     * @return mixed
37
     */
38
    public function getResponseCode()
39
    {
40
        return $this->responseCode;
41
    }
42
43
    /**
44
     * Returns type
45
     *
46
     * @return mixed
47
     */
48
    public function getType()
49
    {
50
        return $this->type;
51
    }
52
}
53