@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Bdf\Prime\Query; |
4 | 4 | |
5 | -require_once __DIR__ . '/../_files/BenchData.php'; |
|
5 | +require_once __DIR__.'/../_files/BenchData.php'; |
|
6 | 6 | |
7 | 7 | use Bdf\Prime\Bench\BenchData; |
8 | 8 | use Bdf\Prime\Bench\User as BenchUser; |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace Bdf\Prime\Query; |
4 | 4 | |
5 | -require_once __DIR__ . '/../_files/BenchData.php'; |
|
5 | +require_once __DIR__.'/../_files/BenchData.php'; |
|
6 | 6 | |
7 | 7 | use Bdf\Prime\Bench\BenchData; |
8 | 8 | use Bdf\Prime\Bench\User; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function bench_insert_transaction() |
210 | 210 | { |
211 | - $this->repository->transaction(function () { |
|
211 | + $this->repository->transaction(function() { |
|
212 | 212 | /** @var BulkInsertQuery $insert */ |
213 | 213 | $insert = $this->repository->queries()->make(BulkInsertQuery::class); |
214 | 214 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function bench_insert_builder() |
234 | 234 | { |
235 | - $this->repository->transaction(function () { |
|
235 | + $this->repository->transaction(function() { |
|
236 | 236 | for ($i = 0; $i < 100; ++$i) { |
237 | 237 | $this->repository->builder()->insert([ |
238 | 238 | 'id' => 6000000 + $i, |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace Bdf\Prime; |
4 | 4 | |
5 | -require_once __DIR__ . '/_files/BenchData.php'; |
|
5 | +require_once __DIR__.'/_files/BenchData.php'; |
|
6 | 6 | |
7 | 7 | use Bdf\Prime\Bench\BenchData; |
8 | 8 | use Bdf\Prime\Bench\User as BenchUser; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | function convert($size) { |
118 | - return number_format($size/1024).' kb'; |
|
118 | + return number_format($size / 1024).' kb'; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | function profile($callback, $times) { |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | |
136 | 136 | $delta = ($end - $start); |
137 | 137 | |
138 | - $bench['time'] = $delta; |
|
139 | - $bench['queries'] = $times / $delta; |
|
140 | - $bench['memory'] = memory_get_usage(true) - $memory; |
|
138 | + $bench['time'] = $delta; |
|
139 | + $bench['queries'] = $times / $delta; |
|
140 | + $bench['memory'] = memory_get_usage(true) - $memory; |
|
141 | 141 | |
142 | 142 | return $bench; |
143 | 143 | } |
144 | 144 | \ No newline at end of file |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Bdf\Prime\Query; |
4 | 4 | |
5 | -require_once __DIR__ . '/../_files/BenchData.php'; |
|
5 | +require_once __DIR__.'/../_files/BenchData.php'; |
|
6 | 6 | |
7 | 7 | use Bdf\Prime\Bench\BenchData; |
8 | 8 | use Bdf\Prime\Bench\User; |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Bdf\Prime\Query; |
4 | 4 | |
5 | -require_once __DIR__ . '/../_files/BenchData.php'; |
|
5 | +require_once __DIR__.'/../_files/BenchData.php'; |
|
6 | 6 | |
7 | 7 | use Bdf\Prime\Bench\BenchData; |
8 | 8 | use Bdf\Prime\Bench\User; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | foreach ($query->statements['tables'] as $table) { |
187 | 187 | return $query->state()->compiled = 'UPDATE ' |
188 | 188 | . $this->quoteIdentifier($query, $table['table']) |
189 | - . ' SET ' . implode(', ', $values) |
|
189 | + . ' SET '.implode(', ', $values) |
|
190 | 190 | . $this->compileWhere($query) |
191 | 191 | ; |
192 | 192 | } |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | $from['sql'] = $this->quoteIdentifier($query, $databasePrefix.$from['table']); |
525 | 525 | $compiled[$from['table']] = $from; |
526 | 526 | } else { |
527 | - $from['sql'] = $this->quoteIdentifier($query, $databasePrefix.$from['table']) . ' ' . $this->quoteIdentifier($query, $from['alias']); |
|
527 | + $from['sql'] = $this->quoteIdentifier($query, $databasePrefix.$from['table']).' '.$this->quoteIdentifier($query, $from['alias']); |
|
528 | 528 | $compiled[$from['alias']] = $from; |
529 | 529 | } |
530 | 530 | } |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | if (is_array($value)) { |
698 | 698 | return $this->compileIntoExpression($query, $value, $column, 'REGEXP', $converted); |
699 | 699 | } |
700 | - return $this->quoteIdentifier($query, $column).' REGEXP '.$this->compileExpressionValue($query, (string)$value, $converted); |
|
700 | + return $this->quoteIdentifier($query, $column).' REGEXP '.$this->compileExpressionValue($query, (string) $value, $converted); |
|
701 | 701 | |
702 | 702 | case ':like': |
703 | 703 | if (is_array($value)) { |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | return $this->quoteIdentifier($query, $column).' = '.$this->compileExpressionValue($query, $value, $converted); |
762 | 762 | |
763 | 763 | default: |
764 | - throw new UnexpectedValueException("Unsupported operator '" . $operator . "' in WHERE clause"); |
|
764 | + throw new UnexpectedValueException("Unsupported operator '".$operator."' in WHERE clause"); |
|
765 | 765 | } |
766 | 766 | } |
767 | 767 | |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | $sql = '('.$this->compileSelect($query).')'; |
850 | 850 | |
851 | 851 | if ($alias) { |
852 | - $sql = $sql . ' as ' . $this->quoteIdentifier($clause, $alias); |
|
852 | + $sql = $sql.' as '.$this->quoteIdentifier($clause, $alias); |
|
853 | 853 | } |
854 | 854 | |
855 | 855 | $this->addQueryBindings($clause, $query); |
@@ -1007,12 +1007,12 @@ discard block |
||
1007 | 1007 | if ($lock !== null && !$query->statements['aggregate']) { |
1008 | 1008 | // Lock for update |
1009 | 1009 | if ($lock === LockMode::PESSIMISTIC_WRITE) { |
1010 | - return ' ' . $this->platform()->grammar()->getWriteLockSQL(); |
|
1010 | + return ' '.$this->platform()->grammar()->getWriteLockSQL(); |
|
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | // Shared Lock: other process can read the row but not update it. |
1014 | 1014 | if ($lock === LockMode::PESSIMISTIC_READ) { |
1015 | - return ' ' . $this->platform()->grammar()->getReadLockSQL(); |
|
1015 | + return ' '.$this->platform()->grammar()->getReadLockSQL(); |
|
1016 | 1016 | } |
1017 | 1017 | } |
1018 | 1018 |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | $body = str_replace('<spaces>', $this->spaces, $body); |
408 | 408 | $last = strrpos($currentCode, '}'); |
409 | 409 | |
410 | - return substr($currentCode, 0, $last) . $body . (strlen($body) > 0 ? "\n" : '') . "}\n"; |
|
410 | + return substr($currentCode, 0, $last).$body.(strlen($body) > 0 ? "\n" : '')."}\n"; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | /** |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | protected function generateEntityNamespace(): string |
417 | 417 | { |
418 | 418 | if ($this->hasNamespace($this->mapperInfo->className())) { |
419 | - return 'namespace ' . $this->getNamespace($this->mapperInfo->className()) .';' . "\n\n"; |
|
419 | + return 'namespace '.$this->getNamespace($this->mapperInfo->className()).';'."\n\n"; |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | return ''; |
@@ -432,18 +432,18 @@ discard block |
||
432 | 432 | $use = []; |
433 | 433 | |
434 | 434 | if (($parentClass = $this->getClassToExtend()) && $this->hasNamespace($parentClass)) { |
435 | - $use[$parentClass] = 'use ' . $parentClass . ';'; |
|
435 | + $use[$parentClass] = 'use '.$parentClass.';'; |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | foreach ($this->interfaces as $interface) { |
439 | 439 | if ($this->hasNamespace($interface)) { |
440 | - $use[$interface] = 'use ' . $interface . ';'; |
|
440 | + $use[$interface] = 'use '.$interface.';'; |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
444 | 444 | foreach ($this->traits as $trait) { |
445 | 445 | if ($this->hasNamespace($trait)) { |
446 | - $use[$trait] = 'use ' . $trait . ';'; |
|
446 | + $use[$trait] = 'use '.$trait.';'; |
|
447 | 447 | } |
448 | 448 | } |
449 | 449 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | |
474 | 474 | sort($use); |
475 | 475 | |
476 | - return implode("\n", $use) . "\n\n"; |
|
476 | + return implode("\n", $use)."\n\n"; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | /** |
@@ -481,9 +481,9 @@ discard block |
||
481 | 481 | */ |
482 | 482 | protected function generateEntityClassName() |
483 | 483 | { |
484 | - return 'class ' . $this->getClassName($this->mapperInfo->className()) . |
|
485 | - ($this->classToExtend ? ' extends ' . $this->getClassToExtendName() : null) . |
|
486 | - ($this->interfaces ? ' implements ' . $this->getInterfacesToImplement() : null); |
|
484 | + return 'class '.$this->getClassName($this->mapperInfo->className()). |
|
485 | + ($this->classToExtend ? ' extends '.$this->getClassToExtendName() : null). |
|
486 | + ($this->interfaces ? ' implements '.$this->getInterfacesToImplement() : null); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
@@ -498,10 +498,10 @@ discard block |
||
498 | 498 | $traits = ''; |
499 | 499 | |
500 | 500 | foreach ($this->traits as $trait) { |
501 | - $traits .= $this->spaces . 'use ' . $this->getRelativeClassName($trait) . ';' . "\n"; |
|
501 | + $traits .= $this->spaces.'use '.$this->getRelativeClassName($trait).';'."\n"; |
|
502 | 502 | } |
503 | 503 | |
504 | - return $traits . "\n"; |
|
504 | + return $traits."\n"; |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | /** |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | { |
669 | 669 | $lines = []; |
670 | 670 | $lines[] = '/**'; |
671 | - $lines[] = ' * ' . $this->getClassName($this->mapperInfo->className()); |
|
671 | + $lines[] = ' * '.$this->getClassName($this->mapperInfo->className()); |
|
672 | 672 | $lines[] = ' */'; |
673 | 673 | |
674 | 674 | return implode("\n", $lines); |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | |
770 | 770 | if (!$property->isRelation()) { |
771 | 771 | $lines[] = $this->generateEmbeddedPropertyDocBlock($property); |
772 | - $lines[] = $this->spaces . $this->fieldVisibility . $this->getPropertyTypeHintForObject($property, $forceNullable) . ' $'.$property->name().";\n"; |
|
772 | + $lines[] = $this->spaces.$this->fieldVisibility.$this->getPropertyTypeHintForObject($property, $forceNullable).' $'.$property->name().";\n"; |
|
773 | 773 | } else { |
774 | 774 | $name = $property->name(); |
775 | 775 | $default = ''; |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | } |
786 | 786 | |
787 | 787 | $lines[] = $this->generateEmbeddedPropertyDocBlock($property); |
788 | - $lines[] = $this->spaces . $this->fieldVisibility . $this->getPropertyTypeHintForObject($property, $forceNullable) . ' $' . $name . $default .";\n"; |
|
788 | + $lines[] = $this->spaces.$this->fieldVisibility.$this->getPropertyTypeHintForObject($property, $forceNullable).' $'.$name.$default.";\n"; |
|
789 | 789 | } |
790 | 790 | } |
791 | 791 | |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | $variableName = $this->inflector->camelize($fieldName); |
814 | 814 | $methodName = $variableName; |
815 | 815 | } else { |
816 | - $methodName = $type . $this->inflector->classify($fieldName); |
|
816 | + $methodName = $type.$this->inflector->classify($fieldName); |
|
817 | 817 | $variableName = $this->inflector->camelize($fieldName); |
818 | 818 | } |
819 | 819 | |
@@ -939,9 +939,9 @@ discard block |
||
939 | 939 | protected function generateFieldMappingPropertyDocBlock($property) |
940 | 940 | { |
941 | 941 | $lines = []; |
942 | - $lines[] = $this->spaces . '/**'; |
|
943 | - $lines[] = $this->spaces . ' * @var '.$property->phpType(); |
|
944 | - $lines[] = $this->spaces . ' */'; |
|
942 | + $lines[] = $this->spaces.'/**'; |
|
943 | + $lines[] = $this->spaces.' * @var '.$property->phpType(); |
|
944 | + $lines[] = $this->spaces.' */'; |
|
945 | 945 | |
946 | 946 | return implode("\n", $lines); |
947 | 947 | } |
@@ -970,9 +970,9 @@ discard block |
||
970 | 970 | } |
971 | 971 | |
972 | 972 | $lines = []; |
973 | - $lines[] = $this->spaces . '/**'; |
|
974 | - $lines[] = $this->spaces . ' * @var '.$className; |
|
975 | - $lines[] = $this->spaces . ' */'; |
|
973 | + $lines[] = $this->spaces.'/**'; |
|
974 | + $lines[] = $this->spaces.' * @var '.$className; |
|
975 | + $lines[] = $this->spaces.' */'; |
|
976 | 976 | |
977 | 977 | return implode("\n", $lines); |
978 | 978 | } |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | |
1014 | 1014 | if ($inClass) { |
1015 | 1015 | $inClass = false; |
1016 | - $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1]; |
|
1016 | + $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1]; |
|
1017 | 1017 | $this->staticReflection[$lastSeenClass]['properties'] = []; |
1018 | 1018 | $this->staticReflection[$lastSeenClass]['methods'] = []; |
1019 | 1019 | } |
@@ -1021,16 +1021,16 @@ discard block |
||
1021 | 1021 | if ($token[0] == T_NAMESPACE) { |
1022 | 1022 | $lastSeenNamespace = ""; |
1023 | 1023 | $inNamespace = true; |
1024 | - } elseif ($token[0] == T_CLASS && $tokens[$i-1][0] != T_DOUBLE_COLON) { |
|
1024 | + } elseif ($token[0] == T_CLASS && $tokens[$i - 1][0] != T_DOUBLE_COLON) { |
|
1025 | 1025 | $inClass = true; |
1026 | 1026 | } elseif ($token[0] == T_FUNCTION) { |
1027 | - if ($tokens[$i+2][0] == T_STRING) { |
|
1028 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]); |
|
1029 | - } elseif ($tokens[$i+2] == "&" && $tokens[$i+3][0] == T_STRING) { |
|
1030 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]); |
|
1027 | + if ($tokens[$i + 2][0] == T_STRING) { |
|
1028 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]); |
|
1029 | + } elseif ($tokens[$i + 2] == "&" && $tokens[$i + 3][0] == T_STRING) { |
|
1030 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]); |
|
1031 | 1031 | } |
1032 | - } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED]) && $tokens[$i+2][0] != T_FUNCTION) { |
|
1033 | - $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1); |
|
1032 | + } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED]) && $tokens[$i + 2][0] != T_FUNCTION) { |
|
1033 | + $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1); |
|
1034 | 1034 | } |
1035 | 1035 | } |
1036 | 1036 | } |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | if ($this->hasNamespace($className)) { |
1106 | 1106 | return $this->getClassName($className); |
1107 | 1107 | } else { |
1108 | - return '\\' . $className; |
|
1108 | + return '\\'.$className; |
|
1109 | 1109 | } |
1110 | 1110 | } |
1111 | 1111 | |
@@ -1206,8 +1206,8 @@ discard block |
||
1206 | 1206 | $lines = explode("\n", $code); |
1207 | 1207 | |
1208 | 1208 | foreach ($lines as $key => $value) { |
1209 | - if (! empty($value)) { |
|
1210 | - $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key]; |
|
1209 | + if (!empty($value)) { |
|
1210 | + $lines[$key] = str_repeat($this->spaces, $num).$lines[$key]; |
|
1211 | 1211 | } |
1212 | 1212 | } |
1213 | 1213 | |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | } |
1237 | 1237 | |
1238 | 1238 | if (is_string($value)) { |
1239 | - return "'" . $value . "'"; |
|
1239 | + return "'".$value."'"; |
|
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | if (is_bool($value)) { |
@@ -1269,7 +1269,7 @@ discard block |
||
1269 | 1269 | $type = self::PROPERTY_TYPE_MAP[$type] ?? $type; |
1270 | 1270 | } |
1271 | 1271 | |
1272 | - return ($nullable ? '?' : '') . $type; |
|
1272 | + return ($nullable ? '?' : '').$type; |
|
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | /** |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | return ''; |
1290 | 1290 | } |
1291 | 1291 | |
1292 | - return ' ' . $this->getPropertyTypeHint($property->phpType(), $forceNullable || $property->isNullable()); |
|
1292 | + return ' '.$this->getPropertyTypeHint($property->phpType(), $forceNullable || $property->isNullable()); |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | /** |
@@ -1324,7 +1324,7 @@ discard block |
||
1324 | 1324 | } |
1325 | 1325 | } |
1326 | 1326 | |
1327 | - return ' ' . $this->getPropertyTypeHint($type, $forceNullable || $property->isRelation()); |
|
1327 | + return ' '.$this->getPropertyTypeHint($type, $forceNullable || $property->isRelation()); |
|
1328 | 1328 | } |
1329 | 1329 | |
1330 | 1330 | //---------------------- mutators |
@@ -1458,7 +1458,7 @@ discard block |
||
1458 | 1458 | public function setFieldVisibility(string $visibility): void |
1459 | 1459 | { |
1460 | 1460 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
1461 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
1461 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
1462 | 1462 | } |
1463 | 1463 | |
1464 | 1464 | $this->fieldVisibility = $visibility; |