| Conditions | 5 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 1 | public function getSkillEnhancements(SkillEnhancementEnum $enhancementType): ?array |
|
| 19 | { |
||
| 20 | 1 | if ($this->enhancements === null) { |
|
| 21 | 1 | $this->enhancements = []; |
|
| 22 | |||
| 23 | 1 | $enhancements = $this->skillEnhancementRepository->findAll(); |
|
| 24 | 1 | foreach ($enhancements as $enhancement) { |
|
| 25 | 1 | $type = $enhancement->getType()->value; |
|
| 26 | 1 | $position = $enhancement->getPosition()->value; |
|
| 27 | 1 | if (!array_key_exists($type, $this->enhancements)) { |
|
| 28 | 1 | $this->enhancements[$type] = []; |
|
| 29 | } |
||
| 30 | |||
| 31 | 1 | $this->enhancements[$type][$position] = $enhancement; |
|
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | 1 | if (!array_key_exists($enhancementType->value, $this->enhancements)) { |
|
| 36 | 1 | return null; |
|
| 37 | } |
||
| 38 | |||
| 39 | 1 | return $this->enhancements[$enhancementType->value]; |
|
| 40 | } |
||
| 42 |