@@ -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 |
@@ -536,11 +536,11 @@ discard block |
||
536 | 536 | |
537 | 537 | $generator->setNullable($nullable = $forceNullable || $this->useTypedProperties); |
538 | 538 | |
539 | - switch(true) { |
|
539 | + switch (true) { |
|
540 | 540 | case $property->isArray() && $property->wrapper() === null: |
541 | 541 | // Simple array relation |
542 | 542 | $generator->setDefaultValue([]); |
543 | - $generator->setVarTag($property->className() . '[]'); |
|
543 | + $generator->setVarTag($property->className().'[]'); |
|
544 | 544 | |
545 | 545 | if ($this->useTypedProperties) { |
546 | 546 | $generator->setTypeHint('array'); |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | case $property->isArray() && $property->wrapper() !== null: |
551 | 551 | // Array relation with wrapper |
552 | 552 | $repository = $this->prime->repository($property->className()); |
553 | - $generator->setVarTag($repository->collectionFactory()->wrapperClass($property->wrapper()) . '|' . $property->className() . '[]'); |
|
553 | + $generator->setVarTag($repository->collectionFactory()->wrapperClass($property->wrapper()).'|'.$property->className().'[]'); |
|
554 | 554 | |
555 | 555 | // The value is an object : so the default value must be null |
556 | 556 | if ($nullable) { |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | $variableName = $this->inflector->camelize($fieldName); |
606 | 606 | $methodName = $variableName; |
607 | 607 | } else { |
608 | - $methodName = $prefix . $this->inflector->classify($fieldName); |
|
608 | + $methodName = $prefix.$this->inflector->classify($fieldName); |
|
609 | 609 | $variableName = $this->inflector->camelize($fieldName); |
610 | 610 | } |
611 | 611 | |
@@ -668,12 +668,12 @@ discard block |
||
668 | 668 | } |
669 | 669 | |
670 | 670 | $method = $generator->addMethod($metadata['method']); |
671 | - $method->addComment('Get ' . $metadata['variable']); |
|
671 | + $method->addComment('Get '.$metadata['variable']); |
|
672 | 672 | $method->addComment(''); |
673 | 673 | $method->setReturnType($metadata['typeHint']); |
674 | 674 | $method->setReturnNullable($metadata['nullable']); |
675 | 675 | $method->setBody('return $this->?;', [$metadata['field']]); |
676 | - $method->addComment('@return ' . $metadata['docType']); |
|
676 | + $method->addComment('@return '.$metadata['docType']); |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | protected function generateSetter(ClassType $generator, PhpNamespace $namespace, InfoInterface $propertyInfo): void |
@@ -685,9 +685,9 @@ discard block |
||
685 | 685 | } |
686 | 686 | |
687 | 687 | $method = $generator->addMethod($metadata['method']); |
688 | - $method->addComment('Set ' . $metadata['variable']); |
|
688 | + $method->addComment('Set '.$metadata['variable']); |
|
689 | 689 | $method->addComment(''); |
690 | - $method->addComment('@param ' . $metadata['docType'] . ' $' . $metadata['variable']); |
|
690 | + $method->addComment('@param '.$metadata['docType'].' $'.$metadata['variable']); |
|
691 | 691 | $method->addComment(''); |
692 | 692 | $method->addComment('@return $this'); |
693 | 693 | $method->setReturnType('self'); |
@@ -710,9 +710,9 @@ discard block |
||
710 | 710 | } |
711 | 711 | |
712 | 712 | $method = $generator->addMethod($metadata['method']); |
713 | - $method->addComment('Add ' . $metadata['variable']); |
|
713 | + $method->addComment('Add '.$metadata['variable']); |
|
714 | 714 | $method->addComment(''); |
715 | - $method->addComment('@param ' . $metadata['docType'] . ' $' . $metadata['variable']); |
|
715 | + $method->addComment('@param '.$metadata['docType'].' $'.$metadata['variable']); |
|
716 | 716 | $method->addComment(''); |
717 | 717 | $method->addComment('@return $this'); |
718 | 718 | $method->setReturnType('self'); |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | |
764 | 764 | if ($inClass) { |
765 | 765 | $inClass = false; |
766 | - $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1]; |
|
766 | + $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1]; |
|
767 | 767 | $this->staticReflection[$lastSeenClass]['properties'] = []; |
768 | 768 | $this->staticReflection[$lastSeenClass]['methods'] = []; |
769 | 769 | } |
@@ -771,16 +771,16 @@ discard block |
||
771 | 771 | if ($token[0] == T_NAMESPACE) { |
772 | 772 | $lastSeenNamespace = ""; |
773 | 773 | $inNamespace = true; |
774 | - } elseif ($token[0] == T_CLASS && $tokens[$i-1][0] != T_DOUBLE_COLON) { |
|
774 | + } elseif ($token[0] == T_CLASS && $tokens[$i - 1][0] != T_DOUBLE_COLON) { |
|
775 | 775 | $inClass = true; |
776 | 776 | } elseif ($token[0] == T_FUNCTION) { |
777 | - if ($tokens[$i+2][0] == T_STRING) { |
|
778 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]); |
|
779 | - } elseif ($tokens[$i+2] == "&" && $tokens[$i+3][0] == T_STRING) { |
|
780 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]); |
|
777 | + if ($tokens[$i + 2][0] == T_STRING) { |
|
778 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]); |
|
779 | + } elseif ($tokens[$i + 2] == "&" && $tokens[$i + 3][0] == T_STRING) { |
|
780 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]); |
|
781 | 781 | } |
782 | - } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED]) && $tokens[$i+2][0] != T_FUNCTION) { |
|
783 | - $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1); |
|
782 | + } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED]) && $tokens[$i + 2][0] != T_FUNCTION) { |
|
783 | + $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1); |
|
784 | 784 | } |
785 | 785 | } |
786 | 786 | } |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | public function setFieldVisibility(string $visibility): void |
1031 | 1031 | { |
1032 | 1032 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
1033 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
1033 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | $this->fieldVisibility = $visibility; |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | continue; |
1298 | 1298 | } |
1299 | 1299 | |
1300 | - $part = $namespace->simplifyName($atomicType) . ($isArray ? '[]' : ''); |
|
1300 | + $part = $namespace->simplifyName($atomicType).($isArray ? '[]' : ''); |
|
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | return implode('|', $types); |