Issues (22)

src/Services/Network.php (1 issue)

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
The variable $networkConnction seems to be defined by a foreach iteration on line 12. Are you sure the iterator is never empty, otherwise this variable is not defined?
Loading history...
23
    }
24
}
25