| Total Complexity | 4 |
| Total Lines | 63 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class Error |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @Serializer\XmlAttribute |
||
| 16 | * @Serializer\SerializedName("type") |
||
| 17 | * @Serializer\Type("string") |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | private $type; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @Serializer\XmlAttribute |
||
| 25 | * @Serializer\SerializedName("code") |
||
| 26 | * @Serializer\Type("string") |
||
| 27 | * |
||
| 28 | * @var string|null |
||
| 29 | */ |
||
| 30 | private $code; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @Serializer\XmlValue |
||
| 34 | * @Serializer\Type("string") |
||
| 35 | * |
||
| 36 | * @var string |
||
| 37 | */ |
||
| 38 | private $message; |
||
| 39 | |||
| 40 | 12 | public function __construct(string $type, string $message, ?string $code = null) |
|
| 41 | { |
||
| 42 | 12 | $this->type = $type; |
|
| 43 | 12 | $this->code = $code; |
|
| 44 | 12 | $this->message = $message; |
|
| 45 | 12 | } |
|
| 46 | |||
| 47 | /** |
||
| 48 | * Return the error type. Normally the exception name. |
||
| 49 | * |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | 3 | public function getType(): string |
|
| 53 | { |
||
| 54 | 3 | return $this->type; |
|
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Return an error code, if present. |
||
| 59 | * |
||
| 60 | * @return string|null |
||
| 61 | */ |
||
| 62 | 3 | public function getCode(): ?string |
|
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Returns the message for this error. |
||
| 69 | * |
||
| 70 | * @return string |
||
| 71 | */ |
||
| 72 | 5 | public function getMessage(): string |
|
| 77 |