| Conditions | 3 |
| Paths | 9 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function getAttendees($eventUrl) |
||
| 37 | { |
||
| 38 | if (strpos($eventUrl, 'meetup.com') === false) { |
||
| 39 | return []; |
||
| 40 | } |
||
| 41 | |||
| 42 | try { |
||
| 43 | $parts = explode('/', $eventUrl); |
||
| 44 | $meetupId = $parts[count($parts) - 2]; |
||
| 45 | $uri = sprintf(self::API_URL, $meetupId, $this->key); |
||
| 46 | $request = new Request('GET', $uri); |
||
| 47 | $response = $this->httpClient->send($request); |
||
| 48 | $data = \GuzzleHttp\json_decode($response->getBody()->getContents()); |
||
| 49 | $attendees = $data->results; |
||
| 50 | shuffle($attendees); |
||
| 51 | |||
| 52 | return $attendees; |
||
| 53 | } catch (\Exception $e) { |
||
| 54 | return []; |
||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 |