Passed
Branch feature-validator (55f4e3)
by Thomas
03:27
created

NotValid   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 27
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getPrevious() 0 4 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
    /** @var Error */
16
    protected $previous;
17
18 2
    public function __construct(Column $column, Error $previous)
19
    {
20 2
        parent::__construct();
21
22 2
        $this->previous = $previous;
23 2
        $this->params['column'] = $column->name;
24 2
        $this->params['previous'] = $previous->getMessage();
25 2
    }
26
27
    /**
28
     * @return Error
29
     */
30 1
    public function getPrevious()
31
    {
32 1
        return $this->previous;
33
    }
34
}
35