ValidatorException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of indragunawan/rest-service package.
5
 *
6
 * (c) Indra Gunawan <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace IndraGunawan\RestService\Exception;
13
14
class ValidatorException extends \RuntimeException
15
{
16
    /**
17
     * @var string
18
     */
19
    private $field;
20
21
    /**
22
     * @var string
23
     */
24
    private $errorMessage;
25
26
    /**
27
     * @param string          $field
28
     * @param string          $errorMessage
29
     * @param \Exception|null $prev
30
     */
31 2
    public function __construct($field, $errorMessage, \Exception $prev = null)
32
    {
33 2
        $this->field = $field;
34 2
        $this->errorMessage = $errorMessage;
35
36 2
        parent::__construct($field.' : '.$errorMessage, 0, $prev);
37 2
    }
38
39 1
    public function getField()
40
    {
41 1
        return $this->field;
42
    }
43
44 1
    public function getErrorMessage()
45
    {
46 1
        return $this->errorMessage;
47
    }
48
}
49