| Conditions | 3 |
| Paths | 2 |
| Total Lines | 29 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 21 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 5 | public function send($notifiable, $item) |
|
| 19 | { |
||
| 20 | 5 | $message = (new MailMessage()) |
|
| 21 | 5 | ->from( |
|
| 22 | 5 | config('firewall.notifications.from.name'), |
|
| 23 | 5 | config('firewall.notifications.from.icon_emoji') |
|
| 24 | ) |
||
| 25 | 5 | ->subject(config('firewall.notifications.message.request_count.title')) |
|
| 26 | 5 | ->line(sprintf( |
|
| 27 | 5 | config('firewall.notifications.message.request_count.message'), |
|
| 28 | 5 | $item['requestCount'], |
|
| 29 | 5 | $item['firstRequestAt']->diffInSeconds(Carbon::now()), |
|
| 30 | 5 | (string) $item['firstRequestAt'] |
|
| 31 | )) |
||
| 32 | 5 | ->line(config('firewall.notifications.message.uri.title').': '.$item['server']['REQUEST_URI']) |
|
| 33 | 5 | ->line(config('firewall.notifications.message.user_agent.title').': '.$item['userAgent']) |
|
| 34 | 5 | ->line(config('firewall.notifications.message.blacklisted.title').': '.$item['isBlacklisted'] ? 'YES' : 'NO'); |
|
| 35 | |||
| 36 | 5 | $geo = $this->makeGeolocation($item); |
|
| 37 | |||
| 38 | 5 | if ($item['geoIp']) { |
|
| 39 | 3 | $message->line(config('firewall.notifications.message.geolocation.title')." - Latitude : {$geo['Latitude']}"); |
|
| 40 | 3 | $message->line(config('firewall.notifications.message.geolocation.title')." - Longitude : {$geo['Longitude']}"); |
|
| 41 | 3 | $message->line(config('firewall.notifications.message.geolocation.title')." - Country code : {$geo['Country code']}"); |
|
| 42 | 3 | $message->line(config('firewall.notifications.message.geolocation.title')." - Country name : {$geo['Country name']}"); |
|
| 43 | } |
||
| 44 | |||
| 45 | 5 | return $message; |
|
| 46 | } |
||
| 47 | } |
||
| 48 |