ErrorField   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 31
ccs 5
cts 5
cp 1
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getMessage() 0 3 1
A getField() 0 3 1
A toArray() 0 6 1
A __construct() 0 6 1
A getCode() 0 3 1
1
<?php
2
3
namespace MediaMonks\RestApi\Exception;
4
5
class ErrorField implements ExceptionInterface
6
{
7
    public function __construct(
8
        private string $field,
9
        private string $code,
10
        private string $message
11
    )
12
    {
13
    }
14
15
    public function getField(): string
16
    {
17
        return $this->field;
18
    }
19
20
    public function getMessage(): string
21
    {
22
        return $this->message;
23
    }
24
25
    public function getCode(): string
26
    {
27
        return $this->code;
28 3
    }
29
30 3
    public function toArray(): array
31 3
    {
32 3
        return [
33 3
            'field' => $this->getField(),
34
            'code' => $this->getCode(),
35
            'message' => $this->getMessage(),
36
        ];
37
    }
38
}
39