Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
TimeRange
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getDuration
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Wikimedia\WRStats;
4
5/**
6 * A time range
7 *
8 * @since 1.39
9 */
10class TimeRange {
11    /** @var float|int UNIX start time */
12    public $start;
13    /** @var float|int UNIX end time */
14    public $end;
15
16    /**
17     * @internal
18     *
19     * @param float|int $start
20     * @param float|int $end
21     */
22    public function __construct( $start, $end ) {
23        $this->start = $start;
24        $this->end = $end;
25    }
26
27    /**
28     * Get the duration of the time range in seconds.
29     *
30     * @return float|int
31     */
32    public function getDuration() {
33        return $this->end - $this->start;
34    }
35}