ParsingFailedException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 26
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getParser() 0 3 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