@@ -38,6 +38,6 @@ |
||
38 | 38 | |
39 | 39 | $this->identifier = $identifier; |
40 | 40 | $this->entityClass = $entityClass; |
41 | - $this->hash = \str_replace('\\', '.', \strtolower($entityClass) . '_' . \implode(' ', $identifier)); |
|
41 | + $this->hash = \str_replace('\\', '.', \strtolower($entityClass).'_'.\implode(' ', $identifier)); |
|
42 | 42 | } |
43 | 43 | } |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function get(QueryCacheKey $key, ResultSetMapping $rsm, array $hints = []) |
64 | 64 | { |
65 | - if (! ($key->cacheMode & Cache::MODE_GET)) { |
|
65 | + if ( ! ($key->cacheMode & Cache::MODE_GET)) { |
|
66 | 66 | return null; |
67 | 67 | } |
68 | 68 | |
69 | 69 | $cacheEntry = $this->region->get($key); |
70 | 70 | |
71 | - if (! $cacheEntry instanceof QueryCacheEntry) { |
|
71 | + if ( ! $cacheEntry instanceof QueryCacheEntry) { |
|
72 | 72 | return null; |
73 | 73 | } |
74 | 74 | |
75 | - if (! $this->validator->isValid($key, $cacheEntry)) { |
|
75 | + if ( ! $this->validator->isValid($key, $cacheEntry)) { |
|
76 | 76 | $this->region->evict($key); |
77 | 77 | |
78 | 78 | return null; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | $cm = $this->em->getClassMetadata($entityName); |
90 | 90 | |
91 | - $generateKeys = static function (array $entry) use ($cm) : EntityCacheKey { |
|
91 | + $generateKeys = static function(array $entry) use ($cm) : EntityCacheKey { |
|
92 | 92 | return new EntityCacheKey($cm->getRootClassName(), $entry['identifier']); |
93 | 93 | }; |
94 | 94 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $this->cacheLogger->entityCacheHit($regionName, $cacheKeys->identifiers[$index]); |
112 | 112 | } |
113 | 113 | |
114 | - if (! $hasRelation) { |
|
114 | + if ( ! $hasRelation) { |
|
115 | 115 | $result[$index] = $unitOfWork->createEntity( |
116 | 116 | $entityEntry->class, |
117 | 117 | $entityEntry->resolveAssociationEntries($this->em), |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | continue; |
157 | 157 | } |
158 | 158 | |
159 | - if (! isset($assoc['list']) || empty($assoc['list'])) { |
|
159 | + if ( ! isset($assoc['list']) || empty($assoc['list'])) { |
|
160 | 160 | continue; |
161 | 161 | } |
162 | 162 | |
163 | - $generateKeys = static function ($id) use ($assocMetadata) : EntityCacheKey { |
|
163 | + $generateKeys = static function($id) use ($assocMetadata) : EntityCacheKey { |
|
164 | 164 | return new EntityCacheKey($assocMetadata->getRootClassName(), $id); |
165 | 165 | }; |
166 | 166 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | throw FeatureNotImplemented::multipleRootEntities(); |
240 | 240 | } |
241 | 241 | |
242 | - if (! $rsm->isSelect) { |
|
242 | + if ( ! $rsm->isSelect) { |
|
243 | 243 | throw FeatureNotImplemented::nonSelectStatements(); |
244 | 244 | } |
245 | 245 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | throw FeatureNotImplemented::partialEntities(); |
248 | 248 | } |
249 | 249 | |
250 | - if (! ($key->cacheMode & Cache::MODE_PUT)) { |
|
250 | + if ( ! ($key->cacheMode & Cache::MODE_PUT)) { |
|
251 | 251 | return false; |
252 | 252 | } |
253 | 253 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $unitOfWork = $this->em->getUnitOfWork(); |
258 | 258 | $persister = $unitOfWork->getEntityPersister($entityName); |
259 | 259 | |
260 | - if (! ($persister instanceof CachedPersister)) { |
|
260 | + if ( ! ($persister instanceof CachedPersister)) { |
|
261 | 261 | throw NonCacheableEntity::fromEntity($entityName); |
262 | 262 | } |
263 | 263 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | |
270 | 270 | if (($key->cacheMode & Cache::MODE_REFRESH) || ! $region->contains($entityKey)) { |
271 | 271 | // Cancel put result if entity put fail |
272 | - if (! $persister->storeEntityCache($entity, $entityKey)) { |
|
272 | + if ( ! $persister->storeEntityCache($entity, $entityKey)) { |
|
273 | 273 | return false; |
274 | 274 | } |
275 | 275 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | |
305 | 305 | // store single nested association |
306 | - if (! \is_array($assocValue)) { |
|
306 | + if ( ! \is_array($assocValue)) { |
|
307 | 307 | // Cancel put result if association put fail |
308 | 308 | if ($this->storeAssociationCache($key, $association, $assocValue) === null) { |
309 | 309 | return false; |
@@ -342,9 +342,9 @@ discard block |
||
342 | 342 | $assocIdentifier = $unitOfWork->getEntityIdentifier($assocValue); |
343 | 343 | $entityKey = new EntityCacheKey($assocMetadata->getRootClassName(), $assocIdentifier); |
344 | 344 | |
345 | - if ((! $assocValue instanceof GhostObjectInterface && ($key->cacheMode & Cache::MODE_REFRESH)) || ! $assocRegion->contains($entityKey)) { |
|
345 | + if (( ! $assocValue instanceof GhostObjectInterface && ($key->cacheMode & Cache::MODE_REFRESH)) || ! $assocRegion->contains($entityKey)) { |
|
346 | 346 | // Entity put fail |
347 | - if (! $assocPersister->storeEntityCache($assocValue, $entityKey)) { |
|
347 | + if ( ! $assocPersister->storeEntityCache($assocValue, $entityKey)) { |
|
348 | 348 | return null; |
349 | 349 | } |
350 | 350 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | if (($key->cacheMode & Cache::MODE_REFRESH) || ! $assocRegion->contains($entityKey)) { |
366 | 366 | // Entity put fail |
367 | - if (! $assocPersister->storeEntityCache($assocItem, $entityKey)) { |
|
367 | + if ( ! $assocPersister->storeEntityCache($assocItem, $entityKey)) { |
|
368 | 368 | return null; |
369 | 369 | } |
370 | 370 | } |
@@ -137,7 +137,7 @@ |
||
137 | 137 | $targetHydrator = $targetPersister->getEntityHydrator(); |
138 | 138 | |
139 | 139 | // Only preserve ordering if association configured it |
140 | - if (! ($association instanceof ToManyAssociationMetadata && $association->getIndexedBy())) { |
|
140 | + if ( ! ($association instanceof ToManyAssociationMetadata && $association->getIndexedBy())) { |
|
141 | 141 | // Elements may be an array or a Collection |
142 | 142 | $elements = \array_values($elements instanceof Collection ? $elements->getValues() : $elements); |
143 | 143 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | ? $this->persister->expandCriteriaParameters($criteria) |
260 | 260 | : $this->persister->expandParameters($criteria); |
261 | 261 | |
262 | - return \sha1($query . \serialize($params) . \serialize($orderBy) . $limit . $offset); |
|
262 | + return \sha1($query.\serialize($params).\serialize($orderBy).$limit.$offset); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $hasCache = ($persister instanceof CachedPersister); |
558 | 558 | $key = null; |
559 | 559 | |
560 | - if (! $hasCache) { |
|
560 | + if ( ! $hasCache) { |
|
561 | 561 | return $this->persister->loadManyToManyCollection($association, $sourceEntity, $collection); |
562 | 562 | } |
563 | 563 | |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | $persister = $uow->getCollectionPersister($association); |
597 | 597 | $hasCache = ($persister instanceof CachedPersister); |
598 | 598 | |
599 | - if (! $hasCache) { |
|
599 | + if ( ! $hasCache) { |
|
600 | 600 | return $this->persister->loadOneToManyCollection($association, $sourceEntity, $collection); |
601 | 601 | } |
602 | 602 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $metadata = $this->em->getClassMetadata($className); |
56 | 56 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
57 | 57 | |
58 | - if (! ($persister instanceof CachedPersister)) { |
|
58 | + if ( ! ($persister instanceof CachedPersister)) { |
|
59 | 59 | return null; |
60 | 60 | } |
61 | 61 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $metadata = $this->em->getClassMetadata($className); |
71 | 71 | $persister = $this->uow->getCollectionPersister($metadata->getProperty($association)); |
72 | 72 | |
73 | - if (! ($persister instanceof CachedPersister)) { |
|
73 | + if ( ! ($persister instanceof CachedPersister)) { |
|
74 | 74 | return null; |
75 | 75 | } |
76 | 76 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $metadata = $this->em->getClassMetadata($className); |
86 | 86 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
87 | 87 | |
88 | - if (! ($persister instanceof CachedPersister)) { |
|
88 | + if ( ! ($persister instanceof CachedPersister)) { |
|
89 | 89 | return false; |
90 | 90 | } |
91 | 91 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $metadata = $this->em->getClassMetadata($className); |
101 | 101 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
102 | 102 | |
103 | - if (! ($persister instanceof CachedPersister)) { |
|
103 | + if ( ! ($persister instanceof CachedPersister)) { |
|
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $metadata = $this->em->getClassMetadata($className); |
116 | 116 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
117 | 117 | |
118 | - if (! ($persister instanceof CachedPersister)) { |
|
118 | + if ( ! ($persister instanceof CachedPersister)) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | foreach ($metadatas as $metadata) { |
133 | 133 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
134 | 134 | |
135 | - if (! ($persister instanceof CachedPersister)) { |
|
135 | + if ( ! ($persister instanceof CachedPersister)) { |
|
136 | 136 | continue; |
137 | 137 | } |
138 | 138 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $metadata = $this->em->getClassMetadata($className); |
149 | 149 | $persister = $this->uow->getCollectionPersister($metadata->getProperty($association)); |
150 | 150 | |
151 | - if (! ($persister instanceof CachedPersister)) { |
|
151 | + if ( ! ($persister instanceof CachedPersister)) { |
|
152 | 152 | return false; |
153 | 153 | } |
154 | 154 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $metadata = $this->em->getClassMetadata($className); |
164 | 164 | $persister = $this->uow->getCollectionPersister($metadata->getProperty($association)); |
165 | 165 | |
166 | - if (! ($persister instanceof CachedPersister)) { |
|
166 | + if ( ! ($persister instanceof CachedPersister)) { |
|
167 | 167 | return; |
168 | 168 | } |
169 | 169 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $metadata = $this->em->getClassMetadata($className); |
179 | 179 | $persister = $this->uow->getCollectionPersister($metadata->getProperty($association)); |
180 | 180 | |
181 | - if (! ($persister instanceof CachedPersister)) { |
|
181 | + if ( ! ($persister instanceof CachedPersister)) { |
|
182 | 182 | return; |
183 | 183 | } |
184 | 184 | |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | |
195 | 195 | foreach ($metadatas as $metadata) { |
196 | 196 | foreach ($metadata->getPropertiesIterator() as $association) { |
197 | - if (! $association instanceof ToManyAssociationMetadata) { |
|
197 | + if ( ! $association instanceof ToManyAssociationMetadata) { |
|
198 | 198 | continue; |
199 | 199 | } |
200 | 200 | |
201 | 201 | $persister = $this->uow->getCollectionPersister($association); |
202 | 202 | |
203 | - if (! ($persister instanceof CachedPersister)) { |
|
203 | + if ( ! ($persister instanceof CachedPersister)) { |
|
204 | 204 | continue; |
205 | 205 | } |
206 | 206 | |
@@ -251,11 +251,10 @@ discard block |
||
251 | 251 | public function getQueryCache($regionName = null) |
252 | 252 | { |
253 | 253 | if ($regionName === null) { |
254 | - return $this->defaultQueryCache ?: |
|
255 | - $this->defaultQueryCache = $this->cacheFactory->buildQueryCache($this->em); |
|
254 | + return $this->defaultQueryCache ?: $this->defaultQueryCache = $this->cacheFactory->buildQueryCache($this->em); |
|
256 | 255 | } |
257 | 256 | |
258 | - if (! isset($this->queryCaches[$regionName])) { |
|
257 | + if ( ! isset($this->queryCaches[$regionName])) { |
|
259 | 258 | $this->queryCaches[$regionName] = $this->cacheFactory->buildQueryCache($this->em, $regionName); |
260 | 259 | } |
261 | 260 | |
@@ -270,7 +269,7 @@ discard block |
||
270 | 269 | */ |
271 | 270 | private function buildEntityCacheKey(ClassMetadata $metadata, $identifier) |
272 | 271 | { |
273 | - if (! \is_array($identifier)) { |
|
272 | + if ( ! \is_array($identifier)) { |
|
274 | 273 | $identifier = $this->toIdentifierArray($metadata, $identifier); |
275 | 274 | } |
276 | 275 | |
@@ -286,7 +285,7 @@ discard block |
||
286 | 285 | */ |
287 | 286 | private function buildCollectionCacheKey(ClassMetadata $metadata, $association, $ownerIdentifier) |
288 | 287 | { |
289 | - if (! \is_array($ownerIdentifier)) { |
|
288 | + if ( ! \is_array($ownerIdentifier)) { |
|
290 | 289 | $ownerIdentifier = $this->toIdentifierArray($metadata, $ownerIdentifier); |
291 | 290 | } |
292 | 291 |
@@ -47,6 +47,6 @@ |
||
47 | 47 | $this->ownerIdentifier = $ownerIdentifier; |
48 | 48 | $this->entityClass = (string) $entityClass; |
49 | 49 | $this->association = (string) $association; |
50 | - $this->hash = \str_replace('\\', '.', \strtolower($entityClass)) . '_' . \implode(' ', $ownerIdentifier) . '__' . $association; |
|
50 | + $this->hash = \str_replace('\\', '.', \strtolower($entityClass)).'_'.\implode(' ', $ownerIdentifier).'__'.$association; |
|
51 | 51 | } |
52 | 52 | } |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function __construct(Region $region, $directory, $lockLifetime) |
54 | 54 | { |
55 | - if (! \is_dir($directory) && ! @\mkdir($directory, 0775, true)) { |
|
55 | + if ( ! \is_dir($directory) && ! @\mkdir($directory, 0775, true)) { |
|
56 | 56 | throw new InvalidArgumentException(\sprintf('The directory "%s" does not exist and could not be created.', $directory)); |
57 | 57 | } |
58 | 58 | |
59 | - if (! \is_writable($directory)) { |
|
59 | + if ( ! \is_writable($directory)) { |
|
60 | 60 | throw new InvalidArgumentException(\sprintf('The directory "%s" is not writable.', $directory)); |
61 | 61 | } |
62 | 62 | |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | { |
73 | 73 | $filename = $this->getLockFileName($key); |
74 | 74 | |
75 | - if (! \is_file($filename)) { |
|
75 | + if ( ! \is_file($filename)) { |
|
76 | 76 | return false; |
77 | 77 | } |
78 | 78 | |
79 | 79 | $time = $this->getLockTime($filename); |
80 | 80 | $content = $this->getLockContent($filename); |
81 | 81 | |
82 | - if (! $content || ! $time) { |
|
82 | + if ( ! $content || ! $time) { |
|
83 | 83 | @\unlink($filename); |
84 | 84 | |
85 | 85 | return false; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | private function getLockFileName(CacheKey $key) |
106 | 106 | { |
107 | - return $this->directory . DIRECTORY_SEPARATOR . $key->hash . '.' . self::LOCK_EXTENSION; |
|
107 | + return $this->directory.DIRECTORY_SEPARATOR.$key->hash.'.'.self::LOCK_EXTENSION; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $lock = Lock::createLockRead(); |
226 | 226 | $filename = $this->getLockFileName($key); |
227 | 227 | |
228 | - if (! @\file_put_contents($filename, $lock->value, LOCK_EX)) { |
|
228 | + if ( ! @\file_put_contents($filename, $lock->value, LOCK_EX)) { |
|
229 | 229 | return null; |
230 | 230 | } |
231 | 231 | \chmod($filename, 0664); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected function getCacheEntryKey(CacheKey $key) |
103 | 103 | { |
104 | - return $this->name . self::REGION_KEY_SEPARATOR . $key->hash; |
|
104 | + return $this->name.self::REGION_KEY_SEPARATOR.$key->hash; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function evictAll() |
127 | 127 | { |
128 | - if (! $this->cache instanceof ClearableCache) { |
|
128 | + if ( ! $this->cache instanceof ClearableCache) { |
|
129 | 129 | throw new BadMethodCallException(\sprintf( |
130 | 130 | 'Clearing all cache entries is not supported by the supplied cache adapter of type %s', |
131 | 131 | \get_class($this->cache) |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public static function fromDriver(Cache $cache) : self |
14 | 14 | { |
15 | 15 | return new self( |
16 | - 'Query Cache uses a non-persistent cache driver, ' . \get_class($cache) . '.' |
|
16 | + 'Query Cache uses a non-persistent cache driver, '.\get_class($cache).'.' |
|
17 | 17 | ); |
18 | 18 | } |
19 | 19 | } |