getExpectationFailedExceptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/*
3
 * This file is part of project-quality-inspector.
4
 *
5
 * (c) Alexandre GESLIN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace ProjectQualityInspector\Exception;
12
13
use ProjectQualityInspector\Rule\RuleInterface;
14
use Exception;
15
16
/**
17
 * Class RuleViolationException
18
 *
19
*@package ProjectQualityInspector\Exception
20
 */
21
class RuleViolationException extends \RuntimeException
22
{
23
24
    /**
25
     * @var RuleInterface
26
     */
27
    protected $rule;
28
29
    /**
30
     * @var ExpectationFailedException[]
31
     */
32
    protected $expectationFailedExceptions;
33
34
    /**
35
     * RuleViolationException constructor.
36
     *
37
     * @param RuleInterface $rule
38
     * @param array $expectationFailedExceptions
39
     * @param int $code
40
     * @param Exception|null $previous
41
     */
42
    public function __construct(RuleInterface $rule, array $expectationFailedExceptions, $code = 0, Exception $previous = null)
43
    {
44
        parent::__construct($rule::getRuleName() . ': KO', $code, $previous);
45
46
        $this->rule = $rule;
47
        $this->expectationFailedExceptions = $expectationFailedExceptions;
48
    }
49
50
    /**
51
     * @return RuleInterface
52
     */
53
    public function getRule()
54
    {
55
        return $this->rule;
56
    }
57
58
    /**
59
     * @return ExpectationFailedException[]
60
     */
61
    public function getExpectationFailedExceptions()
62
    {
63
        return $this->expectationFailedExceptions;
64
    }
65
}