BaseUnionCloudException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 5
1
<?php
2
/**
3
 * Base exception thrown by this package
4
 */
5
6
namespace Twigger\UnionCloud\API\Exception;
7
8
use Throwable;
9
10
/**
11
 * Class BaseUnionCloudException
12
 *
13
 * @package Twigger\UnionCloud\API\Exceptions
14
 */
15
class BaseUnionCloudException extends \Exception {
16
17
    /**
18
     * The unioncloud response code
19
     *
20
     * If UnionCloud contains a response code, it'll
21
     * be here. This should correspond to an error
22
     * message in the API documentation, allowing
23
     * for easier debugging.
24
     *
25
     * @var int $unionCloudCode
26
     */
27
    public $unionCloudCode = 0;
28
29
    /**
30
     * The unioncloud message
31
     *
32
     * This is the message from UnionCloud
33
     *
34
     * @var string $unionCloudCode
35
     */
36
    public $unionCloudMessage = '';
37
38
    /**
39
     * BaseUnionCloudException constructor.
40
     *
41
     * Pass the error to \Exception
42
     *
43
     * @param string $message
44
     * @param int $code
45
     * @param Throwable|null $previous
46
     * @param int $unionCloudCode
47
     * @param string $unionCloudMessage
48
     */
49
    public function __construct($message = "Something went wrong with the UnionCloud API", $code = 500, Throwable $previous = null, $unionCloudCode = 0, $unionCloudMessage = '')
50
    {
51
        $this->unionCloudCode = $unionCloudCode;
52
        $this->unionCloudMessage = $unionCloudMessage;
53
        parent::__construct($message, $code, $previous);
54
    }
55
56
    /**
57
     * Retrieve the UnionCloud response code
58
     *
59
     * @return int|null
60
     */
61
    public function getUnionCloudCode()
62
    {
63
        return $this->unionCloudCode;
64
    }
65
}