Completed
Push — main ( 775b27...35d503 )
by mohsen
14s queued 13s
created

WebServer   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 5
eloc 9
c 4
b 0
f 0
dl 0
loc 23
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A checkNginx() 0 4 2
A checkApache() 0 4 2
A check() 0 7 1
1
<?php
2
3
namespace MohsenAbrishami\Stethoscope\Services;
4
5
class WebServer implements ServiceInterface
6
{
7
    public $webServerStatuses = [];
8
9
    public function check(): array
10
    {
11
        $this->checkNginx();
12
13
        $this->checkApache();
14
15
        return $this->webServerStatuses;
16
    }
17
18
    protected function checkNginx()
19
    {
20
        $this->webServerStatuses['nginx'] = config('stethoscope.available_web_servers.nginx') ?
21
            exec('systemctl is-active nginx') : null;
22
    }
23
24
    protected function checkApache()
25
    {
26
        $this->webServerStatuses['apache'] = config('stethoscope.available_web_servers.apache2') ?
27
            exec('systemctl is-active apache2.service') : null;
28
    }
29
}
30