| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 14 | 
| Code Lines | 7 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1);  | 
            ||
| 28 | public function enrich(string $json): string  | 
            ||
| 29 |     { | 
            ||
| 30 | $registrationAsArray = json_decode($json, true);  | 
            ||
| 31 | |||
| 32 | $registrationAsArray['id'] = $this->uuidFactory->uuid4()->toString();  | 
            ||
| 33 | |||
| 34 |         for ($index = 0; $index < count($registrationAsArray['aliases']); $index++) { | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 35 | $registrationAsArray['aliases'][$index]['id'] = $this->uuidFactory->uuid4()->toString();  | 
            ||
| 36 | }  | 
            ||
| 37 | |||
| 38 | $registrationAsArray['user']['id'] = $this->uuidFactory->uuid4()->toString();  | 
            ||
| 39 | $registrationAsArray['user']['role'] = Role::CONTACT;  | 
            ||
| 40 | |||
| 41 | return json_encode($registrationAsArray);  | 
            ||
| 42 | }  | 
            ||
| 44 | 
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: