Completed
Push — master ( 4445cd...13b287 )
by Victor
01:51
created
index.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 $overlapped3 = new IntervalGraph([$base, $date3]);
26 26
 $overlapped = new IntervalGraph([$base, $date1, $date2, $date3]);
27 27
 
28
-$withNull1 = new IntervalGraph([$base, [new DateTime('today'), new DateTime('today + 3 days'), 4 / 10],]);
29
-$withNull2 = new IntervalGraph([$base, [new DateTime('today + 1 day'), new DateTime('today + 2 days')],]);
30
-$withNull3 = new IntervalGraph([$base, [new DateTime('today + 2 day'), new DateTime('today + 3 days'), 4 / 10],]);
31
-$withNull4 = new IntervalGraph([$base, [new DateTime('today + 4 day'), new DateTime('today + 5 days'), 5 / 10],]);
28
+$withNull1 = new IntervalGraph([$base, [new DateTime('today'), new DateTime('today + 3 days'), 4 / 10], ]);
29
+$withNull2 = new IntervalGraph([$base, [new DateTime('today + 1 day'), new DateTime('today + 2 days')], ]);
30
+$withNull3 = new IntervalGraph([$base, [new DateTime('today + 2 day'), new DateTime('today + 3 days'), 4 / 10], ]);
31
+$withNull4 = new IntervalGraph([$base, [new DateTime('today + 4 day'), new DateTime('today + 5 days'), 5 / 10], ]);
32 32
 $withNullIntervals = new IntervalGraph([
33 33
     [$today, new DateTime('today + 3 days'), 4 / 10],
34 34
     [new DateTime('today + 1 day'), new DateTime('today + 2 days')],
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     [new DateTime('today + 6 day'), new DateTime('today + 9 days'), 2 / 10],
47 47
 ];
48 48
 
49
-$longDateFormat = function (\DateTime $bound){
49
+$longDateFormat = function(\DateTime $bound) {
50 50
     return $bound->format('Y-m-d H:i:s');
51 51
 };
52 52
 
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
  */
58 58
 
59 59
 // An aggregate function for arrays representing fractions with the same denominator.
60
-$agg = function ($a, $b) {
60
+$agg = function($a, $b) {
61 61
     if ($a === null && $b === null) return null;
62 62
     return [$a[0] + $b[0], $b[1]];
63 63
 };
64 64
 
65 65
 // A toNumeric function…
66
-$toNumeric = function ($a) {return $a === null ? null : (int)($a[0] / $a[1] * 100);};
66
+$toNumeric = function($a) {return $a === null ? null : (int)($a[0] / $a[1] * 100); };
67 67
 
68 68
 // A toString function…
69
-$toString = function ($a) {return $a === null ? null : ($a[0] . '/' . $a[1]);};
69
+$toString = function($a) {return $a === null ? null : ($a[0] . '/' . $a[1]); };
70 70
 
71 71
 $fractions = [
72 72
     [$today, new DateTime('today + 3 days'), [2, 10]],
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,9 @@
 block discarded – undo
58 58
 
59 59
 // An aggregate function for arrays representing fractions with the same denominator.
60 60
 $agg = function ($a, $b) {
61
-    if ($a === null && $b === null) return null;
61
+    if ($a === null && $b === null) {
62
+        return null;
63
+    }
62 64
     return [$a[0] + $b[0], $b[1]];
63 65
 };
64 66
 
Please login to merge, or discard this patch.
src/template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <div class='intvg'>
2 2
     <?php foreach ($vs as $k => $v) : ?>
3
-        <?php if (count($v) === 2 ): // Isolated date.?>
3
+        <?php if (count($v) === 2): // Isolated date.?>
4 4
             <div class='bar bar-date bar<?= $k; ?>' style='left:<?= $v[0] ?>%;' data-title='<?= $v[1] ?>'></div>
5 5
         <?php else: ?>
6 6
             <div class='bar bar-intv bar<?= $k; ?>'
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,11 @@
 block discarded – undo
2 2
     <?php foreach ($vs as $k => $v) : ?>
3 3
         <?php if (count($v) === 2 ): // Isolated date.?>
4 4
             <div class='bar bar-date bar<?= $k; ?>' style='left:<?= $v[0] ?>%;' data-title='<?= $v[1] ?>'></div>
5
-        <?php else: ?>
6
-            <div class='bar bar-intv bar<?= $k; ?>'
5
+        <?php else {
6
+    : ?>
7
+            <div class='bar bar-intv bar<?= $k;
8
+}
9
+?>'
7 10
                  style='left:<?= $v[0] ?>%;right:<?= $v[1] ?>%;background-color:<?= $v[2] ?>'
8 11
                  data-title="<?= $v[3] . ' ➔ ' . $v[4] . (isset($v[5]) ? ' : ' . $v[5] : '') ?>">
9 12
             </div>
Please login to merge, or discard this patch.
src/Palette.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     public function setColors(array $palette)
51 51
     {
52
-        usort($palette, function ($p1, $p2) {
52
+        usort($palette, function($p1, $p2) {
53 53
             return $p2[0] - $p1[0];
54 54
         });
55 55
         $this->palette = $palette;
Please login to merge, or discard this patch.
src/IntervalGraph.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
             $this->setIntervals($intervals);
55 55
         }
56 56
 
57
-        $this->boundToNumeric = function (DateTime $bound) {
57
+        $this->boundToNumeric = function(DateTime $bound) {
58 58
             return $bound->getTimestamp();
59 59
         };
60 60
 
61
-        $this->boundToString = function (DateTime $bound) {
61
+        $this->boundToString = function(DateTime $bound) {
62 62
             return $bound->format("Y-m-d");
63 63
         };
64 64
 
65
-        $this->valueToNumeric = function ($v) {
65
+        $this->valueToNumeric = function($v) {
66 66
             return $v === null ? null : (int)($v * 100);
67 67
         };
68 68
 
69
-        $this->valueToString = function ($v) {
69
+        $this->valueToString = function($v) {
70 70
             return $v === null ? null : ($v * 100 . '%');
71 71
         };
72 72
 
73
-        $this->aggregateFunction = function ($a, $b) {
73
+        $this->aggregateFunction = function($a, $b) {
74 74
             if ($a === null && $b === null) {
75 75
                 return null;
76 76
             }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         }
225 225
 
226 226
         // Order by low bound.
227
-        uasort($numVals, function (array $i1, array $i2) {
227
+        uasort($numVals, function(array $i1, array $i2) {
228 228
             return ($i1[0] < $i2[0]) ? -1 : 1;
229 229
         });
230 230
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         }
241 241
 
242 242
         // Order by high bound.
243
-        uasort($numVals, function (array $i1, array $i2) {
243
+        uasort($numVals, function(array $i1, array $i2) {
244 244
             return ($i1[1] < $i2[1]) ? -1 : 1;
245 245
         });
246 246
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                     !empty($originalValues) ? $this->palette->getColor($colval) : 50, // Interval color
284 284
                     ($this->boundToString)($lowBound), // Interval start string value
285 285
                     ($this->boundToString)($highBound), // Interval end string value
286
-                    !empty($originalValues) ? ($strval) : null,// Interval string value
286
+                    !empty($originalValues) ? ($strval) : null, // Interval string value
287 287
                 ];
288 288
             }
289 289
         }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         // Put discrete values at the end and reset indices.
292 292
         // Reseting indices ensures the processed values are
293 293
         // serialized as correctly ordered JSON arrays.
294
-        usort($numVals, function ($i) {
294
+        usort($numVals, function($i) {
295 295
             return count($i) === 2 ? 1 : -1;
296 296
         });
297 297
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
         );
318 318
 
319 319
         // Remove empty interval generated when two or more intervals share a common bound.
320
-        $adjacentIntervals = array_values(array_filter($adjacentIntervals, function ($i) {
320
+        $adjacentIntervals = array_values(array_filter($adjacentIntervals, function($i) {
321 321
             // Use weak comparison in case of object typed bounds.
322 322
             return $i[0] != $i[1];
323 323
         }));
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
      */
343 343
     public static function extractDiscreteValues(array &$intervals)
344 344
     {
345
-        $discreteValues = array_filter($intervals, function ($interval) {
345
+        $discreteValues = array_filter($intervals, function($interval) {
346 346
             return $interval[0] === $interval[1];
347 347
         });
348 348
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
             $bounds[] = [$interval[1], isset($interval[2]) ? $interval[2] : null, '-', $key];
370 370
         }
371 371
         // Order the bounds.
372
-        usort($bounds, function (array $d1, array $d2) {
372
+        usort($bounds, function(array $d1, array $d2) {
373 373
             return ($d1[0] < $d2[0]) ? -1 : 1;
374 374
         });
375 375
         return $bounds;
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
         }
451 451
 
452 452
         // Order by high bound.
453
-        uasort($numericIntervals, function (array $i1, array $i2) {
453
+        uasort($numericIntervals, function(array $i1, array $i2) {
454 454
             return ($i1[1] < $i2[1]) ? -1 : 1;
455 455
         });
456 456
         
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         // Put discrete values at the end and reset indices.
480 480
         // Reseting indices ensures the processed values are
481 481
         // serialized as correctly ordered JSON arrays.
482
-        usort($numericIntervals, function ($i) {
482
+        usort($numericIntervals, function($i) {
483 483
             return !is_array($i) ? 1 : -1;
484 484
         });
485 485
 
Please login to merge, or discard this patch.