| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 19 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 32 | public function resolveLocation(ContentInfo $contentInfo): Location  | 
            ||
| 33 |     { | 
            ||
| 34 |         try { | 
            ||
| 35 | $location = $this->locationService->loadLocation($contentInfo->mainLocationId);  | 
            ||
| 36 |         } catch (NotFoundException | UnauthorizedException $e) { | 
            ||
| 37 | // try different locations if main location is not accessible for the user  | 
            ||
| 38 | $locations = $this->locationService->loadLocations($contentInfo);  | 
            ||
| 39 |             if (empty($locations)) { | 
            ||
| 40 | throw $e;  | 
            ||
| 41 | }  | 
            ||
| 42 | |||
| 43 | // foreach to keep forward compatibility with a type of returned loadLocations() result  | 
            ||
| 44 |             foreach ($locations as $location) { | 
            ||
| 45 | return $location;  | 
            ||
| 46 | }  | 
            ||
| 47 | }  | 
            ||
| 48 | |||
| 49 | return $location;  | 
            ||
| 50 | }  | 
            ||
| 51 | }  | 
            ||
| 52 |