@@ -60,23 +60,23 @@ discard block |
||
60 | 60 | $this->setIntervals($intervals); |
61 | 61 | } |
62 | 62 | |
63 | - $this->boundToNumeric = static function (DateTime $bound) { |
|
63 | + $this->boundToNumeric = static function(DateTime $bound) { |
|
64 | 64 | return $bound->getTimestamp(); |
65 | 65 | }; |
66 | 66 | |
67 | - $this->boundToString = static function (DateTime $bound) { |
|
67 | + $this->boundToString = static function(DateTime $bound) { |
|
68 | 68 | return $bound->format('Y-m-d'); |
69 | 69 | }; |
70 | 70 | |
71 | - $this->valueToNumeric = static function ($v) { |
|
71 | + $this->valueToNumeric = static function($v) { |
|
72 | 72 | return $v === null ? null : (int)($v * 100); |
73 | 73 | }; |
74 | 74 | |
75 | - $this->valueToString = static function ($v) { |
|
75 | + $this->valueToString = static function($v) { |
|
76 | 76 | return $v === null ? null : ($v * 100 . '%'); |
77 | 77 | }; |
78 | 78 | |
79 | - $this->aggregateFunction = static function ($a, $b) { |
|
79 | + $this->aggregateFunction = static function($a, $b) { |
|
80 | 80 | if ($a === null && $b === null) { |
81 | 81 | return null; |
82 | 82 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | // Order by low bound. |
259 | - uasort($numVals, static function (array $i1, array $i2) { |
|
259 | + uasort($numVals, static function(array $i1, array $i2) { |
|
260 | 260 | return ($i1[0] < $i2[0]) ? -1 : 1; |
261 | 261 | }); |
262 | 262 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | // Order by high bound. |
275 | - uasort($numVals, static function (array $i1, array $i2) { |
|
275 | + uasort($numVals, static function(array $i1, array $i2) { |
|
276 | 276 | return ($i1[1] < $i2[1]) ? -1 : 1; |
277 | 277 | }); |
278 | 278 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | !empty($originalValues) ? $this->palette->getColor($colval) : 50, // Interval color |
316 | 316 | ($this->boundToString)($lowBound), // Interval start string value |
317 | 317 | ($this->boundToString)($highBound), // Interval end string value |
318 | - !empty($originalValues) ? $strval : null,// Interval string value |
|
318 | + !empty($originalValues) ? $strval : null, // Interval string value |
|
319 | 319 | ]; |
320 | 320 | } |
321 | 321 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | // Put discrete values at the end and reset indices. |
324 | 324 | // Reseting indices ensures the processed values are |
325 | 325 | // serialized as correctly ordered JSON arrays. |
326 | - usort($numVals, static function ($i) { |
|
326 | + usort($numVals, static function($i) { |
|
327 | 327 | return count($i) === 2 ? 1 : -1; |
328 | 328 | }); |
329 | 329 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | $adjacentIntervals = $this->calcAdjacentIntervals($signedBounds); |
346 | 346 | |
347 | 347 | // Remove empty interval generated when two or more intervals share a common bound. |
348 | - $adjacentIntervals = array_values(array_filter($adjacentIntervals, static function ($i) { |
|
348 | + $adjacentIntervals = array_values(array_filter($adjacentIntervals, static function($i) { |
|
349 | 349 | // Use weak comparison in case of object typed bounds. |
350 | 350 | return $i[0] != $i[1]; |
351 | 351 | })); |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | */ |
371 | 371 | public static function extractDiscreteValues(array &$intervals): array |
372 | 372 | { |
373 | - $discreteValues = array_filter($intervals, static function ($interval) { |
|
373 | + $discreteValues = array_filter($intervals, static function($interval) { |
|
374 | 374 | return $interval[0] === $interval[1]; |
375 | 375 | }); |
376 | 376 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | $bounds[] = [$interval[0], '+', true, $key, $interval[2] ?? null]; |
408 | 408 | } |
409 | 409 | // Order the bounds. |
410 | - usort($bounds, static function (array $d1, array $d2) { |
|
410 | + usort($bounds, static function(array $d1, array $d2) { |
|
411 | 411 | return ($d1[0] < $d2[0]) ? -1 : 1; |
412 | 412 | }); |
413 | 413 | return $bounds; |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | } |
513 | 513 | |
514 | 514 | // Order by high bound. |
515 | - uasort($numericIntervals, static function (array $i1, array $i2) { |
|
515 | + uasort($numericIntervals, static function(array $i1, array $i2) { |
|
516 | 516 | return ($i1[1] < $i2[1]) ? -1 : 1; |
517 | 517 | }); |
518 | 518 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | // Put discrete values at the end and reset indices. |
542 | 542 | // Reseting indices ensures the processed values are |
543 | 543 | // serialized as correctly ordered JSON arrays. |
544 | - usort($numericIntervals, static function ($i) { |
|
544 | + usort($numericIntervals, static function($i) { |
|
545 | 545 | return !is_array($i) ? 1 : -1; |
546 | 546 | }); |
547 | 547 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public static function intv(int $start, int $end, $value = null): array |
27 | 27 | { |
28 | 28 | $start = new DateTime("today + $start days"); |
29 | - $end = (new DateTime("today + $end days"))->setTime(23,59,59); |
|
29 | + $end = (new DateTime("today + $end days"))->setTime(23, 59, 59); |
|
30 | 30 | return [$start, $end, $value]; |
31 | 31 | } |
32 | 32 | |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | public static function intvg($intervals = null): IntervalGraph |
40 | 40 | { |
41 | 41 | $intvg = new IntervalGraph(); |
42 | - $intvg->setSubstractStep(static function (DateTime $bound) { |
|
42 | + $intvg->setSubstractStep(static function(DateTime $bound) { |
|
43 | 43 | return (clone $bound)->sub(new DateInterval('PT1S')); |
44 | 44 | }) |
45 | - ->setAddStep(static function (DateTime $bound) { |
|
45 | + ->setAddStep(static function(DateTime $bound) { |
|
46 | 46 | return (clone $bound)->add(new DateInterval('PT1S')); |
47 | 47 | }); |
48 | 48 | if (isset($intervals)) { |
@@ -4,7 +4,7 @@ |
||
4 | 4 | <?php if (count($v) === 2): // Isolated date.?> |
5 | 5 | <div class='bar bar-date bar<?= $k ?>' style='left:<?= $v[0] . ((int)$v[0] !== 0 ? '%' : '') ?>;' |
6 | 6 | data-title='<?= $v[1] ?>'></div> |
7 | - <?php else: ?> |
|
7 | + <?php else : ?> |
|
8 | 8 | <div class='bar bar-intv bar<?= $k ?> <?= $v[2] ?> <?= strpos($v[5], '*') ? 'striped' : '' ?>' |
9 | 9 | style='left:<?= $v[0] . ((int)$v[0] !== 0 ? '%' : '') ?>;right:<?= $v[1] . ((int)$v[1] !== 0 ? '%' : '') ?>' |
10 | 10 | data-title="<?= $v[3] . ' ➔ ' . $v[4] . (isset($v[5]) ? ' : ' . $v[5] : '') ?>"> |
@@ -4,11 +4,14 @@ |
||
4 | 4 | <?php if (count($v) === 2): // Isolated date.?> |
5 | 5 | <div class='bar bar-date bar<?= $k ?>' style='left:<?= $v[0] . ((int)$v[0] !== 0 ? '%' : '') ?>;' |
6 | 6 | data-title='<?= $v[1] ?>'></div> |
7 | - <?php else: ?> |
|
7 | + <?php else { |
|
8 | + : ?> |
|
8 | 9 | <div class='bar bar-intv bar<?= $k ?> <?= $v[2] ?> <?= strpos($v[5], '*') ? 'striped' : '' ?>' |
9 | 10 | style='left:<?= $v[0] . ((int)$v[0] !== 0 ? '%' : '') ?>;right:<?= $v[1] . ((int)$v[1] !== 0 ? '%' : '') ?>' |
10 | 11 | data-title="<?= $v[3] . ' ➔ ' . $v[4] . (isset($v[5]) ? ' : ' . $v[5] : '') ?>"> |
11 | 12 | </div> |
12 | - <?php endif; ?> |
|
13 | + <?php endif; |
|
14 | +} |
|
15 | +?> |
|
13 | 16 | <?php endforeach; ?> |
14 | 17 | </div> |
15 | 18 | \ No newline at end of file |