Conditions | 4 |
Paths | 6 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
26 | public function checkCount(Question $question) |
||
27 | { |
||
28 | $answers = $question->getAnswers(); |
||
29 | $countTrueAnswers = 0; |
||
30 | |||
31 | foreach ($answers as $item) { |
||
32 | $item->getCorrectly() ? $countTrueAnswers++ : null; |
||
33 | } |
||
34 | |||
35 | if ($countTrueAnswers > 3) { |
||
36 | $this->session->getFlashBag()->add('notice', |
||
37 | 'You have to add not more than 3 true answers for question '.$question->getTextQuestion()); |
||
38 | |||
39 | return false; |
||
40 | } |
||
41 | |||
42 | return true; |
||
43 | } |
||
44 | |||
46 |