@@ -24,30 +24,30 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function export($value, int $indentationLevel = 0) : string |
| 26 | 26 | { |
| 27 | - if (! is_array($value)) { |
|
| 27 | + if ( ! is_array($value)) { |
|
| 28 | 28 | return var_export($value, true); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
| 32 | - $longestKey = array_reduce(array_keys($value), function ($k, $v) { |
|
| 32 | + $longestKey = array_reduce(array_keys($value), function($k, $v) { |
|
| 33 | 33 | return (string) (strlen((string) $k) > strlen((string) $v) ? $k : $v); |
| 34 | 34 | }); |
| 35 | 35 | $maxKeyLength = strlen($longestKey) + (is_numeric($longestKey) ? 0 : 2); |
| 36 | 36 | |
| 37 | 37 | $lines = []; |
| 38 | 38 | |
| 39 | - $lines[] = $indentation . '['; |
|
| 39 | + $lines[] = $indentation.'['; |
|
| 40 | 40 | |
| 41 | 41 | foreach ($value as $entryKey => $entryValue) { |
| 42 | 42 | $lines[] = sprintf( |
| 43 | 43 | '%s%s => %s,', |
| 44 | - $indentation . self::INDENTATION, |
|
| 44 | + $indentation.self::INDENTATION, |
|
| 45 | 45 | str_pad(var_export($entryKey, true), $maxKeyLength), |
| 46 | 46 | ltrim($this->export($entryValue, $indentationLevel + 1)) |
| 47 | 47 | ); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $lines[] = $indentation . ']'; |
|
| 50 | + $lines[] = $indentation.']'; |
|
| 51 | 51 | |
| 52 | 52 | return implode(PHP_EOL, $lines); |
| 53 | 53 | } |
@@ -24,33 +24,33 @@ |
||
| 24 | 24 | $cacheExporter = new CacheMetadataExporter(); |
| 25 | 25 | $variableExporter = new VariableExporter(); |
| 26 | 26 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
| 27 | - $objectReference = $indentation . static::VARIABLE; |
|
| 27 | + $objectReference = $indentation.static::VARIABLE; |
|
| 28 | 28 | $cascade = $this->resolveCascade($value->getCascade()); |
| 29 | 29 | $lines = []; |
| 30 | 30 | |
| 31 | - $lines[] = $objectReference . ' = ' . $this->exportInstantiation($value); |
|
| 31 | + $lines[] = $objectReference.' = '.$this->exportInstantiation($value); |
|
| 32 | 32 | |
| 33 | - if (! empty($value->getCache())) { |
|
| 33 | + if ( ! empty($value->getCache())) { |
|
| 34 | 34 | $lines[] = $cacheExporter->export($value->getCache(), $indentationLevel); |
| 35 | 35 | $lines[] = null; |
| 36 | - $lines[] = $objectReference . '->setCache(' . $cacheExporter::VARIABLE . ');'; |
|
| 36 | + $lines[] = $objectReference.'->setCache('.$cacheExporter::VARIABLE.');'; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if (! empty($value->getMappedBy())) { |
|
| 40 | - $lines[] = $objectReference . '->setMappedBy("' . $value->getMappedBy() . '");'; |
|
| 41 | - $lines[] = $objectReference . '->setOwningSide(false);'; |
|
| 39 | + if ( ! empty($value->getMappedBy())) { |
|
| 40 | + $lines[] = $objectReference.'->setMappedBy("'.$value->getMappedBy().'");'; |
|
| 41 | + $lines[] = $objectReference.'->setOwningSide(false);'; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if (! empty($value->getInversedBy())) { |
|
| 45 | - $lines[] = $objectReference . '->setInversedBy("' . $value->getInversedBy() . '");'; |
|
| 44 | + if ( ! empty($value->getInversedBy())) { |
|
| 45 | + $lines[] = $objectReference.'->setInversedBy("'.$value->getInversedBy().'");'; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $lines[] = $objectReference . '->setSourceEntity("' . $value->getSourceEntity() . '");'; |
|
| 49 | - $lines[] = $objectReference . '->setTargetEntity("' . $value->getTargetEntity() . '");'; |
|
| 50 | - $lines[] = $objectReference . '->setFetchMode(Mapping\FetchMode::' . strtoupper($value->getFetchMode()) . '");'; |
|
| 51 | - $lines[] = $objectReference . '->setCascade(' . $variableExporter->export($cascade, $indentationLevel + 1) . ');'; |
|
| 52 | - $lines[] = $objectReference . '->setOrphanRemoval(' . $variableExporter->export($value->isOrphanRemoval(), $indentationLevel + 1) . ');'; |
|
| 53 | - $lines[] = $objectReference . '->setPrimaryKey(' . $variableExporter->export($value->isPrimaryKey(), $indentationLevel + 1) . ');'; |
|
| 48 | + $lines[] = $objectReference.'->setSourceEntity("'.$value->getSourceEntity().'");'; |
|
| 49 | + $lines[] = $objectReference.'->setTargetEntity("'.$value->getTargetEntity().'");'; |
|
| 50 | + $lines[] = $objectReference.'->setFetchMode(Mapping\FetchMode::'.strtoupper($value->getFetchMode()).'");'; |
|
| 51 | + $lines[] = $objectReference.'->setCascade('.$variableExporter->export($cascade, $indentationLevel + 1).');'; |
|
| 52 | + $lines[] = $objectReference.'->setOrphanRemoval('.$variableExporter->export($value->isOrphanRemoval(), $indentationLevel + 1).');'; |
|
| 53 | + $lines[] = $objectReference.'->setPrimaryKey('.$variableExporter->export($value->isPrimaryKey(), $indentationLevel + 1).');'; |
|
| 54 | 54 | |
| 55 | 55 | return implode(PHP_EOL, $lines); |
| 56 | 56 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function getQuotedQualifiedName(AbstractPlatform $platform) : string |
| 57 | 57 | { |
| 58 | - if (! $this->schema) { |
|
| 58 | + if ( ! $this->schema) { |
|
| 59 | 59 | return $platform->quoteIdentifier($this->name); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function addIndex(array $index) : void |
| 129 | 129 | { |
| 130 | - if (! isset($index['name'])) { |
|
| 130 | + if ( ! isset($index['name'])) { |
|
| 131 | 131 | $this->indexes[] = $index; |
| 132 | 132 | |
| 133 | 133 | return; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function addUniqueConstraint(array $constraint) : void |
| 164 | 164 | { |
| 165 | - if (! isset($constraint['name'])) { |
|
| 165 | + if ( ! isset($constraint['name'])) { |
|
| 166 | 166 | $this->uniqueConstraints[] = $constraint; |
| 167 | 167 | |
| 168 | 168 | return; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function getAllMetadata() : array |
| 126 | 126 | { |
| 127 | - if (! $this->initialized) { |
|
| 127 | + if ( ! $this->initialized) { |
|
| 128 | 128 | $this->initialize(); |
| 129 | 129 | } |
| 130 | 130 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | try { |
| 167 | 167 | if ($this->cacheDriver) { |
| 168 | - $cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt); |
|
| 168 | + $cached = $this->cacheDriver->fetch($realClassName.$this->cacheSalt); |
|
| 169 | 169 | |
| 170 | 170 | if ($cached instanceof ClassMetadata) { |
| 171 | 171 | $this->loadedMetadata[$realClassName] = $cached; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | foreach ($this->loadMetadata($realClassName, $metadataBuildingContext) as $loadedClass) { |
| 176 | 176 | $loadedClassName = $loadedClass->getClassName(); |
| 177 | 177 | |
| 178 | - $this->cacheDriver->save($loadedClassName . $this->cacheSalt, $loadedClass, null); |
|
| 178 | + $this->cacheDriver->save($loadedClassName.$this->cacheSalt, $loadedClass, null); |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | } else { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } catch (CommonMappingException $loadingException) { |
| 185 | 185 | $fallbackMetadataResponse = $this->onNotFoundMetadata($realClassName, $metadataBuildingContext); |
| 186 | 186 | |
| 187 | - if (! $fallbackMetadataResponse) { |
|
| 187 | + if ( ! $fallbackMetadataResponse) { |
|
| 188 | 188 | throw $loadingException; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | protected function loadMetadata(string $name, ClassMetadataBuildingContext $metadataBuildingContext) : array |
| 222 | 222 | { |
| 223 | - if (! $this->initialized) { |
|
| 223 | + if ( ! $this->initialized) { |
|
| 224 | 224 | $this->initialize(); |
| 225 | 225 | } |
| 226 | 226 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | public function isTransient($className) : bool |
| 258 | 258 | { |
| 259 | - if (! $this->initialized) { |
|
| 259 | + if ( ! $this->initialized) { |
|
| 260 | 260 | $this->initialize(); |
| 261 | 261 | } |
| 262 | 262 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | $parentClasses = []; |
| 279 | 279 | |
| 280 | 280 | foreach (array_reverse($this->getReflectionService()->getParentClasses($name)) as $parentClass) { |
| 281 | - if (! $this->getDriver()->isTransient($parentClass)) { |
|
| 281 | + if ( ! $this->getDriver()->isTransient($parentClass)) { |
|
| 282 | 282 | $parentClasses[] = $parentClass; |
| 283 | 283 | } |
| 284 | 284 | } |
@@ -10,6 +10,6 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public static function create(string $generatorType) : self |
| 12 | 12 | { |
| 13 | - return new self('Unknown generator type: ' . $generatorType); |
|
| 13 | + return new self('Unknown generator type: '.$generatorType); |
|
| 14 | 14 | } |
| 15 | 15 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // If $value is not a Collection then use an ArrayCollection. |
| 61 | - if (! $collection instanceof Collection) { |
|
| 61 | + if ( ! $collection instanceof Collection) { |
|
| 62 | 62 | // @todo guilhermeblanco Conceptually, support to custom collections by replacing ArrayCollection creation. |
| 63 | 63 | $collection = new ArrayCollection((array) $collection); |
| 64 | 64 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $collection = new PersistentCollection($entityManager, $targetClass, $collection); |
| 69 | 69 | |
| 70 | 70 | $collection->setOwner($owner, $this); |
| 71 | - $collection->setDirty(! $collection->isEmpty()); |
|
| 71 | + $collection->setDirty( ! $collection->isEmpty()); |
|
| 72 | 72 | $collection->setInitialized(true); |
| 73 | 73 | |
| 74 | 74 | return $collection; |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | public function generate(string $filePath, ClassMetadataDefinition $definition) : void |
| 16 | 16 | { |
| 17 | - if (! file_exists($filePath)) { |
|
| 17 | + if ( ! file_exists($filePath)) { |
|
| 18 | 18 | parent::generate($filePath, $definition); |
| 19 | 19 | |
| 20 | 20 | return; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $this->ensureDirectoryIsReady(dirname($filePath)); |
| 37 | 37 | |
| 38 | - $tmpFileName = $filePath . '.' . uniqid('', true); |
|
| 38 | + $tmpFileName = $filePath.'.'.uniqid('', true); |
|
| 39 | 39 | |
| 40 | 40 | file_put_contents($tmpFileName, $sourceCode); |
| 41 | 41 | @chmod($tmpFileName, 0664); |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | private function ensureDirectoryIsReady(string $directory) |
| 51 | 51 | { |
| 52 | - if (! is_dir($directory) && (@mkdir($directory, 0775, true) === false)) { |
|
| 52 | + if ( ! is_dir($directory) && (@mkdir($directory, 0775, true) === false)) { |
|
| 53 | 53 | throw new \RuntimeException(sprintf('Your metadata directory "%s" must be writable', $directory)); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if (! is_writable($directory)) { |
|
| 56 | + if ( ! is_writable($directory)) { |
|
| 57 | 57 | throw new \RuntimeException(sprintf('Your proxy directory "%s" must be writable', $directory)); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | |
| 18 | 18 | protected function getReflectionService() : RuntimeReflectionService |
| 19 | 19 | { |
| 20 | - if (! $this->reflectionService) { |
|
| 20 | + if ( ! $this->reflectionService) { |
|
| 21 | 21 | $this->reflectionService = new RuntimeReflectionService(); |
| 22 | 22 | } |
| 23 | 23 | |