Conditions | 5 |
Paths | 5 |
Total Lines | 29 |
Code Lines | 19 |
Lines | 14 |
Ratio | 48.28 % |
Tests | 12 |
CRAP Score | 6.2499 |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | 1 | protected function validate(Context $context) |
|
29 | { |
||
30 | 1 | if ($context->language !== $this->rule->language) { |
|
31 | 1 | $this->setValid(false); |
|
32 | |||
33 | 1 | return false; |
|
34 | } |
||
35 | |||
36 | 1 | if (!$context->has($this->name)) { |
|
37 | 1 | View Code Duplication | if (!$this->rule->validator->validate($context)) { |
38 | 1 | $this->setValid(false); |
|
39 | 1 | } else { |
|
40 | $this->_valid = true; |
||
41 | $this->_end->_valid = false; |
||
42 | } |
||
43 | 1 | View Code Duplication | } else { |
44 | if (!$this->rule->validator->validate($context, [ $this->name => Validator::CONTEXT_IN ])) { |
||
45 | $this->setValid(false); |
||
46 | } else { |
||
47 | $this->_valid = false; |
||
48 | $this->_end->_valid = true; |
||
49 | } |
||
50 | } |
||
51 | |||
52 | 1 | $this->_end->_start = false; |
|
53 | 1 | $this->_end = false; |
|
54 | |||
55 | 1 | return true; |
|
56 | } |
||
57 | } |
||
58 |