1 | <?php |
||
2 | |||
3 | namespace MohsenAbrishami\Stethoscope\Services; |
||
4 | |||
5 | use Exception; |
||
6 | use Illuminate\Support\Facades\Http; |
||
7 | |||
8 | class Network implements ServiceInterface |
||
9 | { |
||
10 | public function check(): string |
||
11 | { |
||
12 | foreach(config('stethoscope.network_monitor_url') as $networkMonitorURL){ |
||
13 | try { |
||
14 | Http::get($networkMonitorURL)->successful(); |
||
15 | $networkConnction = 'connected'; |
||
16 | break; |
||
17 | } catch (Exception $e) { |
||
18 | $networkConnction = 'disconnected'; |
||
19 | } |
||
20 | } |
||
21 | |||
22 | return $networkConnction; |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||
23 | } |
||
24 | } |
||
25 |