@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | var_dump($res[4][7]['person_lastname']); // prints, e.g., "Brezina", which is the lastname of person 7, who teaches in lesson 4 |
49 | 49 | |
50 | 50 | // CASE 4; map: lesson ID => map: person ID => user function result |
51 | -$res = $rel->map('lesson_id')->map('person_id')->col(function ($row) { |
|
52 | - return ($row['person_schedabbr'] ? : mb_substr($row['person_lastname'], 0, 4)); |
|
51 | +$res = $rel->map('lesson_id')->map('person_id')->col(function($row) { |
|
52 | + return ($row['person_schedabbr'] ?: mb_substr($row['person_lastname'], 0, 4)); |
|
53 | 53 | }); |
54 | 54 | var_dump($res[4][7]); // prints, e.g., "Brez", which is the scheduling abbreviation of person 7, who teaches in lesson 4 |
55 | 55 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | var_dump($res[4]['actual'][1]); // prints, e.g., 89, which is the ID of the second actual teacher returned for lesson 4 |
71 | 71 | |
72 | 72 | // CASE 9; map: lesson ID parity => list: row only with the lesson ID and person ID |
73 | -$res = $rel->multimap(function ($row) { return $row['lesson_id'] % 2; })->project(['lesson_id', 'person_id']); |
|
73 | +$res = $rel->multimap(function($row) { return $row['lesson_id'] % 2; })->project(['lesson_id', 'person_id']); |
|
74 | 74 | var_dump($res[1][5]['lesson_id']); // prints, e.g., 631, which is the ID of the sixth returned lesson with odd ID |
75 | 75 | |
76 | 76 | // CASE 10; map: lesson ID => list of rows with the "actual" scheduling status: person ID |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | var_dump($res[4][1]); // prints, e.g., 89, which is the ID of the second actual teacher returned for lesson 4 |
79 | 79 | |
80 | 80 | // CASE 11; map: lesson ID => list of rows with odd person ID: person ID |
81 | -$res = $rel->multimap('lesson_id')->filter(function ($row) { return $row['person_id'] % 2 == 1; })->col('person_id'); |
|
81 | +$res = $rel->multimap('lesson_id')->filter(function($row) { return $row['person_id'] % 2 == 1; })->col('person_id'); |
|
82 | 82 | var_dump($res[4][1]); // prints, e.g., 97, which is the ID of the second teacher returned for lesson 4 who has their person ID odd |
83 | 83 | |
84 | 84 | // CASE 12; equivalent to CASE 11, but specifying the filter sooner, yet on the application side |
85 | -$res = $rel->filter(function ($row) { return $row['person_id'] % 2 == 1; })->multimap('lesson_id')->col('person_id'); |
|
85 | +$res = $rel->filter(function($row) { return $row['person_id'] % 2 == 1; })->multimap('lesson_id')->col('person_id'); |
|
86 | 86 | |
87 | 87 | // CASE 13: equivalent to CASE 11, but with the filter applied to the single-column projection |
88 | -$res = $rel->multimap('lesson_id')->col('person_id')->filter(function ($personId) { return $personId % 2 == 1; }); |
|
88 | +$res = $rel->multimap('lesson_id')->col('person_id')->filter(function($personId) { return $personId % 2 == 1; }); |
|
89 | 89 | |
90 | 90 | // CASE 14; list: row only with the lesson_id and person_id attributes |
91 | 91 | $res = $rel->project(['lesson_id', 'person_id']); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | preg_match_all('~(-?\d+(?:\.\d+)?)([YMDW])~', $str, $matches, PREG_SET_ORDER); |
246 | 246 | static $units = ['Y' => self::YEAR, 'M' => self::MONTH, 'D' => self::DAY, 'W' => self::WEEK]; |
247 | 247 | foreach ($matches as $m) { |
248 | - $parts[ $units[$m[2]] ] = (float)$m[1]; |
|
248 | + $parts[$units[$m[2]]] = (float)$m[1]; |
|
249 | 249 | } |
250 | 250 | return $parts; |
251 | 251 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | preg_match_all('~(-?\d+(?:\.\d+)?)([HMS])~', $str, $matches, PREG_SET_ORDER, $offset); |
279 | 279 | static $units = ['H' => self::HOUR, 'M' => self::MINUTE, 'S' => self::SECOND]; |
280 | 280 | foreach ($matches as $m) { |
281 | - $parts[ $units[$m[2]] ] = (float)$m[1]; |
|
281 | + $parts[$units[$m[2]]] = (float)$m[1]; |
|
282 | 282 | } |
283 | 283 | return $parts; |
284 | 284 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | $addYears = 0; |
66 | 66 | $dateCreateInput = preg_replace_callback( |
67 | 67 | '~\d{5,}(?=-|\d{4})~', // supports both dash-separated date parts and also the form without dash separators |
68 | - function ($y) use (&$addYears) { |
|
68 | + function($y) use (&$addYears) { |
|
69 | 69 | $res = $y[0] % 10000; |
70 | 70 | $addYears = $y[0] - $res; |
71 | 71 | return $res; |
@@ -44,7 +44,7 @@ |
||
44 | 44 | self::GIGABYTE => [self::BYTE, 1024 * 1024 * 1024], |
45 | 45 | self::TERABYTE => [self::BYTE, 1024 * 1024 * 1024 * 1024], |
46 | 46 | |
47 | - self::MILLISECOND => [self::SECOND, 1/1000], |
|
47 | + self::MILLISECOND => [self::SECOND, 1 / 1000], |
|
48 | 48 | self::SECOND => [self::SECOND, 1], |
49 | 49 | self::MINUTE => [self::SECOND, 60], |
50 | 50 | self::HOUR => [self::SECOND, 60 * 60], |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $addYears = 0; |
39 | 39 | $dateCreateInput = preg_replace_callback( |
40 | 40 | '~\d{5,}(?=(?:-\d+-\d+|\d{4})(?:\s+|T)\d)~', // supports both dash-separated date/time parts and also the form without dash separators |
41 | - function ($y) use (&$addYears) { |
|
41 | + function($y) use (&$addYears) { |
|
42 | 42 | $res = $y[0] % 10000; |
43 | 43 | $addYears = $y[0] - $res; |
44 | 44 | return $res; |
@@ -287,7 +287,7 @@ |
||
287 | 287 | $i += $lzsLen - 1; |
288 | 288 | continue; |
289 | 289 | } |
290 | - $result .= (ltrim($fields[$i], '0') ? : '0'); |
|
290 | + $result .= (ltrim($fields[$i], '0') ?: '0'); |
|
291 | 291 | } |
292 | 292 | if ($lzsStart + $lzsLen == 8) { |
293 | 293 | $result .= ':'; |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | public function uniq($hasher = null, $comparator = null) |
62 | 62 | { |
63 | 63 | if ($hasher === null) { |
64 | - $hasher = new CallbackValueHasher(function ($value) { |
|
64 | + $hasher = new CallbackValueHasher(function($value) { |
|
65 | 65 | return (is_int($value) || is_string($value) ? $value : serialize($value)); |
66 | 66 | }); |
67 | 67 | } |
68 | 68 | elseif ($hasher === 1) { |
69 | - $hasher = new CallbackValueHasher(function ($value) { |
|
69 | + $hasher = new CallbackValueHasher(function($value) { |
|
70 | 70 | return 1; |
71 | 71 | }); |
72 | 72 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | if ($comparator === null) { |
78 | - $comparator = new CallbackValueComparator(function ($a, $b) { |
|
78 | + $comparator = new CallbackValueComparator(function($a, $b) { |
|
79 | 79 | if (is_object($a) && is_object($b) && $a instanceof IComparable) { |
80 | 80 | return $a->equals($b); |
81 | 81 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | $hashTable = []; |
92 | - return new FilteredColumn($this, function ($value) use ($hasher, $comparator, &$hashTable) { |
|
92 | + return new FilteredColumn($this, function($value) use ($hasher, $comparator, &$hashTable) { |
|
93 | 93 | $h = $hasher->hash($value); |
94 | 94 | if (!isset($hashTable[$h])) { |
95 | 95 | $hashTable[$h] = [$value]; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function assoc($col1, $col2, ...$moreCols) |
108 | 108 | { |
109 | 109 | return $this->assocImpl( |
110 | - function () { |
|
110 | + function() { |
|
111 | 111 | // FIXME: depending on the data type of the keys, either use an array-based implementation, or an object hashing implementation |
112 | 112 | return new ArrayValueMap(); |
113 | 113 | }, |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function map($mappingCol, ...$moreMappingCols) |
119 | 119 | { |
120 | 120 | return $this->assocImpl( |
121 | - function () { |
|
121 | + function() { |
|
122 | 122 | // FIXME: depending on the data type of the keys, either use an array-based implementation, or an object hashing implementation |
123 | 123 | return new ArrayTupleMap(); |
124 | 124 | }, |
@@ -36,7 +36,7 @@ |
||
36 | 36 | * @param string|string[] one or more names of parameters the cached values of which to invalidate; |
37 | 37 | * <tt>null</tt> invalidates everything |
38 | 38 | */ |
39 | - function invalidateCache($paramName = null);; |
|
39 | + function invalidateCache($paramName = null); ; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Disables caching of values of a given configuration parameter, or of any configuration parameter. |