AbstractParser::getErrorMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
namespace MetaHydrator\Parser;
3
4
use MetaHydrator\Exception\ParsingException;
5
6
/**
7
 * An abstract validator with configurable error message.
8
 *
9
 * Class AbstractParser
10
 * @package MetaHydrator\Parser
11
 */
12
abstract class AbstractParser implements ParserInterface
13
{
14
    /** @var mixed */
15
    private $errorMessage;
16
    /** @return mixed */
17
    public function getErrorMessage() { return $this->errorMessage; }
18
19
    /**
20
     * AbstractValidator constructor.
21
     * @param mixed $errorMessage
22
     */
23
    public function __construct($errorMessage = "")
24
    {
25
        $this->errorMessage = $errorMessage;
26
    }
27
28
    /**
29
     * @throws ParsingException
30
     */
31
    protected function throw()
32
    {
33
        throw new ParsingException($this->errorMessage);
34
    }
35
}
36