Uptime   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 12
rs 10
c 1
b 0
f 1
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A read() 0 9 1
1
<?php
2
3
namespace Uptime\Runtime\OpenVMS;
4
5
use Uptime\Runtime\RuntimeInterface;
6
7
class Uptime implements RuntimeInterface
8
{
9
    public function read($command = 'sysctl kern.boottime')
10
    {
11
        preg_match_all('#(?<=Uptime).+#', shell_exec($command), $matches);
12
        $raw_uptime = $matches[0][0];
13
        list($d, $raw_time) = explode(' ', trim($raw_uptime));
14
        list($h, $i, $s) = explode(':', $raw_time);
15
16
        return ($d * 24 * 60 * 60) + ($h * 60 * 60) + ($i * 60) + $s;
17
    }
18
}
19