Error   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 3
1
<?php
2
3
namespace ORM\Dbal;
4
5
use ORM\EntityManager;
6
use ORM\Exception;
7
8
/**
9
 * Validation Error
10
 *
11
 * @package ORM\Dbal
12
 * @author  Thomas Flori <[email protected]>
13
 */
14
class Error extends Exception
15
{
16
    const ERROR_CODE = 'UNKNOWN';
17
18
    /** @var string */
19
    protected $message = 'ERROR(%code%) occurred';
20
21
    /** @var string */
22
    protected $errorCode;
23
24
    /**
25
     * Error constructor
26
     *
27
     * @param array $params
28
     * @param null  $code
29
     * @param null  $message
30
     * @param Error $previous
31
     */
32 40
    public function __construct(array $params = [], $code = null, $message = null, Error $previous = null)
33
    {
34 40
        $this->message = $message ?: $this->message;
35 40
        $this->code    = $code ?: static::ERROR_CODE;
36
37 40
        $params['code'] = $this->code;
38
39 40
        $namer = EntityManager::getInstance()->getNamer();
40
41 40
        parent::__construct($namer->substitute($this->message, $params), 0, $previous);
42 40
    }
43
}
44