Validation   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 9
c 1
b 0
f 0
dl 0
loc 19
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDetails() 0 3 1
A __construct() 0 8 3
1
<?php
2
namespace Akkroo\Error;
3
4
class Validation extends Generic
5
{
6
    protected $message = 'Validation Error';
7
    protected $details = [];
8
9 2
    public function __construct($message = '', $code = 400, array $body = [])
10
    {
11 2
        parent::__construct($message, $code, $body);
12 2
        if (!empty($body['data']['error']['message'])) {
13 2
            $this->message = $body['data']['error']['message'];
14
        }
15 2
        if (!empty($body['data']['error']['data'])) {
16 2
            $this->details = $body['data']['error']['data'];
17
        }
18 2
    }
19
20 2
    public function getDetails()
21
    {
22 2
        return $this->details;
23
    }
24
}
25