Network   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
eloc 9
c 3
b 1
f 0
dl 0
loc 15
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A check() 0 13 3
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