@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $this->expressionLanguage, |
70 | 70 | new ExpressionEncoderRegistry([]) |
71 | 71 | ); |
72 | - $this->blockFactory = new BlockFactory( |
|
72 | + $this->blockFactory = new BlockFactory( |
|
73 | 73 | $this->registry, |
74 | 74 | $this->layoutManipulator, |
75 | 75 | $expressionProcessor |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | $view = $this->getLayoutView(); |
100 | 100 | |
101 | 101 | $this->assertBlockView( |
102 | - [ // root |
|
102 | + [// root |
|
103 | 103 | 'vars' => ['id' => 'root'], |
104 | 104 | 'children' => [ |
105 | - [ // header |
|
105 | + [// header |
|
106 | 106 | 'vars' => ['id' => 'header'], |
107 | 107 | 'children' => [ |
108 | - [ // logo |
|
108 | + [// logo |
|
109 | 109 | 'vars' => ['id' => 'logo', 'title' => 'test'] |
110 | 110 | ] |
111 | 111 | ] |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $view = $this->getLayoutView(); |
125 | 125 | |
126 | 126 | $this->assertBlockView( |
127 | - [ // root |
|
127 | + [// root |
|
128 | 128 | 'vars' => [ |
129 | 129 | 'id' => 'rootId', |
130 | 130 | 'block_type' => 'root', |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $view = $this->getLayoutView(); |
157 | 157 | |
158 | 158 | $this->assertBlockView( |
159 | - [ // root |
|
159 | + [// root |
|
160 | 160 | 'vars' => [ |
161 | 161 | 'id' => 'rootId', |
162 | 162 | 'block_type' => 'root', |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | 'cache_key' => '_rootId_root' |
173 | 173 | ], |
174 | 174 | 'children' => [ |
175 | - [ // header |
|
175 | + [// header |
|
176 | 176 | 'vars' => [ |
177 | 177 | 'id' => 'headerId', |
178 | 178 | 'block_type' => 'header', |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | 'cache_key' => '_headerId_header' |
189 | 189 | ], |
190 | 190 | 'children' => [ |
191 | - [ // logo |
|
191 | + [// logo |
|
192 | 192 | 'vars' => [ |
193 | 193 | 'id' => 'logoId', |
194 | 194 | 'block_type' => 'logo', |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | ->method('updateLayout') |
248 | 248 | ->will( |
249 | 249 | $this->returnCallback( |
250 | - function (LayoutManipulatorInterface $layoutManipulator, LayoutItemInterface $item) { |
|
250 | + function(LayoutManipulatorInterface $layoutManipulator, LayoutItemInterface $item) { |
|
251 | 251 | $layoutManipulator->add('test', 'header', 'test'); |
252 | 252 | } |
253 | 253 | ) |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | ->method('configureOptions') |
262 | 262 | ->will( |
263 | 263 | $this->returnCallback( |
264 | - function (OptionsResolver $resolver) { |
|
264 | + function(OptionsResolver $resolver) { |
|
265 | 265 | $resolver->setDefaults( |
266 | 266 | [ |
267 | 267 | 'test_option_1' => '', |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | ->method('buildBlock') |
276 | 276 | ->will( |
277 | 277 | $this->returnCallback( |
278 | - function (BlockBuilderInterface $builder, Options $options) { |
|
278 | + function(BlockBuilderInterface $builder, Options $options) { |
|
279 | 279 | if ($options['test_option_1'] === 'move_logo_to_root') { |
280 | 280 | $builder->getLayoutManipulator()->move('logo', 'root'); |
281 | 281 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | ->method('buildView') |
287 | 287 | ->will( |
288 | 288 | $this->returnCallback( |
289 | - function (BlockView $view, BlockInterface $block, Options $options) { |
|
289 | + function(BlockView $view, BlockInterface $block, Options $options) { |
|
290 | 290 | $view->vars['attr']['block_id'] = $block->getId(); |
291 | 291 | if ($options['test_option_1'] === 'move_logo_to_root') { |
292 | 292 | $view->vars['attr']['logo_moved'] = true; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | ->method('finishView') |
300 | 300 | ->will( |
301 | 301 | $this->returnCallback( |
302 | - function (BlockView $view, BlockInterface $block) { |
|
302 | + function(BlockView $view, BlockInterface $block) { |
|
303 | 303 | if (isset($view['test'])) { |
304 | 304 | $view['test']->vars['processed_by_header_extension'] = true; |
305 | 305 | } |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | $view = $this->getLayoutView(); |
328 | 328 | |
329 | 329 | $this->assertBlockView( |
330 | - [ // root |
|
330 | + [// root |
|
331 | 331 | 'vars' => ['id' => 'root'], |
332 | 332 | 'children' => [ |
333 | - [ // header |
|
333 | + [// header |
|
334 | 334 | 'vars' => [ |
335 | 335 | 'id' => 'header', |
336 | 336 | 'attr' => [ |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | ] |
341 | 341 | ], |
342 | 342 | 'children' => [ |
343 | - [ // test |
|
343 | + [// test |
|
344 | 344 | 'vars' => [ |
345 | 345 | 'id' => 'test', |
346 | 346 | 'processed_by_header_extension' => true |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | ] |
349 | 349 | ] |
350 | 350 | ], |
351 | - [ // logo |
|
351 | + [// logo |
|
352 | 352 | 'vars' => ['id' => 'logo', 'title' => 'test'] |
353 | 353 | ] |
354 | 354 | ] |
@@ -378,13 +378,13 @@ discard block |
||
378 | 378 | $view = $this->getLayoutView(); |
379 | 379 | |
380 | 380 | $this->assertBlockView( |
381 | - [ // root |
|
381 | + [// root |
|
382 | 382 | 'vars' => ['id' => 'root'], |
383 | 383 | 'children' => [ |
384 | - [ // header |
|
384 | + [// header |
|
385 | 385 | 'vars' => ['id' => 'header'], |
386 | 386 | 'children' => [ |
387 | - [ // logo |
|
387 | + [// logo |
|
388 | 388 | 'vars' => ['id' => 'logo', 'title' => 'test title'] |
389 | 389 | ] |
390 | 390 | ] |
@@ -459,13 +459,13 @@ discard block |
||
459 | 459 | $view = $this->getLayoutView(); |
460 | 460 | |
461 | 461 | $this->assertBlockView( |
462 | - [ // root |
|
462 | + [// root |
|
463 | 463 | 'vars' => ['id' => 'root'], |
464 | 464 | 'children' => [ |
465 | - [ // header |
|
465 | + [// header |
|
466 | 466 | 'vars' => ['id' => 'header'], |
467 | 467 | 'children' => [ |
468 | - [ // logo |
|
468 | + [// logo |
|
469 | 469 | 'vars' => ['id' => 'logo', 'title' => 'one two'] |
470 | 470 | ] |
471 | 471 | ] |
@@ -40,6 +40,6 @@ |
||
40 | 40 | */ |
41 | 41 | public function isVisible() |
42 | 42 | { |
43 | - return array_key_exists('visible', $this->vars) ? (bool) $this->vars['visible'] : true; |
|
43 | + return array_key_exists('visible', $this->vars) ? (bool)$this->vars['visible'] : true; |
|
44 | 44 | } |
45 | 45 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->typeHelper, |
98 | 98 | $this->context |
99 | 99 | ); |
100 | - $this->block = new Block( |
|
100 | + $this->block = new Block( |
|
101 | 101 | $this->rawLayout, |
102 | 102 | $this->typeHelper, |
103 | 103 | $this->context, |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $view = new BlockView($parentView); |
235 | 235 | |
236 | 236 | if (is_null($resolvedOptions)) { // Try to resolve options again to render block |
237 | - $options = $this->rawLayout->getProperty($id, RawLayout::OPTIONS, true); |
|
237 | + $options = $this->rawLayout->getProperty($id, RawLayout::OPTIONS, true); |
|
238 | 238 | $resolvedOptions = $this->setBlockResolvedOptions($id, $blockType, $options, $types); |
239 | 239 | } |
240 | 240 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | array_walk_recursive( |
250 | 250 | $view->vars, |
251 | - function (&$var) { |
|
251 | + function(&$var) { |
|
252 | 252 | if ($var instanceof Options) { |
253 | 253 | $var = $var->toArray(); |
254 | 254 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $loader |
61 | 61 | ->expects($this->any()) |
62 | 62 | ->method('loadClassMetadata') |
63 | - ->will($this->returnCallback(function (ClassMetadata $meta) { |
|
63 | + ->will($this->returnCallback(function(ClassMetadata $meta) { |
|
64 | 64 | $this->loadMetadata($meta); |
65 | 65 | })); |
66 | 66 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | $factory->expects($this->any()) |
157 | 157 | ->method('getInstance') |
158 | - ->will($this->returnCallback(function (Constraint $constraint) { |
|
158 | + ->will($this->returnCallback(function(Constraint $constraint) { |
|
159 | 159 | $className = $constraint->validatedBy(); |
160 | 160 | |
161 | 161 | if (!isset($this->validators[$className]) |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | |
182 | 182 | $translator->expects($this->any()) |
183 | 183 | ->method('trans') |
184 | - ->will($this->returnCallback(function ($id) { |
|
184 | + ->will($this->returnCallback(function($id) { |
|
185 | 185 | return $id; |
186 | 186 | })) |
187 | 187 | ; |
188 | 188 | $translator->expects($this->any()) |
189 | 189 | ->method('transChoice') |
190 | - ->will($this->returnCallback(function ($id) { |
|
190 | + ->will($this->returnCallback(function($id) { |
|
191 | 191 | return $id; |
192 | 192 | })) |
193 | 193 | ; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | $em = $this->getEntityManager(true); |
150 | - $em->getConnection()->transactional(function (Connection $connection) use ($em, $job, $lockCallback) { |
|
150 | + $em->getConnection()->transactional(function(Connection $connection) use ($em, $job, $lockCallback) { |
|
151 | 151 | /** @var Job $job */ |
152 | 152 | $job = $em->find($this->entityClass, $job->getId(), LockMode::PESSIMISTIC_WRITE); |
153 | 153 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | // exception occurs but UniqueConstraintViolationException is expected here |
168 | 168 | // and we should keep EntityManager in open state. |
169 | 169 | $em = $this->getEntityManager(true); |
170 | - $em->getConnection()->transactional(function (Connection $connection) use ($job, $em) { |
|
170 | + $em->getConnection()->transactional(function(Connection $connection) use ($job, $em) { |
|
171 | 171 | try { |
172 | 172 | $connection->insert($this->uniqueTableName, ['name' => $job->getOwnerId()]); |
173 | 173 | if ($job->isUnique()) { |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | { |
51 | 51 | $data = JSON::decode($message->getBody()); |
52 | 52 | |
53 | - if (! isset($data['jobId'])) { |
|
53 | + if (!isset($data['jobId'])) { |
|
54 | 54 | $this->logger->critical('Got invalid message'); |
55 | 55 | |
56 | 56 | return self::REJECT; |
57 | 57 | } |
58 | 58 | |
59 | 59 | $job = $this->jobStorage->findJobById($data['jobId']); |
60 | - if (! $job) { |
|
60 | + if (!$job) { |
|
61 | 61 | $this->logger->critical( |
62 | 62 | sprintf('Job was not found. id: "%s"', $data['jobId']) |
63 | 63 | ); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | $progress = round($processed / $numberOfChildren, 4); |
94 | - $this->jobStorage->saveJob($rootJob, function (Job $rootJob) use ($progress) { |
|
94 | + $this->jobStorage->saveJob($rootJob, function(Job $rootJob) use ($progress) { |
|
95 | 95 | if ($progress !== $rootJob->getJobProgress()) { |
96 | 96 | $rootJob->setJobProgress($progress); |
97 | 97 | } |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function findOrCreateRootJob($ownerId, $jobName, $unique = false) |
92 | 92 | { |
93 | - if (! $ownerId) { |
|
93 | + if (!$ownerId) { |
|
94 | 94 | throw new \LogicException('OwnerId must not be empty'); |
95 | 95 | } |
96 | 96 | |
97 | - if (! $jobName) { |
|
97 | + if (!$jobName) { |
|
98 | 98 | throw new \LogicException('Job name must not be empty'); |
99 | 99 | } |
100 | 100 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $job->setLastActiveAt(new \DateTime()); |
112 | 112 | $job->setStartedAt(new \DateTime()); |
113 | 113 | $job->setJobProgress(0); |
114 | - $job->setUnique((bool) $unique); |
|
114 | + $job->setUnique((bool)$unique); |
|
115 | 115 | |
116 | 116 | return $this->saveJobAndStaleDuplicateIfQualifies($job); |
117 | 117 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | $timeBeforeStale = $this->getJobConfigurationProvider()->getTimeBeforeStaleForJobName($job->getName()); |
153 | 153 | if ($timeBeforeStale !== null && $timeBeforeStale != -1) { |
154 | - return $job->getLastActiveAt() <= new \DateTime('- ' . $timeBeforeStale. ' seconds'); |
|
154 | + return $job->getLastActiveAt() <= new \DateTime('- ' . $timeBeforeStale . ' seconds'); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | return false; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function findOrCreateChildJob($jobName, Job $rootJob) |
183 | 183 | { |
184 | - if (! $jobName) { |
|
184 | + if (!$jobName) { |
|
185 | 185 | throw new \LogicException('Job name must not be empty'); |
186 | 186 | } |
187 | 187 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | $job = $this->jobStorage->findJobById($job->getId()); |
219 | 219 | |
220 | - if (! in_array($job->getStatus(), $this->getNotStartedJobStatuses(), true)) { |
|
220 | + if (!in_array($job->getStatus(), $this->getNotStartedJobStatuses(), true)) { |
|
221 | 221 | throw new \LogicException(sprintf( |
222 | 222 | 'Can start only new jobs: id: "%s", status: "%s"', |
223 | 223 | $job->getId(), |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | throw new \LogicException(sprintf('Can\'t stale child jobs. id: "%s"', $rootJob->getId())); |
281 | 281 | } |
282 | 282 | |
283 | - $this->jobStorage->saveJob($rootJob, function (Job $rootJob) { |
|
283 | + $this->jobStorage->saveJob($rootJob, function(Job $rootJob) { |
|
284 | 284 | $rootJob->setStatus(Job::STATUS_STALE); |
285 | 285 | $rootJob->setStoppedAt(new \DateTime()); |
286 | 286 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | $job = $this->jobStorage->findJobById($job->getId()); |
361 | 361 | |
362 | - if (! in_array($job->getStatus(), $this->getActiveJobStatuses(), true)) { |
|
362 | + if (!in_array($job->getStatus(), $this->getActiveJobStatuses(), true)) { |
|
363 | 363 | throw new \LogicException(sprintf( |
364 | 364 | 'Can cancel only new or running jobs. id: "%s", status: "%s"', |
365 | 365 | $job->getId(), |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $job->setStatus(Job::STATUS_CANCELLED); |
371 | 371 | $job->setStoppedAt($stoppedAt = new \DateTime()); |
372 | 372 | |
373 | - if (! $job->getStartedAt()) { |
|
373 | + if (!$job->getStartedAt()) { |
|
374 | 374 | $job->setStartedAt($stoppedAt); |
375 | 375 | } |
376 | 376 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | return; |
429 | 429 | } |
430 | 430 | |
431 | - $this->jobStorage->saveJob($job, function (Job $job) use ($force) { |
|
431 | + $this->jobStorage->saveJob($job, function(Job $job) use ($force) { |
|
432 | 432 | if ($job->isInterrupted()) { |
433 | 433 | return; |
434 | 434 | } |
@@ -52,14 +52,14 @@ |
||
52 | 52 | { |
53 | 53 | $data = JSON::decode($message->getBody()); |
54 | 54 | |
55 | - if (! isset($data['jobId'])) { |
|
55 | + if (!isset($data['jobId'])) { |
|
56 | 56 | $this->logger->critical('Got invalid message'); |
57 | 57 | |
58 | 58 | return self::REJECT; |
59 | 59 | } |
60 | 60 | |
61 | 61 | $job = $this->jobStorage->findJobById($data['jobId']); |
62 | - if (! $job) { |
|
62 | + if (!$job) { |
|
63 | 63 | $this->logger->critical(sprintf('Job was not found. id: "%s"', $data['jobId'])); |
64 | 64 | |
65 | 65 | return self::REJECT; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'queue' => 'queue', |
41 | 41 | 'priority' => 1, |
42 | 42 | ]); |
43 | - $id = (int) $dbal->lastInsertId('message_queue_id_seq'); |
|
43 | + $id = (int)$dbal->lastInsertId('message_queue_id_seq'); |
|
44 | 44 | |
45 | 45 | //guard |
46 | 46 | $this->assertGreaterThan(0, $id); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | 'queue' => 'queue', |
69 | 69 | 'priority' => 1, |
70 | 70 | ]); |
71 | - $id = (int) $dbal->lastInsertId('message_queue_id_seq'); |
|
71 | + $id = (int)$dbal->lastInsertId('message_queue_id_seq'); |
|
72 | 72 | |
73 | 73 | //guard |
74 | 74 | $this->assertGreaterThan(0, $id); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 'priority' => 1, |
98 | 98 | 'consumer_id' => 123, |
99 | 99 | ]); |
100 | - $id = (int) $dbal->lastInsertId('message_queue_id_seq'); |
|
100 | + $id = (int)$dbal->lastInsertId('message_queue_id_seq'); |
|
101 | 101 | |
102 | 102 | //guard |
103 | 103 | $this->assertGreaterThan(0, $id); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $this->assertCount(1, $messages); |
122 | 122 | $this->assertNotEquals($id, $messages[0]['id']); |
123 | 123 | $this->assertNull($messages[0]['consumer_id']); |
124 | - $this->assertTrue((bool) $messages[0]['redelivered']); |
|
124 | + $this->assertTrue((bool)$messages[0]['redelivered']); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | public function testShouldReceiveMessage() |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | 'body' => 'message', |
135 | 135 | 'queue' => 'default', |
136 | 136 | ]); |
137 | - $id = (int) $dbal->lastInsertId('message_queue_id_seq'); |
|
137 | + $id = (int)$dbal->lastInsertId('message_queue_id_seq'); |
|
138 | 138 | |
139 | 139 | //guard |
140 | 140 | $this->assertGreaterThan(0, $id); |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | 'priority' => 5, |
160 | 160 | 'queue' => 'default', |
161 | 161 | ]); |
162 | - $id1 = (int) $dbal->lastInsertId('message_queue_id_seq'); |
|
162 | + $id1 = (int)$dbal->lastInsertId('message_queue_id_seq'); |
|
163 | 163 | |
164 | 164 | $dbal->insert('message_queue', [ |
165 | 165 | 'priority' => 10, |
166 | 166 | 'queue' => 'default', |
167 | 167 | ]); |
168 | - $id2 = (int) $dbal->lastInsertId('message_queue_id_seq'); |
|
168 | + $id2 = (int)$dbal->lastInsertId('message_queue_id_seq'); |
|
169 | 169 | |
170 | 170 | //guard |
171 | 171 | $this->assertGreaterThan(0, $id1); |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | 'priority' => 5, |
197 | 197 | 'queue' => 'default', |
198 | 198 | ]); |
199 | - $id1 = (int) $dbal->lastInsertId('message_queue_id_seq'); |
|
199 | + $id1 = (int)$dbal->lastInsertId('message_queue_id_seq'); |
|
200 | 200 | |
201 | 201 | $dbal->insert('message_queue', [ |
202 | 202 | 'priority' => 5, |
203 | 203 | 'queue' => 'default', |
204 | 204 | ]); |
205 | - $id2 = (int) $dbal->lastInsertId('message_queue_id_seq'); |
|
205 | + $id2 = (int)$dbal->lastInsertId('message_queue_id_seq'); |
|
206 | 206 | |
207 | 207 | //guard |
208 | 208 | $this->assertGreaterThan(0, $id1); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | 'queue' => 'default', |
235 | 235 | 'priority' => 1, |
236 | 236 | ]); |
237 | - $id = (int) $dbal->lastInsertId('message_queue_id_seq'); |
|
237 | + $id = (int)$dbal->lastInsertId('message_queue_id_seq'); |
|
238 | 238 | |
239 | 239 | //guard |
240 | 240 | $this->assertGreaterThan(0, $id); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | 'queue' => 'default', |
259 | 259 | 'priority' => 1, |
260 | 260 | ]); |
261 | - $id = (int) $dbal->lastInsertId('message_queue_id_seq'); |
|
261 | + $id = (int)$dbal->lastInsertId('message_queue_id_seq'); |
|
262 | 262 | |
263 | 263 | //guard |
264 | 264 | $this->assertGreaterThan(0, $id); |