Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/fact/chart/PhabricatorChartInterval.php
12256 views
1
<?php
2
3
final class PhabricatorChartInterval
4
extends Phobject {
5
6
private $min;
7
private $max;
8
9
public function __construct($min, $max) {
10
$this->min = $min;
11
$this->max = $max;
12
}
13
14
public static function newFromIntervalList(array $intervals) {
15
$min = null;
16
$max = null;
17
foreach ($intervals as $interval) {
18
if ($interval === null) {
19
continue;
20
}
21
22
$interval_min = $interval->getMin();
23
if ($interval_min !== null) {
24
if ($min === null) {
25
$min = $interval_min;
26
} else {
27
$min = min($min, $interval_min);
28
}
29
}
30
31
$interval_max = $interval->getMax();
32
if ($interval_max !== null) {
33
if ($max === null) {
34
$max = $interval_max;
35
} else {
36
$max = max($max, $interval_max);
37
}
38
}
39
}
40
41
return new self($min, $max);
42
}
43
44
public function setMin($min) {
45
$this->min = $min;
46
return $this;
47
}
48
49
public function getMin() {
50
return $this->min;
51
}
52
53
public function setMax($max) {
54
$this->max = $max;
55
return $this;
56
}
57
58
public function getMax() {
59
return $this->max;
60
}
61
62
}
63
64