Completed
Pull Request — master (#17)
by
unknown
01:17
created

Error   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 45
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getCode() 0 4 1
A getMessage() 0 4 1
A toArray() 0 7 1
1
<?php declare(strict_types=1);
2
3
namespace h4kuna\Ares;
4
5
class Error
6
{
7
	
8
	/** @var int */
9
	protected $code;
10
	
11
	/** @var string */
12
	protected $message;
13
14
	/**
15
	 * Error constructor.
16
	 * @param int $code
17
	 * @param string $message
18
	 */
19
	public function __construct(int $code, string $message)
20
	{
21
		$this->code = $code;
22
		$this->message = $message;
23
	}
24
25
	/**
26
	 * @return int
27
	 */
28
	public function getCode(): int
29
	{
30
		return $this->code;
31
	}
32
33
	/**
34
	 * @return string
35
	 */
36
	public function getMessage(): string
37
	{
38
		return $this->message;
39
	}
40
41
	public function toArray(): array
42
	{
43
		return [
44
			'code' => $this->code,
45
			'message' => $this->message,
46
		];
47
	}
48
	
49
}
50