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

WebServer::checkApache()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 4
rs 10
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