@@ -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 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | foreach ($file->getNamespaces() as $foundNs) { |
| 255 | 255 | foreach ($foundNs->getClasses() as $foundClass) { |
| 256 | - if ($this->mapperInfo->className() === $foundNs->getName() . '\\' . $foundClass->getName()) { |
|
| 256 | + if ($this->mapperInfo->className() === $foundNs->getName().'\\'.$foundClass->getName()) { |
|
| 257 | 257 | $namespace = $foundNs; |
| 258 | 258 | $class = $foundClass; |
| 259 | 259 | break; |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | if (!$namespace || !$class) { |
| 265 | - throw new \InvalidArgumentException('The file do not contains class definition of ' . $this->mapperInfo->className()); |
|
| 265 | + throw new \InvalidArgumentException('The file do not contains class definition of '.$this->mapperInfo->className()); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | $this->generateEntityBody(new EntityClassGenerator($class, $namespace)); |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | case $property->isArray() && $property->wrapper() === null: |
| 550 | 550 | // Simple array relation |
| 551 | 551 | $generator->setDefaultValue([]); |
| 552 | - $generator->setVarTag($property->className() . '[]'); |
|
| 552 | + $generator->setVarTag($property->className().'[]'); |
|
| 553 | 553 | |
| 554 | 554 | if ($this->useTypedProperties) { |
| 555 | 555 | $generator->setTypeHint('array'); |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | case $property->isArray() && $property->wrapper() !== null: |
| 560 | 560 | // Array relation with wrapper |
| 561 | 561 | $repository = $this->prime->repository($property->className()); |
| 562 | - $generator->setVarTag($repository->collectionFactory()->wrapperClass($property->wrapper()) . '|' . $property->className() . '[]'); |
|
| 562 | + $generator->setVarTag($repository->collectionFactory()->wrapperClass($property->wrapper()).'|'.$property->className().'[]'); |
|
| 563 | 563 | |
| 564 | 564 | // The value is an object : so the default value must be null |
| 565 | 565 | if ($nullable) { |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | $variableName = $this->inflector->camelize($fieldName); |
| 615 | 615 | $methodName = $variableName; |
| 616 | 616 | } else { |
| 617 | - $methodName = $prefix . $this->inflector->classify($fieldName); |
|
| 617 | + $methodName = $prefix.$this->inflector->classify($fieldName); |
|
| 618 | 618 | $variableName = $this->inflector->camelize($fieldName); |
| 619 | 619 | } |
| 620 | 620 | |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | $repository = $this->prime->repository($propertyInfo->className()); |
| 647 | 647 | |
| 648 | 648 | $methodTypeHint = $repository->collectionFactory()->wrapperClass($propertyInfo->wrapper()); |
| 649 | - $variableType = $generator->simplifyType($propertyInfo->className()) . '[]|'.$generator->simplifyType($methodTypeHint); |
|
| 649 | + $variableType = $generator->simplifyType($propertyInfo->className()).'[]|'.$generator->simplifyType($methodTypeHint); |
|
| 650 | 650 | } else { |
| 651 | 651 | $methodTypeHint = 'array'; |
| 652 | 652 | $variableType = $propertyInfo->isObject() ? $propertyInfo->className() : $propertyInfo->phpType(); |
@@ -676,14 +676,14 @@ discard block |
||
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | $method = $generator->addMethod($metadata['method']); |
| 679 | - $method->addComment('Get ' . $metadata['variable']); |
|
| 679 | + $method->addComment('Get '.$metadata['variable']); |
|
| 680 | 680 | $method->addComment(''); |
| 681 | 681 | $method->setReturnType($metadata['typeHint']); |
| 682 | 682 | $method->setReturnNullable($metadata['nullable']); |
| 683 | 683 | $method->setBody('return $this->?;', [$metadata['field']]); |
| 684 | 684 | |
| 685 | 685 | if ($metadata['docType']) { |
| 686 | - $method->addComment('@return ' . $metadata['docType']); |
|
| 686 | + $method->addComment('@return '.$metadata['docType']); |
|
| 687 | 687 | } |
| 688 | 688 | } |
| 689 | 689 | |
@@ -696,11 +696,11 @@ discard block |
||
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | $method = $generator->addMethod($metadata['method']); |
| 699 | - $method->addComment('Set ' . $metadata['variable']); |
|
| 699 | + $method->addComment('Set '.$metadata['variable']); |
|
| 700 | 700 | $method->addComment(''); |
| 701 | 701 | |
| 702 | 702 | if ($metadata['docType']) { |
| 703 | - $method->addComment('@param ' . $metadata['docType'] . ' $' . $metadata['variable']); |
|
| 703 | + $method->addComment('@param '.$metadata['docType'].' $'.$metadata['variable']); |
|
| 704 | 704 | $method->addComment(''); |
| 705 | 705 | } |
| 706 | 706 | |
@@ -725,11 +725,11 @@ discard block |
||
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | $method = $generator->addMethod($metadata['method']); |
| 728 | - $method->addComment('Add ' . $metadata['variable']); |
|
| 728 | + $method->addComment('Add '.$metadata['variable']); |
|
| 729 | 729 | $method->addComment(''); |
| 730 | 730 | |
| 731 | 731 | if ($metadata['docType']) { |
| 732 | - $method->addComment('@param ' . $metadata['docType'] . ' $' . $metadata['variable']); |
|
| 732 | + $method->addComment('@param '.$metadata['docType'].' $'.$metadata['variable']); |
|
| 733 | 733 | $method->addComment(''); |
| 734 | 734 | } |
| 735 | 735 | |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | public function setFieldVisibility(string $visibility): void |
| 876 | 876 | { |
| 877 | 877 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
| 878 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
| 878 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | $this->fieldVisibility = $visibility; |
@@ -1142,7 +1142,7 @@ discard block |
||
| 1142 | 1142 | continue; |
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | - $part = $generator->simplifyType($atomicType) . ($isArray ? '[]' : ''); |
|
| 1145 | + $part = $generator->simplifyType($atomicType).($isArray ? '[]' : ''); |
|
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | 1148 | return implode('|', $types); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $mapper = $this->locator->mappers()->createMapper($this->locator, $className); |
| 100 | - $generator = new CriteriaGenerator($mapper->getEntityClass() . self::CLASS_SUFFIX); |
|
| 100 | + $generator = new CriteriaGenerator($mapper->getEntityClass().self::CLASS_SUFFIX); |
|
| 101 | 101 | |
| 102 | 102 | $this->runUserActions($io, $generator, $mapper, $classInfo); |
| 103 | 103 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | if ($io->option('backup') && !$io->option('dry-run')) { |
| 147 | 147 | $filesystem->copy($fileName, $fileName.'.bak'); |
| 148 | - $io->comment('backup file "' . $fileName.'.bak' . '"'); |
|
| 148 | + $io->comment('backup file "'.$fileName.'.bak'.'"'); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | if (!$io->option('dry-run')) { |
| 162 | 162 | $filesystem->dumpFile($fileName, $code); |
| 163 | - $io->comment('generated file "' . $fileName . '"'); |
|
| 163 | + $io->comment('generated file "'.$fileName.'"'); |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | public function setGenerator($generator): void |
| 316 | 316 | { |
| 317 | 317 | if (!is_string($generator) && !$generator instanceof GeneratorInterface) { |
| 318 | - throw new LogicException('Trying to set an invalid generator in "' . get_class($this) . '"'); |
|
| 318 | + throw new LogicException('Trying to set an invalid generator in "'.get_class($this).'"'); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | $this->generator = $generator; |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | $class = $this->criteriaClass; |
| 551 | 551 | |
| 552 | 552 | if (!$class) { |
| 553 | - $class = $this->entityClass . 'Criteria'; |
|
| 553 | + $class = $this->entityClass.'Criteria'; |
|
| 554 | 554 | $this->criteriaClass = $class = class_exists($class) ? $class : Criteria::class; |
| 555 | 555 | } |
| 556 | 556 | |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | $relations = $this->relations(); |
| 588 | 588 | |
| 589 | 589 | if (!isset($relations[$relationName])) { |
| 590 | - throw new RelationNotFoundException('Relation "' . $relationName . '" is not set in ' . $this->metadata->entityName); |
|
| 590 | + throw new RelationNotFoundException('Relation "'.$relationName.'" is not set in '.$this->metadata->entityName); |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | return $relations[$relationName]; |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | */ |
| 769 | 769 | public function scopes(): array |
| 770 | 770 | { |
| 771 | - throw new LogicException('No scopes have been defined in "' . get_class($this) . '"'); |
|
| 771 | + throw new LogicException('No scopes have been defined in "'.get_class($this).'"'); |
|
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | /** |