@@ -18,6 +18,9 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | trait RelationMacros |
| 20 | 20 | { |
| 21 | + /** |
|
| 22 | + * @param string[] $columns |
|
| 23 | + */ |
|
| 21 | 24 | abstract public function project($columns): IRelation; |
| 22 | 25 | |
| 23 | 26 | abstract public function tuple(int $offset = 0): ITuple; |
@@ -73,6 +76,9 @@ discard block |
||
| 73 | 76 | return $this->tuple($tupleOffset)->value($colOffsetOrNameOrEvaluator); |
| 74 | 77 | } |
| 75 | 78 | |
| 79 | + /** |
|
| 80 | + * @param IColumn[] $columns |
|
| 81 | + */ |
|
| 76 | 82 | final protected function _colImpl($offsetOrNameOrEvaluator, $columns, $colNameMap, IRelation $relation) |
| 77 | 83 | { |
| 78 | 84 | if (is_scalar($offsetOrNameOrEvaluator)) { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | public function assoc($col1, $col2, ...$moreCols): IValueMap |
| 103 | 103 | { |
| 104 | 104 | return $this->assocImpl( |
| 105 | - function () { |
|
| 105 | + function() { |
|
| 106 | 106 | // FIXME: depending on the data type of the keys, either use an array-based implementation, or an object hashing implementation |
| 107 | 107 | return new ArrayValueMap(); |
| 108 | 108 | }, |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | public function map($mappingCol, ...$moreMappingCols): ITupleMap |
| 114 | 114 | { |
| 115 | 115 | return $this->assocImpl( |
| 116 | - function () { |
|
| 116 | + function() { |
|
| 117 | 117 | // FIXME: depending on the data type of the keys, either use an array-based implementation, or an object hashing implementation |
| 118 | 118 | return new ArrayTupleMap(); |
| 119 | 119 | }, |
@@ -275,6 +275,11 @@ discard block |
||
| 275 | 275 | return $out; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | + /** |
|
| 279 | + * @param string $str |
|
| 280 | + * @param string $errMsg |
|
| 281 | + * @param integer $offset |
|
| 282 | + */ |
|
| 278 | 283 | private static function throwArrayParseException($str, $errMsg = null, $offset = null) |
| 279 | 284 | { |
| 280 | 285 | $msg = "Value '$str' is not valid for an array"; |
@@ -284,6 +289,11 @@ discard block |
||
| 284 | 289 | throw new ParseException($msg, $offset); |
| 285 | 290 | } |
| 286 | 291 | |
| 292 | + /** |
|
| 293 | + * @param string $str |
|
| 294 | + * @param integer $offset |
|
| 295 | + * @param ParseException $cause |
|
| 296 | + */ |
|
| 287 | 297 | private function throwParseException($str, $errMsg = null, $offset = null, $cause = null) |
| 288 | 298 | { |
| 289 | 299 | $elemTypeName = $this->elemType->getSchemaName() . '.' . $this->elemType->getName(); |
@@ -73,6 +73,9 @@ discard block |
||
| 73 | 73 | return Range::createFromBounds($this->subtype, $this->canonicalFunc, $lower, $upper, $lowerInc, $upperInc); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | + /** |
|
| 77 | + * @param string $str |
|
| 78 | + */ |
|
| 76 | 79 | private function parseBoundStr($str) |
| 77 | 80 | { |
| 78 | 81 | if (strlen($str) == 0) { |
@@ -151,6 +154,11 @@ discard block |
||
| 151 | 154 | } |
| 152 | 155 | } |
| 153 | 156 | |
| 157 | + /** |
|
| 158 | + * @param integer $sgn |
|
| 159 | + * @param boolean|null $aIsInc |
|
| 160 | + * @param boolean|null $bIsInc |
|
| 161 | + */ |
|
| 154 | 162 | private function compareBounds($sgn, $aVal, $aIsInc, $bVal, $bIsInc) |
| 155 | 163 | { |
| 156 | 164 | if ($aVal === null && $bVal === null) { |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | public function uniq($hasher = null, $comparator = null): IColumn |
| 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 | } elseif ($hasher === 1) { |
| 68 | - $hasher = new CallbackValueHasher(function ($value) { |
|
| 68 | + $hasher = new CallbackValueHasher(function($value) { |
|
| 69 | 69 | return 1; |
| 70 | 70 | }); |
| 71 | 71 | } elseif (!$hasher instanceof IValueHasher) { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if ($comparator === null) { |
| 76 | - $comparator = new CallbackValueComparator(function ($a, $b) { |
|
| 76 | + $comparator = new CallbackValueComparator(function($a, $b) { |
|
| 77 | 77 | if (is_object($a) && is_object($b) && $a instanceof IComparable) { |
| 78 | 78 | return $a->equals($b); |
| 79 | 79 | } else { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $hashTable = []; |
| 88 | - return new FilteredColumn($this, function ($value) use ($hasher, $comparator, &$hashTable) { |
|
| 88 | + return new FilteredColumn($this, function($value) use ($hasher, $comparator, &$hashTable) { |
|
| 89 | 89 | $h = $hasher->hash($value); |
| 90 | 90 | if (!isset($hashTable[$h])) { |
| 91 | 91 | $hashTable[$h] = [$value]; |