| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 35 | public function getMeta(Identity $user): array |
||
| 36 | { |
||
| 37 | try { |
||
| 38 | $home = Cache::remember( |
||
| 39 | sprintf('home_%d', $user->get('id')), |
||
| 40 | function () { |
||
| 41 | $client = ApiClientProvider::getApiClient(); |
||
| 42 | |||
| 43 | return $client->get('/home'); |
||
| 44 | } |
||
| 45 | ); |
||
| 46 | } catch (BEditaClientException $e) { |
||
| 47 | // Something bad happened. Returning an empty array instead. |
||
| 48 | // The exception is being caught _outside_ of `Cache::remember()` to avoid caching the fallback. |
||
| 49 | $this->log($e->getMessage(), LogLevel::ERROR); |
||
| 50 | |||
| 51 | return []; |
||
| 52 | } |
||
| 53 | |||
| 54 | return (array)Hash::get($home, 'meta'); |
||
| 55 | } |
||
| 57 |