Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
30 | 2 | public static function getRules($ruleFile = null) |
|
31 | { |
||
32 | 2 | if ($ruleFile === null) { |
|
33 | 1 | $ruleFile = __DIR__.'/'.self::RULE_FILE; |
|
34 | 1 | } |
|
35 | |||
36 | 2 | if (!file_exists($ruleFile) || !is_readable($ruleFile)) { |
|
37 | 1 | throw new \Exception(sprintf('Rule file %s is not found or not readable', $ruleFile)); |
|
38 | } |
||
39 | |||
40 | 1 | $rules = Yaml::parse(file_get_contents($ruleFile)); |
|
41 | |||
42 | 1 | return new RuleConfig($rules); |
|
43 | } |
||
44 | } |
||
45 |