1 | <?php |
||
21 | abstract class AbstractRule implements RuleInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $config; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $baseDir; |
||
32 | |||
33 | /** |
||
34 | * @var array |
||
35 | */ |
||
36 | protected $assertions = []; |
||
37 | |||
38 | /** |
||
39 | * @inheritdoc |
||
40 | */ |
||
41 | public function __construct(array $config, $baseDir) |
||
46 | |||
47 | /** |
||
48 | * @inheritdoc |
||
49 | */ |
||
50 | public function getConfig() |
||
54 | |||
55 | /** |
||
56 | * @return string |
||
57 | */ |
||
58 | public static function getRuleName() |
||
67 | |||
68 | /** |
||
69 | * @return array |
||
70 | */ |
||
71 | public function getAssertions() |
||
75 | |||
76 | /** |
||
77 | * @param array|string $raw |
||
78 | * @return array|string |
||
79 | */ |
||
80 | protected function getValue($raw) |
||
88 | |||
89 | /** |
||
90 | * @param array|string $raw |
||
91 | * @return array|string|null |
||
92 | */ |
||
93 | protected function getReason($raw) |
||
101 | |||
102 | /** |
||
103 | * @param array $expectationFailedExceptions |
||
104 | * |
||
105 | * @throws RuleViolationException |
||
106 | */ |
||
107 | protected function throwRuleViolationException(array $expectationFailedExceptions) |
||
111 | |||
112 | /** |
||
113 | * @param string $name |
||
114 | * @param array $failures |
||
115 | * @param integer $assertions |
||
116 | * @param integer $time |
||
117 | * @param array $errors |
||
118 | */ |
||
119 | protected function addAssertion($name, array $failures = [], $assertions = 1, $time = 0, array $errors = []) |
||
137 | } |