Passed
Push — master ( 0658f3...f968a7 )
by y
02:18
created

AsanaError   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 17
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getCurlInfo() 0 2 1
1
<?php
2
3
namespace Helix\Asana\Api;
4
5
use RuntimeException;
6
7
/**
8
 * A cURL or API error.
9
 *
10
 * Codes less than `400` are cURL errors.
11
 *
12
 * The API class returns `null` on `404`, it doesn't throw.
13
 *
14
 * @see https://developers.asana.com/docs/errors
15
 */
16
class AsanaError extends RuntimeException {
17
18
    /**
19
     * @var array
20
     */
21
    protected $curlInfo;
22
23
    public function __construct (int $code, string $message, array $curlInfo) {
24
        parent::__construct($message, $code);
25
        $this->curlInfo = $curlInfo;
26
    }
27
28
    /**
29
     * @return array
30
     */
31
    public function getCurlInfo (): array {
32
        return $this->curlInfo;
33
    }
34
}