Uptime   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A read() 0 13 2
1
<?php
2
3
namespace Uptime\Runtime\Windows;
4
5
use Uptime\Runtime\RuntimeInterface;
6
7
use DateTime;
8
9
class Uptime implements RuntimeInterface
10
{
11
12
    public function read(RuntimeInterface $boottime = null)
13
    {
14
        $boottime = $boottime ? $boottime  : new Boottime();
15
        $now = new DateTime('now');
16
        $interval = $now->diff( new DateTime( '@' . $boottime->read() ) );
17
18
        return ($interval->y * 365 * 24 * 60 * 60) +
19
               ($interval->m * 30 * 24 * 60 * 60) +
20
               ($interval->d * 24 * 60 * 60) +
21
               ($interval->h * 60 * 60) +
22
               ($interval->i * 60) +
23
               ($interval->s);
24
    }
25
}
26