Completed
Push — master ( 034dff...628390 )
by
unknown
10:02
created

AbstractValidationException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 29
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A toArray() 0 12 2
1
<?php
2
3
namespace MediaMonks\RestApi\Exception;
4
5
abstract class AbstractValidationException extends AbstractException implements ExceptionInterface, FieldExceptionInterface
6
{
7
    /**
8
     * AbstractFieldsException constructor.
9
     * @param string $message
10
     * @param string $code
11
     */
12 5
    public function __construct($message, $code)
13
    {
14 5
        $this->message = $message;
15 5
        $this->code = $code;
16 5
    }
17
18
    /**
19
     * @return array
20
     */
21 3
    public function toArray()
22
    {
23
        $return = [
24 3
            'code'    => $this->getCode(),
25 3
            'message' => $this->getMessage(),
26 3
        ];
27 3
        foreach ($this->getFields() as $field) {
28 1
            $return['fields'][] = $field->toArray();
29 3
        }
30
31 3
        return $return;
32
    }
33
}
34