UniqueConflict::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 10
cc 3
nc 4
nop 3
crap 3
1
<?php
2
namespace Akkroo\Error;
3
4
class UniqueConflict extends Generic
5
{
6
    protected $message = 'Unique Conflict';
7
    protected $details = [];
8
9 1
    public function __construct($message = '', $code = 400, array $body = [])
10
    {
11 1
        parent::__construct($message, $code, $body);
12 1
        if (!empty($body['data']['message'])) {
13 1
            $this->message = $body['data']['message'];
14
        }
15 1
        if (!empty($body['data']['details']['errors'])) {
16 1
            $this->details = $body['data']['details']['errors'];
17
        }
18 1
    }
19
20 1
    public function getDetails()
21
    {
22 1
        return $this->details;
23
    }
24
}
25