Passed
Pull Request — master (#41)
by Thomas
02:55
created

NotValid::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
crap 1
1
<?php
2
3
namespace ORM\Dbal\Error;
4
5
use ORM\Dbal\Column;
6
use ORM\Dbal\Error;
7
8
class NotValid extends Error
9
{
10
    const ERROR_CODE = 'NOT_VALID';
11
12
    /** @var string */
13
    protected $message = 'Value not valid for %column% (Caused by: %previous%)';
14
15
    /**
16
     * NotValid constructor
17
     *
18
     * @param Column $column The column that got a not valid error
19
     * @param Error  $previous The error from validate
20
     */
21 3
    public function __construct(Column $column, Error $previous)
22
    {
23 3
        parent::__construct([
24 3
            'column' => $column->name,
25 3
            'previous' => $previous->getMessage()
26 3
        ], null, null, $previous);
27 3
    }
28
}
29