Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
ConformiteOrganisationService | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
getOrderedConformites | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
getOrderedReponse | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace App\Domain\Registry\Service; |
4 | |
5 | use App\Domain\Registry\Model\ConformiteOrganisation\Conformite; |
6 | use App\Domain\Registry\Model\ConformiteOrganisation\Evaluation; |
7 | |
8 | class ConformiteOrganisationService |
9 | { |
10 | public static function getOrderedConformites(Evaluation $evaluation): array |
11 | { |
12 | $conformites = \iterable_to_array($evaluation->getConformites()); |
13 | usort($conformites, function ($a, $b) { |
14 | return $a->getProcessus()->getPosition() > $b->getProcessus()->getPosition() ? 1 : -1; |
15 | }); |
16 | |
17 | return $conformites; |
18 | } |
19 | |
20 | public static function getOrderedReponse(Conformite $conformite) |
21 | { |
22 | $reponses = \iterable_to_array($conformite->getReponses()); |
23 | usort($reponses, function ($a, $b) { |
24 | return $a->getQuestion()->getPosition() > $b->getQuestion()->getPosition() ? 1 : -1; |
25 | }); |
26 | |
27 | return $reponses; |
28 | } |
29 | } |