ErrorField::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
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