@@ -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 |
@@ -42,10 +42,10 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $intvg = new IntervalGraph(); |
| 44 | 44 | $intvg->getFlattener() |
| 45 | - ->setSubstractStep(static function (DateTime $bound) { |
|
| 45 | + ->setSubstractStep(static function(DateTime $bound) { |
|
| 46 | 46 | return (clone $bound)->sub(new DateInterval('PT1S')); |
| 47 | 47 | }) |
| 48 | - ->setAddStep(static function (DateTime $bound) { |
|
| 48 | + ->setAddStep(static function(DateTime $bound) { |
|
| 49 | 49 | return (clone $bound)->add(new DateInterval('PT1S')); |
| 50 | 50 | }); |
| 51 | 51 | if (isset($intervals)) { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | D::intv(6, 9, 2 / 10), |
| 40 | 40 | ]; |
| 41 | 41 | |
| 42 | -$longDateFormat = static function (DateTime $bound) { |
|
| 42 | +$longDateFormat = static function(DateTime $bound) { |
|
| 43 | 43 | return $bound->format('Y-m-d H:i:s'); |
| 44 | 44 | }; |
| 45 | 45 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | |
| 52 | 52 | // An aggregate function for arrays representing fractions with the same denominator. |
| 53 | -$agg = static function ($a, $b) { |
|
| 53 | +$agg = static function($a, $b) { |
|
| 54 | 54 | if ($a === null && $b === null) { |
| 55 | 55 | return null; |
| 56 | 56 | } |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | }; |
| 59 | 59 | |
| 60 | 60 | // A toNumeric function… |
| 61 | -$toNumeric = static function ($a) { |
|
| 61 | +$toNumeric = static function($a) { |
|
| 62 | 62 | return $a === null ? null : (int)($a[0] / $a[1] * 100); |
| 63 | 63 | }; |
| 64 | 64 | |
| 65 | 65 | // A toString function… |
| 66 | -$toString = static function ($a) { |
|
| 66 | +$toString = static function($a) { |
|
| 67 | 67 | return $a === null ? null : ($a[0] . '/' . $a[1]); |
| 68 | 68 | }; |
| 69 | 69 | |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | /* |
| 87 | 87 | * TRUNCATED INTERVALS |
| 88 | 88 | */ |
| 89 | -$intv1 = (DateTime::createFromFormat('Y-m-d', '2019-01-01'))->add(new DateInterval('PT60H'))->setTime(0,0); |
|
| 90 | -$intv2 = (DateTime::createFromFormat('Y-m-d', '2019-01-01'))->add(new DateInterval('PT108H'))->setTime(23,59,59); |
|
| 89 | +$intv1 = (DateTime::createFromFormat('Y-m-d', '2019-01-01'))->add(new DateInterval('PT60H'))->setTime(0, 0); |
|
| 90 | +$intv2 = (DateTime::createFromFormat('Y-m-d', '2019-01-01'))->add(new DateInterval('PT108H'))->setTime(23, 59, 59); |
|
| 91 | 91 | $intv3 = (clone $intv2)->add(new DateInterval('PT60H')); |
| 92 | 92 | |
| 93 | 93 | $truncated = ($fractim->setIntervals(Truncator::truncate($fractions, $intv1, $intv2))) |
@@ -189,14 +189,14 @@ discard block |
||
| 189 | 189 | <?php |
| 190 | 190 | |
| 191 | 191 | /* ADDITIONAL INFORMATION */ |
| 192 | -$toString2 = static function ($a) { |
|
| 192 | +$toString2 = static function($a) { |
|
| 193 | 193 | if ($a === null) { |
| 194 | 194 | return null; |
| 195 | 195 | } |
| 196 | 196 | return $a[0] . '/' . $a[1] . ($a[2] ? '*' : ''); |
| 197 | 197 | }; |
| 198 | 198 | |
| 199 | -$agg2 = static function ($a, $b) { |
|
| 199 | +$agg2 = static function($a, $b) { |
|
| 200 | 200 | if ($a === null && $b === null) { |
| 201 | 201 | return null; |
| 202 | 202 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | |
| 40 | 40 | public function __construct() |
| 41 | 41 | { |
| 42 | - $this->aggregateFunction = static function ($a, $b) { |
|
| 42 | + $this->aggregateFunction = static function($a, $b) { |
|
| 43 | 43 | if ($a === null && $b === null) { |
| 44 | 44 | return null; |
| 45 | 45 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | |
| 40 | 40 | public function __construct() |
| 41 | 41 | { |
| 42 | - $this->aggregateFunction = static function ($a, $b) { |
|
| 42 | + $this->aggregateFunction = static function($a, $b) { |
|
| 43 | 43 | if ($a === null && $b === null) { |
| 44 | 44 | return null; |
| 45 | 45 | } |
@@ -64,19 +64,19 @@ discard block |
||
| 64 | 64 | $this->setIntervals($intervals); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $this->boundToNumeric = static function (DateTime $bound) { |
|
| 67 | + $this->boundToNumeric = static function(DateTime $bound) { |
|
| 68 | 68 | return $bound->getTimestamp(); |
| 69 | 69 | }; |
| 70 | 70 | |
| 71 | - $this->boundToString = static function (DateTime $bound) { |
|
| 71 | + $this->boundToString = static function(DateTime $bound) { |
|
| 72 | 72 | return $bound->format('Y-m-d'); |
| 73 | 73 | }; |
| 74 | 74 | |
| 75 | - $this->valueToNumeric = static function ($v) { |
|
| 75 | + $this->valueToNumeric = static function($v) { |
|
| 76 | 76 | return $v === null ? null : (int)($v * 100); |
| 77 | 77 | }; |
| 78 | 78 | |
| 79 | - $this->valueToString = static function ($v) { |
|
| 79 | + $this->valueToString = static function($v) { |
|
| 80 | 80 | return $v === null ? null : ($v * 100 . '%'); |
| 81 | 81 | }; |
| 82 | 82 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function &getFlatIntervals(): array |
| 227 | 227 | { |
| 228 | - if (empty($this->flattened)){ |
|
| 228 | + if (empty($this->flattened)) { |
|
| 229 | 229 | $this->flattened = $this->flattener->flatten($this->intervals); |
| 230 | 230 | } |
| 231 | 231 | return $this->flattened; |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | public function &getAggregatedIntervals(): array |
| 244 | 244 | { |
| 245 | - if (empty($this->aggregated)){ |
|
| 245 | + if (empty($this->aggregated)) { |
|
| 246 | 246 | $this->aggregated = $this->aggregator->aggregate( |
| 247 | 247 | $this->getFlatIntervals(), |
| 248 | 248 | $this->intervals |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | // Order by low bound. |
| 277 | 277 | uasort( |
| 278 | 278 | $numVals, |
| 279 | - static function (array $i1, array $i2) { |
|
| 279 | + static function(array $i1, array $i2) { |
|
| 280 | 280 | return ($i1[0] < $i2[0]) ? -1 : 1; |
| 281 | 281 | } |
| 282 | 282 | ); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | // Order by high bound. |
| 296 | 296 | uasort( |
| 297 | 297 | $numVals, |
| 298 | - static function (array $i1, array $i2) { |
|
| 298 | + static function(array $i1, array $i2) { |
|
| 299 | 299 | return ($i1[1] < $i2[1]) ? -1 : 1; |
| 300 | 300 | } |
| 301 | 301 | ); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | !empty($originalValues) ? $this->palette->getColor($colval) : 50, // Interval color |
| 336 | 336 | ($this->boundToString)($lowBound), // Interval start string value |
| 337 | 337 | ($this->boundToString)($highBound), // Interval end string value |
| 338 | - !empty($originalValues) ? $strval : null,// Interval string value |
|
| 338 | + !empty($originalValues) ? $strval : null, // Interval string value |
|
| 339 | 339 | ]; |
| 340 | 340 | } |
| 341 | 341 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | // serialized as correctly ordered JSON arrays. |
| 346 | 346 | usort( |
| 347 | 347 | $numVals, |
| 348 | - static function ($i) { |
|
| 348 | + static function($i) { |
|
| 349 | 349 | return count($i) === 2 ? 1 : -1; |
| 350 | 350 | } |
| 351 | 351 | ); |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | // Order by high bound. |
| 379 | 379 | uasort( |
| 380 | 380 | $numericIntervals, |
| 381 | - static function (array $i1, array $i2) { |
|
| 381 | + static function(array $i1, array $i2) { |
|
| 382 | 382 | return ($i1[1] < $i2[1]) ? -1 : 1; |
| 383 | 383 | } |
| 384 | 384 | ); |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | // serialized as correctly ordered JSON arrays. |
| 406 | 406 | usort( |
| 407 | 407 | $numericIntervals, |
| 408 | - static function ($i) { |
|
| 408 | + static function($i) { |
|
| 409 | 409 | return !is_array($i) ? 1 : -1; |
| 410 | 410 | } |
| 411 | 411 | ); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | // Order the bounds. |
| 76 | 76 | usort( |
| 77 | 77 | $bounds, |
| 78 | - static function (array $d1, array $d2) { |
|
| 78 | + static function(array $d1, array $d2) { |
|
| 79 | 79 | return ($d1[0] < $d2[0]) ? -1 : 1; |
| 80 | 80 | } |
| 81 | 81 | ); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | $discreteValues = array_filter( |
| 98 | 98 | $intervals, |
| 99 | - static function ($interval) { |
|
| 99 | + static function($interval) { |
|
| 100 | 100 | return $interval[0] === $interval[1]; |
| 101 | 101 | } |
| 102 | 102 | ); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | // If the current bound is the same as the next, which happens when multiple intervals |
| 134 | 134 | // begin or end at the same time, skip it. |
| 135 | 135 | // Use weak comparison since the type could be an object like DateTime. |
| 136 | - if ($curBoundValue == $nextBoundValue){ |
|
| 136 | + if ($curBoundValue == $nextBoundValue) { |
|
| 137 | 137 | continue; |
| 138 | 138 | } |
| 139 | 139 | |