ParsingFailedException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * (c) Steve Nebes <[email protected]>.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
declare(strict_types=1);
10
11
namespace SN\HtmlSanitizer\Exception;
12
13
use SN\HtmlSanitizer\Parser\ParserInterface;
14
15
/**
16
 * @author Steve Nebes <[email protected]>
17
 *
18
 * @final
19
 */
20
class ParsingFailedException extends \InvalidArgumentException
21
{
22
    /**
23
     * @var ParserInterface
24
     */
25
    private $parser;
26
27
    /**
28
     * Default values.
29
     *
30
     * @param ParserInterface $parser
31
     * @param \Throwable|null $previous
32
     */
33 1
    public function __construct(ParserInterface $parser, \Throwable $previous = null)
34
    {
35 1
        parent::__construct('HTML parsing failed using parser '.\get_class($parser), 0, $previous);
36
37 1
        $this->parser = $parser;
38 1
    }
39
40
    /**
41
     * @return ParserInterface
42
     */
43 1
    public function getParser(): ParserInterface
44
    {
45 1
        return $this->parser;
46
    }
47
}
48