Completed
Pull Request — master (#651)
by Jeroen De
46:55
created
src/Factories/FunFunFactory.php 1 patch
Spacing   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types = 1 );
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace WMDE\Fundraising\Frontend\Factories;
6 6
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	private $profiler = null;
167 167
 
168
-	public function __construct( array $config ) {
168
+	public function __construct(array $config) {
169 169
 		$this->config = $config;
170 170
 		$this->pimple = $this->newPimple();
171 171
 	}
@@ -173,113 +173,113 @@  discard block
 block discarded – undo
173 173
 	private function newPimple(): \Pimple {
174 174
 		$pimple = new \Pimple();
175 175
 
176
-		$pimple['logger'] = $pimple->share( function() {
176
+		$pimple['logger'] = $pimple->share(function() {
177 177
 			return new NullLogger();
178 178
 		} );
179 179
 
180
-		$pimple['profiler_data_collector'] = $pimple->share( function() {
180
+		$pimple['profiler_data_collector'] = $pimple->share(function() {
181 181
 			return new ProfilerDataCollector();
182 182
 		} );
183 183
 
184
-		$pimple['dbal_connection'] = $pimple->share( function() {
185
-			return DriverManager::getConnection( $this->config['db'] );
184
+		$pimple['dbal_connection'] = $pimple->share(function() {
185
+			return DriverManager::getConnection($this->config['db']);
186 186
 		} );
187 187
 
188
-		$pimple['entity_manager'] = $pimple->share( function() {
189
-			$entityManager = ( new StoreFactory( $this->getConnection() ) )->getEntityManager();
190
-			if ( $this->addDoctrineSubscribers ) {
191
-				$entityManager->getEventManager()->addEventSubscriber( $this->newDoctrineDonationPrePersistSubscriber() );
192
-				$entityManager->getEventManager()->addEventSubscriber( $this->newDoctrineMembershipApplicationPrePersistSubscriber() );
188
+		$pimple['entity_manager'] = $pimple->share(function() {
189
+			$entityManager = (new StoreFactory($this->getConnection()))->getEntityManager();
190
+			if ($this->addDoctrineSubscribers) {
191
+				$entityManager->getEventManager()->addEventSubscriber($this->newDoctrineDonationPrePersistSubscriber());
192
+				$entityManager->getEventManager()->addEventSubscriber($this->newDoctrineMembershipApplicationPrePersistSubscriber());
193 193
 			}
194 194
 
195 195
 			return $entityManager;
196 196
 		} );
197 197
 
198
-		$pimple['subscription_repository'] = $pimple->share( function() {
198
+		$pimple['subscription_repository'] = $pimple->share(function() {
199 199
 			return new LoggingSubscriptionRepository(
200
-				new DoctrineSubscriptionRepository( $this->getEntityManager() ),
200
+				new DoctrineSubscriptionRepository($this->getEntityManager()),
201 201
 				$this->getLogger()
202 202
 			);
203 203
 		} );
204 204
 
205
-		$pimple['donation_repository'] = $pimple->share( function() {
205
+		$pimple['donation_repository'] = $pimple->share(function() {
206 206
 			return new LoggingDonationRepository(
207
-				new DoctrineDonationRepository( $this->getEntityManager() ),
207
+				new DoctrineDonationRepository($this->getEntityManager()),
208 208
 				$this->getLogger()
209 209
 			);
210 210
 		} );
211 211
 
212
-		$pimple['membership_application_repository'] = $pimple->share( function() {
212
+		$pimple['membership_application_repository'] = $pimple->share(function() {
213 213
 			return new LoggingApplicationRepository(
214
-				new DoctrineApplicationRepository( $this->getEntityManager() ),
214
+				new DoctrineApplicationRepository($this->getEntityManager()),
215 215
 				$this->getLogger()
216 216
 			);
217 217
 		} );
218 218
 
219
-		$pimple['comment_repository'] = $pimple->share( function() {
219
+		$pimple['comment_repository'] = $pimple->share(function() {
220 220
 			$finder = new LoggingCommentFinder(
221
-				new DoctrineCommentFinder( $this->getEntityManager() ),
221
+				new DoctrineCommentFinder($this->getEntityManager()),
222 222
 				$this->getLogger()
223 223
 			);
224 224
 
225
-			return $this->addProfilingDecorator( $finder, 'CommentFinder' );
225
+			return $this->addProfilingDecorator($finder, 'CommentFinder');
226 226
 		} );
227 227
 
228
-		$pimple['mail_validator'] = $pimple->share( function() {
229
-			return new EmailValidator( new InternetDomainNameValidator() );
228
+		$pimple['mail_validator'] = $pimple->share(function() {
229
+			return new EmailValidator(new InternetDomainNameValidator());
230 230
 		} );
231 231
 
232
-		$pimple['subscription_validator'] = $pimple->share( function() {
232
+		$pimple['subscription_validator'] = $pimple->share(function() {
233 233
 			return new SubscriptionValidator(
234 234
 				$this->getEmailValidator(),
235
-				$this->newTextPolicyValidator( 'fields' ),
235
+				$this->newTextPolicyValidator('fields'),
236 236
 				$this->newSubscriptionDuplicateValidator(),
237 237
 				$this->newHonorificValidator()
238 238
 			);
239 239
 		} );
240 240
 
241
-		$pimple['template_name_validator'] = $pimple->share( function() {
242
-			return new TemplateNameValidator( $this->getTwig() );
241
+		$pimple['template_name_validator'] = $pimple->share(function() {
242
+			return new TemplateNameValidator($this->getTwig());
243 243
 		} );
244 244
 
245
-		$pimple['contact_validator'] = $pimple->share( function() {
246
-			return new GetInTouchValidator( $this->getEmailValidator() );
245
+		$pimple['contact_validator'] = $pimple->share(function() {
246
+			return new GetInTouchValidator($this->getEmailValidator());
247 247
 		} );
248 248
 
249
-		$pimple['greeting_generator'] = $pimple->share( function() {
249
+		$pimple['greeting_generator'] = $pimple->share(function() {
250 250
 			return new GreetingGenerator();
251 251
 		} );
252 252
 
253
-		$pimple['mw_api'] = $pimple->share( function() {
253
+		$pimple['mw_api'] = $pimple->share(function() {
254 254
 			return new MediawikiApi(
255 255
 				$this->config['cms-wiki-api-url'],
256 256
 				$this->getGuzzleClient()
257 257
 			);
258 258
 		} );
259 259
 
260
-		$pimple['guzzle_client'] = $pimple->share( function() {
260
+		$pimple['guzzle_client'] = $pimple->share(function() {
261 261
 			$middlewareFactory = new MiddlewareFactory();
262
-			$middlewareFactory->setLogger( $this->getLogger() );
262
+			$middlewareFactory->setLogger($this->getLogger());
263 263
 
264
-			$handlerStack = HandlerStack::create( new CurlHandler() );
265
-			$handlerStack->push( $middlewareFactory->retry() );
264
+			$handlerStack = HandlerStack::create(new CurlHandler());
265
+			$handlerStack->push($middlewareFactory->retry());
266 266
 
267
-			$guzzle = new Client( [
267
+			$guzzle = new Client([
268 268
 				'cookies' => true,
269 269
 				'handler' => $handlerStack,
270
-				'headers' => [ 'User-Agent' => 'WMDE Fundraising Frontend' ],
271
-			] );
270
+				'headers' => ['User-Agent' => 'WMDE Fundraising Frontend'],
271
+			]);
272 272
 
273
-			return $this->addProfilingDecorator( $guzzle, 'Guzzle Client' );
273
+			return $this->addProfilingDecorator($guzzle, 'Guzzle Client');
274 274
 		} );
275 275
 
276
-		$pimple['translator'] = $pimple->share( function() {
276
+		$pimple['translator'] = $pimple->share(function() {
277 277
 			$translationFactory = new TranslationFactory();
278 278
 			$loaders = [
279 279
 				'json' => $translationFactory->newJsonLoader()
280 280
 			];
281 281
 			$locale = $this->config['locale'];
282
-			$translator = $translationFactory->create( $loaders, $locale );
282
+			$translator = $translationFactory->create($loaders, $locale);
283 283
 			$translator->addResource(
284 284
 				'json',
285 285
 				__DIR__ . '/../../app/translations/messages.' . $locale . '.json',
@@ -318,36 +318,36 @@  discard block
 block discarded – undo
318 318
 		} );
319 319
 
320 320
 		// In the future, this could be locale-specific or filled from a DB table
321
-		$pimple['honorifics'] = $pimple->share( function() {
322
-			return new Honorifics( [
321
+		$pimple['honorifics'] = $pimple->share(function() {
322
+			return new Honorifics([
323 323
 				'' => 'Kein Titel',
324 324
 				'Dr.' => 'Dr.',
325 325
 				'Prof.' => 'Prof.',
326 326
 				'Prof. Dr.' => 'Prof. Dr.'
327
-			] );
327
+			]);
328 328
 		} );
329 329
 
330
-		$pimple['twig_factory'] = $pimple->share( function () {
330
+		$pimple['twig_factory'] = $pimple->share(function() {
331 331
 			// TODO: like this we end up with two Twig instance, one created here and on in the framework
332
-			return new TwigFactory( $this->config['twig'], $this->getCachePath() . '/twig' );
332
+			return new TwigFactory($this->config['twig'], $this->getCachePath() . '/twig');
333 333
 		} );
334 334
 
335
-		$pimple['twig'] = $pimple->share( function() {
335
+		$pimple['twig'] = $pimple->share(function() {
336 336
 			$twigFactory = $this->getTwigFactory();
337
-			$loaders = array_filter( [
337
+			$loaders = array_filter([
338 338
 				$twigFactory->newFileSystemLoader(),
339 339
 				$twigFactory->newArrayLoader(), // This is just a fallback for testing
340
-				$twigFactory->newWikiPageLoader( $this->newWikiPageRetriever() ),
341
-			] );
340
+				$twigFactory->newWikiPageLoader($this->newWikiPageRetriever()),
341
+			]);
342 342
 			$extensions = [
343
-				$twigFactory->newTranslationExtension( $this->getTranslator() ),
343
+				$twigFactory->newTranslationExtension($this->getTranslator()),
344 344
 				new Twig_Extensions_Extension_Intl()
345 345
 			];
346 346
 
347
-			return $twigFactory->create( $loaders, $extensions );
347
+			return $twigFactory->create($loaders, $extensions);
348 348
 		} );
349 349
 
350
-		$pimple['messenger'] = $pimple->share( function() {
350
+		$pimple['messenger'] = $pimple->share(function() {
351 351
 			return new Messenger(
352 352
 				new Swift_MailTransport(),
353 353
 				$this->getOperatorAddress(),
@@ -355,11 +355,11 @@  discard block
 block discarded – undo
355 355
 			);
356 356
 		} );
357 357
 
358
-		$pimple['confirmation-page-selector'] = $pimple->share( function() {
359
-			return new DonationConfirmationPageSelector( $this->config['confirmation-pages'] );
358
+		$pimple['confirmation-page-selector'] = $pimple->share(function() {
359
+			return new DonationConfirmationPageSelector($this->config['confirmation-pages']);
360 360
 		} );
361 361
 
362
-		$pimple['paypal-payment-notification-verifier'] = $pimple->share( function() {
362
+		$pimple['paypal-payment-notification-verifier'] = $pimple->share(function() {
363 363
 			return new LoggingPaymentNotificationVerifier(
364 364
 				new PayPalPaymentNotificationVerifier(
365 365
 					new Client(),
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 			);
370 370
 		} );
371 371
 
372
-		$pimple['credit-card-api-service'] = $pimple->share( function() {
372
+		$pimple['credit-card-api-service'] = $pimple->share(function() {
373 373
 			return new McpCreditCardService(
374 374
 				new TNvpServiceDispatcher(
375 375
 					'IMcpCreditcardService_v1_5',
@@ -380,14 +380,14 @@  discard block
 block discarded – undo
380 380
 			);
381 381
 		} );
382 382
 
383
-		$pimple['token_generator'] = $pimple->share( function() {
383
+		$pimple['token_generator'] = $pimple->share(function() {
384 384
 			return new RandomTokenGenerator(
385 385
 				$this->config['token-length'],
386
-				new \DateInterval( $this->config['token-validity-timestamp'] )
386
+				new \DateInterval($this->config['token-validity-timestamp'])
387 387
 			);
388 388
 		} );
389 389
 
390
-		$pimple['page_cache'] = $pimple->share( function() {
390
+		$pimple['page_cache'] = $pimple->share(function() {
391 391
 			return new VoidCache();
392 392
 		} );
393 393
 
@@ -404,17 +404,17 @@  discard block
 block discarded – undo
404 404
 
405 405
 	private function newDonationEventLogger(): DonationEventLogger {
406 406
 		return new BestEffortDonationEventLogger(
407
-			new DoctrineDonationEventLogger( $this->getEntityManager() ),
407
+			new DoctrineDonationEventLogger($this->getEntityManager()),
408 408
 			$this->getLogger()
409 409
 		);
410 410
 	}
411 411
 
412 412
 	public function newInstaller(): Installer {
413
-		return ( new StoreFactory( $this->getConnection() ) )->newInstaller();
413
+		return (new StoreFactory($this->getConnection()))->newInstaller();
414 414
 	}
415 415
 
416 416
 	public function newListCommentsUseCase(): ListCommentsUseCase {
417
-		return new ListCommentsUseCase( $this->getCommentFinder() );
417
+		return new ListCommentsUseCase($this->getCommentFinder());
418 418
 	}
419 419
 
420 420
 	public function newCommentListJsonPresenter(): CommentListJsonPresenter {
@@ -422,14 +422,14 @@  discard block
 block discarded – undo
422 422
 	}
423 423
 
424 424
 	public function newCommentListRssPresenter(): CommentListRssPresenter {
425
-		return new CommentListRssPresenter( new TwigTemplate(
425
+		return new CommentListRssPresenter(new TwigTemplate(
426 426
 			$this->getTwig(),
427 427
 			'CommentList.rss.twig'
428
-		) );
428
+		));
429 429
 	}
430 430
 
431 431
 	public function newCommentListHtmlPresenter(): CommentListHtmlPresenter {
432
-		return new CommentListHtmlPresenter( $this->getLayoutTemplate( 'CommentList.html.twig', [ 'piwikGoals' => [ 1 ] ] ) );
432
+		return new CommentListHtmlPresenter($this->getLayoutTemplate('CommentList.html.twig', ['piwikGoals' => [1]]));
433 433
 	}
434 434
 
435 435
 	private function getCommentFinder(): CommentFinder {
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 		return $this->pimple['subscription_repository'];
441 441
 	}
442 442
 
443
-	public function setSubscriptionRepository( SubscriptionRepository $subscriptionRepository ) {
443
+	public function setSubscriptionRepository(SubscriptionRepository $subscriptionRepository) {
444 444
 		$this->pimple['subscription_repository'] = $subscriptionRepository;
445 445
 	}
446 446
 
@@ -457,22 +457,22 @@  discard block
 block discarded – undo
457 457
 	}
458 458
 
459 459
 	public function newAddSubscriptionHTMLPresenter(): AddSubscriptionHtmlPresenter {
460
-		return new AddSubscriptionHtmlPresenter( $this->getIncludeTemplate( 'Subscription_Form.twig' ), $this->getTranslator() );
460
+		return new AddSubscriptionHtmlPresenter($this->getIncludeTemplate('Subscription_Form.twig'), $this->getTranslator());
461 461
 	}
462 462
 
463 463
 	public function newConfirmSubscriptionHtmlPresenter(): ConfirmSubscriptionHtmlPresenter {
464 464
 		return new ConfirmSubscriptionHtmlPresenter(
465
-			$this->getLayoutTemplate( 'ConfirmSubscription.html.twig' ),
465
+			$this->getLayoutTemplate('ConfirmSubscription.html.twig'),
466 466
 			$this->getTranslator()
467 467
 		);
468 468
 	}
469 469
 
470 470
 	public function newAddSubscriptionJSONPresenter(): AddSubscriptionJsonPresenter {
471
-		return new AddSubscriptionJsonPresenter( $this->getTranslator() );
471
+		return new AddSubscriptionJsonPresenter($this->getTranslator());
472 472
 	}
473 473
 
474 474
 	public function newGetInTouchHTMLPresenter(): GetInTouchHtmlPresenter {
475
-		return new GetInTouchHtmlPresenter( $this->getIncludeTemplate( 'Kontaktformular.twig' ), $this->getTranslator() );
475
+		return new GetInTouchHtmlPresenter($this->getIncludeTemplate('Kontaktformular.twig'), $this->getTranslator());
476 476
 	}
477 477
 
478 478
 	public function getTwig(): Twig_Environment {
@@ -486,11 +486,11 @@  discard block
 block discarded – undo
486 486
 	 * @param array $context Additional variables for the template
487 487
 	 * @return TwigTemplate
488 488
 	 */
489
-	public function getLayoutTemplate( string $templateName, array $context = [] ): TwigTemplate {
489
+	public function getLayoutTemplate(string $templateName, array $context = []): TwigTemplate {
490 490
 		 return new TwigTemplate(
491 491
 			$this->getTwig(),
492 492
 			$templateName,
493
-			array_merge( $this->getDefaultTwigVariables(), $context )
493
+			array_merge($this->getDefaultTwigVariables(), $context)
494 494
 		);
495 495
 	}
496 496
 
@@ -500,13 +500,13 @@  discard block
 block discarded – undo
500 500
 	 * @param string $templateName Template to include
501 501
 	 * @return TwigTemplate
502 502
 	 */
503
-	private function getIncludeTemplate( string $templateName, array $context = [] ): TwigTemplate {
503
+	private function getIncludeTemplate(string $templateName, array $context = []): TwigTemplate {
504 504
 		return new TwigTemplate(
505 505
 			$this->getTwig(),
506 506
 			'IncludeInLayout.twig',
507 507
 			array_merge(
508 508
 				$this->getDefaultTwigVariables(),
509
-				[ 'main_template' => $templateName ],
509
+				['main_template' => $templateName],
510 510
 				$context
511 511
 			)
512 512
 		);
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 		return $this->pimple['mw_api'];
535 535
 	}
536 536
 
537
-	public function setMediaWikiApi( MediawikiApi $api ) {
537
+	public function setMediaWikiApi(MediawikiApi $api) {
538 538
 		$this->pimple['mw_api'] = $api;
539 539
 	}
540 540
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	private function newWikiPageRetriever(): PageRetriever {
546 546
 		$PageRetriever = $this->newCachedPageRetriever();
547 547
 
548
-		return $this->addProfilingDecorator( $PageRetriever, 'PageRetriever' );
548
+		return $this->addProfilingDecorator($PageRetriever, 'PageRetriever');
549 549
 	}
550 550
 
551 551
 	private function newCachedPageRetriever(): PageRetriever {
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	private function newNonCachedApiPageRetriever(): PageRetriever {
559 559
 		return new ApiBasedPageRetriever(
560 560
 			$this->getMediaWikiApi(),
561
-			new ApiUser( $this->config['cms-wiki-user'], $this->config['cms-wiki-password'] ),
561
+			new ApiUser($this->config['cms-wiki-user'], $this->config['cms-wiki-password']),
562 562
 			$this->getLogger(),
563 563
 			$this->config['cms-wiki-title-prefix']
564 564
 		);
@@ -618,22 +618,22 @@  discard block
 block discarded – undo
618 618
 			new TwigTemplate(
619 619
 					$this->getTwig(),
620 620
 					'Mail_Subscription_Confirmation.twig',
621
-					[ 'greeting_generator' => $this->getGreetingGenerator() ]
621
+					['greeting_generator' => $this->getGreetingGenerator()]
622 622
 			),
623 623
 			'mail_subject_membership'
624 624
 		);
625 625
 	}
626 626
 
627
-	private function newTemplateMailer( TwigTemplate $template, string $messageKey ): TemplateBasedMailer {
627
+	private function newTemplateMailer(TwigTemplate $template, string $messageKey): TemplateBasedMailer {
628 628
 		$mailer = new TemplateBasedMailer(
629 629
 			$this->getMessenger(),
630 630
 			$template,
631
-			$this->getTranslator()->trans( $messageKey )
631
+			$this->getTranslator()->trans($messageKey)
632 632
 		);
633 633
 
634
-		$mailer = new LoggingMailer( $mailer, $this->getLogger() );
634
+		$mailer = new LoggingMailer($mailer, $this->getLogger());
635 635
 
636
-		return $this->addProfilingDecorator( $mailer, 'Mailer' );
636
+		return $this->addProfilingDecorator($mailer, 'Mailer');
637 637
 	}
638 638
 
639 639
 	public function getGreetingGenerator() {
@@ -641,11 +641,11 @@  discard block
 block discarded – undo
641 641
 	}
642 642
 
643 643
 	public function newCheckIbanUseCase(): CheckIbanUseCase {
644
-		return new CheckIbanUseCase( $this->newBankDataConverter(), $this->newIbanValidator() );
644
+		return new CheckIbanUseCase($this->newBankDataConverter(), $this->newIbanValidator());
645 645
 	}
646 646
 
647 647
 	public function newGenerateIbanUseCase(): GenerateIbanUseCase {
648
-		return new GenerateIbanUseCase( $this->newBankDataConverter(), $this->newIbanValidator() );
648
+		return new GenerateIbanUseCase($this->newBankDataConverter(), $this->newIbanValidator());
649 649
 	}
650 650
 
651 651
 	public function newIbanPresenter(): IbanPresenter {
@@ -653,14 +653,14 @@  discard block
 block discarded – undo
653 653
 	}
654 654
 
655 655
 	public function newBankDataConverter() {
656
-		return new BankDataConverter( $this->config['bank-data-file'] );
656
+		return new BankDataConverter($this->config['bank-data-file']);
657 657
 	}
658 658
 
659
-	public function setSubscriptionValidator( SubscriptionValidator $subscriptionValidator ) {
659
+	public function setSubscriptionValidator(SubscriptionValidator $subscriptionValidator) {
660 660
 		$this->pimple['subscription_validator'] = $subscriptionValidator;
661 661
 	}
662 662
 
663
-	public function setPageTitlePrefix( string $prefix ) {
663
+	public function setPageTitlePrefix(string $prefix) {
664 664
 		$this->config['cms-wiki-title-prefix'] = $prefix;
665 665
 	}
666 666
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 
675 675
 	private function newContactConfirmationMailer(): TemplateBasedMailer {
676 676
 		return $this->newTemplateMailer(
677
-			new TwigTemplate( $this->getTwig(), 'KontaktMailExtern.twig' ),
677
+			new TwigTemplate($this->getTwig(), 'KontaktMailExtern.twig'),
678 678
 			'mail_subject_getintouch'
679 679
 		);
680 680
 	}
@@ -692,12 +692,12 @@  discard block
 block discarded – undo
692 692
 
693 693
 	private function newSubscriptionDuplicateCutoffDate(): \DateTime {
694 694
 		$cutoffDateTime = new \DateTime();
695
-		$cutoffDateTime->sub( new \DateInterval( $this->config['subscription-interval'] ) );
695
+		$cutoffDateTime->sub(new \DateInterval($this->config['subscription-interval']));
696 696
 		return $cutoffDateTime;
697 697
 	}
698 698
 
699 699
 	private function newHonorificValidator(): AllowedValuesValidator {
700
-		return new AllowedValuesValidator( $this->getHonorifics()->getKeys() );
700
+		return new AllowedValuesValidator($this->getHonorifics()->getKeys());
701 701
 	}
702 702
 
703 703
 	private function getHonorifics(): Honorifics {
@@ -706,47 +706,47 @@  discard block
 block discarded – undo
706 706
 
707 707
 	public function newPurgeCacheUseCase(): PurgeCacheUseCase {
708 708
 		return new PurgeCacheUseCase(
709
-			new AllOfTheCachePurger( $this->getTwig(), $this->getPageCache() ),
709
+			new AllOfTheCachePurger($this->getTwig(), $this->getPageCache()),
710 710
 			$this->config['purging-secret']
711 711
 		);
712 712
 	}
713 713
 
714 714
 	private function newBankDataValidator(): BankDataValidator {
715
-		return new BankDataValidator( $this->newIbanValidator() );
715
+		return new BankDataValidator($this->newIbanValidator());
716 716
 	}
717 717
 
718 718
 	private function getMessenger(): Messenger {
719 719
 		return $this->pimple['messenger'];
720 720
 	}
721 721
 
722
-	public function setMessenger( Messenger $messenger ) {
722
+	public function setMessenger(Messenger $messenger) {
723 723
 		$this->pimple['messenger'] = $messenger;
724 724
 	}
725 725
 
726 726
 	public function setNullMessenger() {
727
-		$this->setMessenger( new Messenger(
727
+		$this->setMessenger(new Messenger(
728 728
 			Swift_NullTransport::newInstance(),
729 729
 			$this->getOperatorAddress()
730
-		) );
730
+		));
731 731
 	}
732 732
 
733 733
 	public function getOperatorAddress() {
734
-		return new EmailAddress( $this->config['operator-email'] );
734
+		return new EmailAddress($this->config['operator-email']);
735 735
 	}
736 736
 
737 737
 	public function newInternalErrorHTMLPresenter(): InternalErrorHtmlPresenter {
738
-		return new InternalErrorHtmlPresenter( $this->getIncludeTemplate( 'ErrorPage.twig' ) );
738
+		return new InternalErrorHtmlPresenter($this->getIncludeTemplate('ErrorPage.twig'));
739 739
 	}
740 740
 
741 741
 	public function newAccessDeniedHTMLPresenter(): InternalErrorHtmlPresenter {
742
-		return new InternalErrorHtmlPresenter( $this->getLayoutTemplate( 'AccessDenied.twig' ) );
742
+		return new InternalErrorHtmlPresenter($this->getLayoutTemplate('AccessDenied.twig'));
743 743
 	}
744 744
 
745 745
 	public function getTranslator(): TranslatorInterface {
746 746
 		return $this->pimple['translator'];
747 747
 	}
748 748
 
749
-	public function setTranslator( TranslatorInterface $translator ) {
749
+	public function setTranslator(TranslatorInterface $translator) {
750 750
 		$this->pimple['translator'] = $translator;
751 751
 	}
752 752
 
@@ -754,25 +754,25 @@  discard block
 block discarded – undo
754 754
 		return $this->pimple['twig_factory'];
755 755
 	}
756 756
 
757
-	private function newTextPolicyValidator( string $policyName ): TextPolicyValidator {
757
+	private function newTextPolicyValidator(string $policyName): TextPolicyValidator {
758 758
 		$contentProvider = $this->newWikiPageRetriever();
759 759
 		$textPolicyConfig = $this->config['text-policies'][$policyName];
760 760
 
761 761
 		return new TextPolicyValidator(
762
-			new PageRetrieverBasedStringList( $contentProvider, $textPolicyConfig['badwords'] ?? '' ),
763
-			new PageRetrieverBasedStringList( $contentProvider, $textPolicyConfig['whitewords'] ?? '' )
762
+			new PageRetrieverBasedStringList($contentProvider, $textPolicyConfig['badwords'] ?? ''),
763
+			new PageRetrieverBasedStringList($contentProvider, $textPolicyConfig['whitewords'] ?? '')
764 764
 		);
765 765
 	}
766 766
 
767 767
 	private function newCommentPolicyValidator(): TextPolicyValidator {
768
-		return $this->newTextPolicyValidator( 'comment' );
768
+		return $this->newTextPolicyValidator('comment');
769 769
 	}
770 770
 
771
-	public function newCancelDonationUseCase( string $updateToken ): CancelDonationUseCase {
771
+	public function newCancelDonationUseCase(string $updateToken): CancelDonationUseCase {
772 772
 		return new CancelDonationUseCase(
773 773
 			$this->getDonationRepository(),
774 774
 			$this->newCancelDonationMailer(),
775
-			$this->newDonationAuthorizer( $updateToken ),
775
+			$this->newDonationAuthorizer($updateToken),
776 776
 			$this->newDonationEventLogger()
777 777
 		);
778 778
 	}
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 			new TwigTemplate(
783 783
 				$this->getTwig(),
784 784
 				'Mail_Donation_Cancellation_Confirmation.twig',
785
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
785
+				['greeting_generator' => $this->getGreetingGenerator()]
786 786
 			),
787 787
 			'mail_subject_confirm_cancellation'
788 788
 		);
@@ -840,19 +840,19 @@  discard block
 block discarded – undo
840 840
 	}
841 841
 
842 842
 	public function newPayPalUrlGenerator() {
843
-		return new PayPalUrlGenerator( $this->getPayPalUrlConfig() );
843
+		return new PayPalUrlGenerator($this->getPayPalUrlConfig());
844 844
 	}
845 845
 
846 846
 	private function getPayPalUrlConfig() {
847
-		return PayPalUrlConfig::newFromConfig( $this->config['paypal'] );
847
+		return PayPalUrlConfig::newFromConfig($this->config['paypal']);
848 848
 	}
849 849
 
850 850
 	private function newCreditCardUrlGenerator() {
851
-		return new CreditCardUrlGenerator( $this->newCreditCardUrlConfig() );
851
+		return new CreditCardUrlGenerator($this->newCreditCardUrlConfig());
852 852
 	}
853 853
 
854 854
 	private function newCreditCardUrlConfig() {
855
-		return CreditCardUrlConfig::newFromConfig( $this->config['creditcard'] );
855
+		return CreditCardUrlConfig::newFromConfig($this->config['creditcard']);
856 856
 	}
857 857
 
858 858
 	public function getDonationRepository(): DonationRepository {
@@ -860,27 +860,27 @@  discard block
 block discarded – undo
860 860
 	}
861 861
 
862 862
 	public function newPaymentDataValidator(): PaymentDataValidator {
863
-		return new PaymentDataValidator( $this->config['donation-minimum-amount'], $this->config['donation-maximum-amount'] );
863
+		return new PaymentDataValidator($this->config['donation-minimum-amount'], $this->config['donation-maximum-amount']);
864 864
 	}
865 865
 
866 866
 	private function newAmountFormatter(): AmountFormatter {
867
-		return new AmountFormatter( $this->config['locale'] );
867
+		return new AmountFormatter($this->config['locale']);
868 868
 	}
869 869
 
870 870
 	public function newDecimalNumberFormatter(): NumberFormatter {
871
-		return new NumberFormatter( $this->config['locale'], NumberFormatter::DECIMAL );
871
+		return new NumberFormatter($this->config['locale'], NumberFormatter::DECIMAL);
872 872
 	}
873 873
 
874
-	public function newAddCommentUseCase( string $updateToken ): AddCommentUseCase {
874
+	public function newAddCommentUseCase(string $updateToken): AddCommentUseCase {
875 875
 		return new AddCommentUseCase(
876 876
 			$this->getDonationRepository(),
877
-			$this->newDonationAuthorizer( $updateToken ),
877
+			$this->newDonationAuthorizer($updateToken),
878 878
 			$this->newCommentPolicyValidator(),
879 879
 			$this->newAddCommentValidator()
880 880
 		);
881 881
 	}
882 882
 
883
-	private function newDonationAuthorizer( string $updateToken = null, string $accessToken = null ): DonationAuthorizer {
883
+	private function newDonationAuthorizer(string $updateToken = null, string $accessToken = null): DonationAuthorizer {
884 884
 		return new DoctrineDonationAuthorizer(
885 885
 			$this->getEntityManager(),
886 886
 			$updateToken,
@@ -894,13 +894,13 @@  discard block
 block discarded – undo
894 894
 
895 895
 	public function newDonationConfirmationPresenter() {
896 896
 		return new DonationConfirmationHtmlPresenter(
897
-			$this->getIncludeTemplate( 'DonationConfirmation.twig', [ 'piwikGoals' => [ 3 ] ] )
897
+			$this->getIncludeTemplate('DonationConfirmation.twig', ['piwikGoals' => [3]])
898 898
 		);
899 899
 	}
900 900
 
901 901
 	public function newCreditCardPaymentHtmlPresenter() {
902 902
 		return new CreditCardPaymentHtmlPresenter(
903
-			$this->getIncludeTemplate( 'CreditCardPaymentIframe.twig' ),
903
+			$this->getIncludeTemplate('CreditCardPaymentIframe.twig'),
904 904
 			$this->getTranslator(),
905 905
 			$this->newCreditCardUrlGenerator()
906 906
 		);
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 
909 909
 	public function newCancelDonationHtmlPresenter() {
910 910
 		return new CancelDonationHtmlPresenter(
911
-			$this->getIncludeTemplate( 'Donation_Cancellation_Confirmation.twig' )
911
+			$this->getIncludeTemplate('Donation_Cancellation_Confirmation.twig')
912 912
 		);
913 913
 	}
914 914
 
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 			new TwigTemplate(
929 929
 				$this->getTwig(),
930 930
 				'Mail_Membership_Application_Confirmation.twig',
931
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
931
+				['greeting_generator' => $this->getGreetingGenerator()]
932 932
 			),
933 933
 			'mail_subject_confirm_membership_application'
934 934
 		);
@@ -943,16 +943,16 @@  discard block
 block discarded – undo
943 943
 	}
944 944
 
945 945
 	private function newMembershipApplicationTracker(): ApplicationTracker {
946
-		return new DoctrineApplicationTracker( $this->getEntityManager() );
946
+		return new DoctrineApplicationTracker($this->getEntityManager());
947 947
 	}
948 948
 
949 949
 	private function newMembershipApplicationPiwikTracker(): ApplicationPiwikTracker {
950
-		return new DoctrineApplicationPiwikTracker( $this->getEntityManager() );
950
+		return new DoctrineApplicationPiwikTracker($this->getEntityManager());
951 951
 	}
952 952
 
953
-	public function newCancelMembershipApplicationUseCase( string $updateToken ): CancelMembershipApplicationUseCase {
953
+	public function newCancelMembershipApplicationUseCase(string $updateToken): CancelMembershipApplicationUseCase {
954 954
 		return new CancelMembershipApplicationUseCase(
955
-			$this->newMembershipApplicationAuthorizer( $updateToken ),
955
+			$this->newMembershipApplicationAuthorizer($updateToken),
956 956
 			$this->getMembershipApplicationRepository(),
957 957
 			$this->newCancelMembershipApplicationMailer()
958 958
 		);
@@ -977,27 +977,27 @@  discard block
 block discarded – undo
977 977
 			new TwigTemplate(
978 978
 				$this->getTwig(),
979 979
 				'Mail_Membership_Application_Cancellation_Confirmation.twig',
980
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
980
+				['greeting_generator' => $this->getGreetingGenerator()]
981 981
 			),
982 982
 			'mail_subject_confirm_membership_application_cancellation'
983 983
 		);
984 984
 	}
985 985
 
986
-	public function newMembershipApplicationConfirmationUseCase( string $accessToken ) {
986
+	public function newMembershipApplicationConfirmationUseCase(string $accessToken) {
987 987
 		return new ShowMembershipApplicationConfirmationUseCase(
988
-			$this->newMembershipApplicationAuthorizer( null, $accessToken ), $this->getMembershipApplicationRepository(),
988
+			$this->newMembershipApplicationAuthorizer(null, $accessToken), $this->getMembershipApplicationRepository(),
989 989
 			$this->newMembershipApplicationTokenFetcher()
990 990
 		);
991 991
 	}
992 992
 
993
-	public function newShowDonationConfirmationUseCase( string $accessToken ): ShowDonationConfirmationUseCase {
993
+	public function newShowDonationConfirmationUseCase(string $accessToken): ShowDonationConfirmationUseCase {
994 994
 		return new ShowDonationConfirmationUseCase(
995
-			$this->newDonationAuthorizer( null, $accessToken ),
995
+			$this->newDonationAuthorizer(null, $accessToken),
996 996
 			$this->getDonationRepository()
997 997
 		);
998 998
 	}
999 999
 
1000
-	public function setDonationConfirmationPageSelector( DonationConfirmationPageSelector $selector ) {
1000
+	public function setDonationConfirmationPageSelector(DonationConfirmationPageSelector $selector) {
1001 1001
 		$this->pimple['confirmation-page-selector'] = $selector;
1002 1002
 	}
1003 1003
 
@@ -1008,21 +1008,21 @@  discard block
 block discarded – undo
1008 1008
 	public function newDonationFormViolationPresenter() {
1009 1009
 		// TODO make the template name dependent on the 'form' value from the HTTP POST request
1010 1010
 		// (we need different form pages for A/B testing)
1011
-		$template = $this->getLayoutTemplate( 'DisplayPageLayout.twig', [ 'main_template' => 'DonationForm.twig' ] );
1012
-		return new DonationFormViolationPresenter( $template, $this->newAmountFormatter() );
1011
+		$template = $this->getLayoutTemplate('DisplayPageLayout.twig', ['main_template' => 'DonationForm.twig']);
1012
+		return new DonationFormViolationPresenter($template, $this->newAmountFormatter());
1013 1013
 	}
1014 1014
 
1015 1015
 	public function newDonationFormPresenter() {
1016 1016
 		// TODO make the template name dependent on the 'form' value from the HTTP POST request
1017 1017
 		// (we need different form pages for A/B testing)
1018
-		$template = $this->getLayoutTemplate( 'DisplayPageLayout.twig', [ 'main_template' => 'DonationForm.twig' ] );
1019
-		return new DonationFormPresenter( $template, $this->newAmountFormatter() );
1018
+		$template = $this->getLayoutTemplate('DisplayPageLayout.twig', ['main_template' => 'DonationForm.twig']);
1019
+		return new DonationFormPresenter($template, $this->newAmountFormatter());
1020 1020
 	}
1021 1021
 
1022
-	public function newHandlePayPalPaymentNotificationUseCase( string $updateToken ) {
1022
+	public function newHandlePayPalPaymentNotificationUseCase(string $updateToken) {
1023 1023
 		return new HandlePayPalPaymentNotificationUseCase(
1024 1024
 			$this->getDonationRepository(),
1025
-			$this->newDonationAuthorizer( $updateToken ),
1025
+			$this->newDonationAuthorizer($updateToken),
1026 1026
 			$this->newDonationConfirmationMailer(),
1027 1027
 			$this->getLogger(),
1028 1028
 			$this->newDonationEventLogger()
@@ -1033,14 +1033,14 @@  discard block
 block discarded – undo
1033 1033
 		return $this->pimple['paypal-payment-notification-verifier'];
1034 1034
 	}
1035 1035
 
1036
-	public function setPayPalPaymentNotificationVerifier( PaymentNotificationVerifier $verifier ) {
1036
+	public function setPayPalPaymentNotificationVerifier(PaymentNotificationVerifier $verifier) {
1037 1037
 		$this->pimple['paypal-payment-notification-verifier'] = $verifier;
1038 1038
 	}
1039 1039
 
1040
-	public function newCreditCardNotificationUseCase( string $updateToken ) {
1040
+	public function newCreditCardNotificationUseCase(string $updateToken) {
1041 1041
 		return new CreditCardNotificationUseCase(
1042 1042
 			$this->getDonationRepository(),
1043
-			$this->newDonationAuthorizer( $updateToken ),
1043
+			$this->newDonationAuthorizer($updateToken),
1044 1044
 			$this->getCreditCardService(),
1045 1045
 			$this->newDonationConfirmationMailer(),
1046 1046
 			$this->getLogger(),
@@ -1050,23 +1050,23 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 	public function newCancelMembershipApplicationHtmlPresenter() {
1052 1052
 		return new CancelMembershipApplicationHtmlPresenter(
1053
-			$this->getIncludeTemplate( 'Membership_Application_Cancellation_Confirmation.twig' )
1053
+			$this->getIncludeTemplate('Membership_Application_Cancellation_Confirmation.twig')
1054 1054
 		);
1055 1055
 	}
1056 1056
 
1057 1057
 	public function newMembershipApplicationConfirmationHtmlPresenter() {
1058 1058
 		return new MembershipApplicationConfirmationHtmlPresenter(
1059
-			$this->getIncludeTemplate( 'MembershipApplicationConfirmation.twig' )
1059
+			$this->getIncludeTemplate('MembershipApplicationConfirmation.twig')
1060 1060
 		);
1061 1061
 	}
1062 1062
 
1063 1063
 	public function newMembershipFormViolationPresenter() {
1064 1064
 		return new MembershipFormViolationPresenter(
1065
-			$this->getIncludeTemplate( 'MembershipApplication.twig' )
1065
+			$this->getIncludeTemplate('MembershipApplication.twig')
1066 1066
 		);
1067 1067
 	}
1068 1068
 
1069
-	public function setCreditCardService( CreditCardService $ccService ) {
1069
+	public function setCreditCardService(CreditCardService $ccService) {
1070 1070
 		$this->pimple['credit-card-api-service'] = $ccService;
1071 1071
 	}
1072 1072
 
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 			new TwigTemplate(
1080 1080
 				$this->getTwig(),
1081 1081
 				'CreditCardPaymentNotification.twig',
1082
-				[ 'returnUrl' => $this->config['creditcard']['return-url'] ]
1082
+				['returnUrl' => $this->config['creditcard']['return-url']]
1083 1083
 			)
1084 1084
 		);
1085 1085
 	}
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 		);
1101 1101
 	}
1102 1102
 
1103
-	public function setTokenGenerator( TokenGenerator $tokenGenerator ) {
1103
+	public function setTokenGenerator(TokenGenerator $tokenGenerator) {
1104 1104
 		$this->pimple['token_generator'] = $tokenGenerator;
1105 1105
 	}
1106 1106
 
@@ -1123,22 +1123,22 @@  discard block
 block discarded – undo
1123 1123
 	private function newDonationPolicyValidator(): AddDonationPolicyValidator {
1124 1124
 		return new AddDonationPolicyValidator(
1125 1125
 			$this->newDonationAmountPolicyValidator(),
1126
-			$this->newTextPolicyValidator( 'fields' )
1126
+			$this->newTextPolicyValidator('fields')
1127 1127
 		);
1128 1128
 	}
1129 1129
 
1130 1130
 	private function newDonationAmountPolicyValidator(): AmountPolicyValidator {
1131 1131
 		// in the future, this might come from the configuration
1132
-		return new AmountPolicyValidator( 1000, 200, 300 );
1132
+		return new AmountPolicyValidator(1000, 200, 300);
1133 1133
 	}
1134 1134
 
1135 1135
 	public function getDonationTimeframeLimit() {
1136 1136
 		return $this->config['donation-timeframe-limit'];
1137 1137
 	}
1138 1138
 
1139
-	public function newSystemMessageResponse( string $message ) {
1140
-		$test = $this->getIncludeTemplate( 'System_Message.twig' );
1141
-		return $test->render( [ 'message' => $message ] );
1139
+	public function newSystemMessageResponse(string $message) {
1140
+		$test = $this->getIncludeTemplate('System_Message.twig');
1141
+		return $test->render(['message' => $message]);
1142 1142
 	}
1143 1143
 
1144 1144
 	public function getMembershipApplicationTimeframeLimit() {
@@ -1154,26 +1154,26 @@  discard block
 block discarded – undo
1154 1154
 	}
1155 1155
 
1156 1156
 	public function enablePageCache() {
1157
-		$this->pimple['page_cache'] = $this->pimple->share( function() {
1158
-			return new FilesystemCache( $this->getCachePath() . '/pages' );
1157
+		$this->pimple['page_cache'] = $this->pimple->share(function() {
1158
+			return new FilesystemCache($this->getCachePath() . '/pages');
1159 1159
 		} );
1160 1160
 	}
1161 1161
 
1162
-	private function addProfilingDecorator( $objectToDecorate, string $profilingLabel ) {
1163
-		if ( $this->profiler === null ) {
1162
+	private function addProfilingDecorator($objectToDecorate, string $profilingLabel) {
1163
+		if ($this->profiler === null) {
1164 1164
 			return $objectToDecorate;
1165 1165
 		}
1166 1166
 
1167
-		$builder = new ProfilingDecoratorBuilder( $this->profiler, $this->getProfilerDataCollector() );
1167
+		$builder = new ProfilingDecoratorBuilder($this->profiler, $this->getProfilerDataCollector());
1168 1168
 
1169
-		return $builder->decorate( $objectToDecorate, $profilingLabel );
1169
+		return $builder->decorate($objectToDecorate, $profilingLabel);
1170 1170
 	}
1171 1171
 
1172
-	public function setProfiler( Stopwatch $profiler ) {
1172
+	public function setProfiler(Stopwatch $profiler) {
1173 1173
 		$this->profiler = $profiler;
1174 1174
 	}
1175 1175
 
1176
-	public function setLogger( LoggerInterface $logger ) {
1176
+	public function setLogger(LoggerInterface $logger) {
1177 1177
 		$this->pimple['logger'] = $logger;
1178 1178
 	}
1179 1179
 
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 	}
1183 1183
 
1184 1184
 	private function newIbanValidator(): IbanValidator {
1185
-		return new IbanValidator( $this->newBankDataConverter(), $this->config['banned-ibans'] );
1185
+		return new IbanValidator($this->newBankDataConverter(), $this->config['banned-ibans']);
1186 1186
 	}
1187 1187
 
1188 1188
 }
Please login to merge, or discard this patch.
app/routes.php 1 patch
Spacing   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @var \WMDE\Fundraising\Frontend\Factories\FunFunFactory $ffFactory
8 8
  */
9 9
 
10
-declare( strict_types = 1 );
10
+declare(strict_types = 1);
11 11
 
12 12
 use Silex\Application;
13 13
 use Symfony\Component\HttpFoundation\Request;
@@ -40,141 +40,141 @@  discard block
 block discarded – undo
40 40
 use WMDE\Fundraising\Frontend\SubscriptionContext\UseCases\AddSubscription\SubscriptionRequest;
41 41
 use WMDE\Fundraising\Frontend\Validation\MembershipFeeValidator;
42 42
 
43
-$app->before( function( Request $request ) {
44
-	foreach ( [ $request->request, $request->query ] as $parameterBag ) {
45
-		foreach ( $parameterBag->keys() as $key ) {
46
-			if ( is_string( $parameterBag->get( $key ) ) ) {
47
-				$parameterBag->set( $key, trim( $parameterBag->get( $key ) ) );
43
+$app->before(function(Request $request) {
44
+	foreach ([$request->request, $request->query] as $parameterBag) {
45
+		foreach ($parameterBag->keys() as $key) {
46
+			if (is_string($parameterBag->get($key))) {
47
+				$parameterBag->set($key, trim($parameterBag->get($key)));
48 48
 			}
49 49
 		}
50 50
 	}
51
-}, Application::EARLY_EVENT );
51
+}, Application::EARLY_EVENT);
52 52
 
53 53
 $app->post(
54 54
 	'validate-email',
55
-	function( Request $request ) use ( $app, $ffFactory ) {
56
-		$validationResult = $ffFactory->getEmailValidator()->validate( $request->request->get( 'email', '' ) );
57
-		return $app->json( [ 'status' => $validationResult->isSuccessful() ? 'OK' : 'ERR' ] );
55
+	function(Request $request) use ($app, $ffFactory) {
56
+		$validationResult = $ffFactory->getEmailValidator()->validate($request->request->get('email', ''));
57
+		return $app->json(['status' => $validationResult->isSuccessful() ? 'OK' : 'ERR']);
58 58
 	}
59 59
 );
60 60
 
61 61
 $app->post(
62 62
 	'validate-payment-data',
63
-	function( Request $request ) use ( $app, $ffFactory ) {
63
+	function(Request $request) use ($app, $ffFactory) {
64 64
 
65
-		$amount = (float) $ffFactory->newDecimalNumberFormatter()->parse( $request->get( 'amount', '0' ) );
65
+		$amount = (float)$ffFactory->newDecimalNumberFormatter()->parse($request->get('amount', '0'));
66 66
 		$validator = $ffFactory->newPaymentDataValidator();
67
-		$validationResult = $validator->validate( $amount, (string) $request->get( 'paymentType', '' ) );
67
+		$validationResult = $validator->validate($amount, (string)$request->get('paymentType', ''));
68 68
 
69
-		if ( $validationResult->isSuccessful() ) {
70
-			return $app->json( [ 'status' => 'OK' ] );
69
+		if ($validationResult->isSuccessful()) {
70
+			return $app->json(['status' => 'OK']);
71 71
 		} else {
72 72
 			$errors = [];
73
-			foreach( $validationResult->getViolations() as $violation ) {
74
-				$errors[ $violation->getSource() ] = $ffFactory->getTranslator()->trans( $violation->getMessageIdentifier() );
73
+			foreach ($validationResult->getViolations() as $violation) {
74
+				$errors[$violation->getSource()] = $ffFactory->getTranslator()->trans($violation->getMessageIdentifier());
75 75
 			}
76
-			return $app->json( [ 'status' => 'ERR', 'messages' => $errors ] );
76
+			return $app->json(['status' => 'ERR', 'messages' => $errors]);
77 77
 		}
78 78
 	}
79 79
 );
80 80
 
81 81
 $app->post(
82 82
 	'validate-address',
83
-	function( Request $request ) use ( $app, $ffFactory ) {
83
+	function(Request $request) use ($app, $ffFactory) {
84 84
 		$routeHandler = new class() {
85 85
 
86
-			public function handle( FunFunFactory $ffFactory, Application $app, Request $request ) {
87
-				if ( $request->get( 'adressType', '' ) === 'anonym' ) {
88
-					return $app->json( [ 'status' => 'OK' ] );
86
+			public function handle(FunFunFactory $ffFactory, Application $app, Request $request) {
87
+				if ($request->get('adressType', '') === 'anonym') {
88
+					return $app->json(['status' => 'OK']);
89 89
 				}
90 90
 
91
-				$personalInfo = $this->getPersonalInfoFromRequest( $request );
91
+				$personalInfo = $this->getPersonalInfoFromRequest($request);
92 92
 				$personalInfoValidator = $ffFactory->newPersonalInfoValidator();
93
-				$validationResult = $personalInfoValidator->validate( $personalInfo );
93
+				$validationResult = $personalInfoValidator->validate($personalInfo);
94 94
 
95
-				if ( $validationResult->isSuccessful() ) {
96
-					return $app->json( [ 'status' => 'OK' ] );
95
+				if ($validationResult->isSuccessful()) {
96
+					return $app->json(['status' => 'OK']);
97 97
 				} else {
98 98
 					$errors = [];
99
-					foreach( $validationResult->getViolations() as $violation ) {
100
-						$errors[$violation->getSource()] = $ffFactory->getTranslator()->trans( $violation->getMessageIdentifier() );
99
+					foreach ($validationResult->getViolations() as $violation) {
100
+						$errors[$violation->getSource()] = $ffFactory->getTranslator()->trans($violation->getMessageIdentifier());
101 101
 					}
102
-					return $app->json( [ 'status' => 'ERR', 'messages' => $errors ] );
102
+					return $app->json(['status' => 'ERR', 'messages' => $errors]);
103 103
 				}
104 104
 			}
105 105
 
106
-			private function getPersonalInfoFromRequest( Request $request ): Donor {
106
+			private function getPersonalInfoFromRequest(Request $request): Donor {
107 107
 				return new Donor(
108
-					$this->getNameFromRequest( $request ),
109
-					$this->getPhysicalAddressFromRequest( $request ),
110
-					$request->get( 'email', '' )
108
+					$this->getNameFromRequest($request),
109
+					$this->getPhysicalAddressFromRequest($request),
110
+					$request->get('email', '')
111 111
 				);
112 112
 			}
113 113
 
114
-			private function getPhysicalAddressFromRequest( Request $request ): DonorAddress {
114
+			private function getPhysicalAddressFromRequest(Request $request): DonorAddress {
115 115
 				$address = new DonorAddress();
116 116
 
117
-				$address->setStreetAddress( $request->get( 'street', '' ) );
118
-				$address->setPostalCode( $request->get( 'postcode', '' ) );
119
-				$address->setCity( $request->get( 'city', '' ) );
120
-				$address->setCountryCode( $request->get( 'country', '' ) );
117
+				$address->setStreetAddress($request->get('street', ''));
118
+				$address->setPostalCode($request->get('postcode', ''));
119
+				$address->setCity($request->get('city', ''));
120
+				$address->setCountryCode($request->get('country', ''));
121 121
 
122 122
 				return $address->freeze()->assertNoNullFields();
123 123
 			}
124 124
 
125
-			private function getNameFromRequest( Request $request ): DonorName {
126
-				$name = $request->get( 'addressType', '' ) === 'firma'
125
+			private function getNameFromRequest(Request $request): DonorName {
126
+				$name = $request->get('addressType', '') === 'firma'
127 127
 					? DonorName::newCompanyName() : DonorName::newPrivatePersonName();
128 128
 
129
-				$name->setSalutation( $request->get( 'salutation', '' ) );
130
-				$name->setTitle( $request->get( 'title', '' ) );
131
-				$name->setCompanyName( $request->get( 'companyName', '' ) );
132
-				$name->setFirstName( $request->get( 'firstName', '' ) );
133
-				$name->setLastName( $request->get( 'lastName', '' ) );
129
+				$name->setSalutation($request->get('salutation', ''));
130
+				$name->setTitle($request->get('title', ''));
131
+				$name->setCompanyName($request->get('companyName', ''));
132
+				$name->setFirstName($request->get('firstName', ''));
133
+				$name->setLastName($request->get('lastName', ''));
134 134
 
135 135
 				return $name->freeze()->assertNoNullFields();
136 136
 			}
137 137
 		};
138 138
 
139
-		return $routeHandler->handle( $ffFactory, $app, $request );
139
+		return $routeHandler->handle($ffFactory, $app, $request);
140 140
 	}
141 141
 );
142 142
 
143 143
 $app->post(
144 144
 	'validate-fee',
145
-	function( Request $httpRequest ) use ( $app, $ffFactory ) {
145
+	function(Request $httpRequest) use ($app, $ffFactory) {
146 146
 		$validator = new MembershipFeeValidator();
147 147
 		$result = $validator->validate(
148
-			str_replace( ',', '.', $httpRequest->request->get( 'amount', '' ) ),
149
-			(int) $httpRequest->request->get( 'paymentIntervalInMonths', '0' ),
150
-			$httpRequest->request->get( 'addressType', '' )
148
+			str_replace(',', '.', $httpRequest->request->get('amount', '')),
149
+			(int)$httpRequest->request->get('paymentIntervalInMonths', '0'),
150
+			$httpRequest->request->get('addressType', '')
151 151
 		);
152 152
 
153
-		if ( $result->isSuccessful() ) {
154
-			return $app->json( [ 'status' => 'OK' ] );
153
+		if ($result->isSuccessful()) {
154
+			return $app->json(['status' => 'OK']);
155 155
 		} else {
156 156
 			$errors = $result->getViolations();
157
-			return $app->json( [ 'status' => 'ERR', 'message' => implode( "\n", $errors ) ] );
157
+			return $app->json(['status' => 'ERR', 'message' => implode("\n", $errors)]);
158 158
 		}
159 159
 	}
160 160
 );
161 161
 
162 162
 $app->get(
163 163
 	'list-comments.json',
164
-	function( Request $request ) use ( $app, $ffFactory ) {
164
+	function(Request $request) use ($app, $ffFactory) {
165 165
 		$response = $app->json(
166 166
 			$ffFactory->newCommentListJsonPresenter()->present(
167 167
 				$ffFactory->newListCommentsUseCase()->listComments(
168 168
 					new CommentListingRequest(
169
-						(int)$request->query->get( 'n', '10' ),
170
-						(int)$request->query->get( 'page', '1' )
169
+						(int)$request->query->get('n', '10'),
170
+						(int)$request->query->get('page', '1')
171 171
 					)
172 172
 				)
173 173
 			)
174 174
 		);
175 175
 
176
-		if ( $request->query->get( 'f' ) ) {
177
-			$response->setCallback( $request->query->get( 'f' ) );
176
+		if ($request->query->get('f')) {
177
+			$response->setCallback($request->query->get('f'));
178 178
 		}
179 179
 
180 180
 		return $response;
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
 
184 184
 $app->get(
185 185
 	'list-comments.rss',
186
-	function() use ( $app, $ffFactory ) {
186
+	function() use ($app, $ffFactory) {
187 187
 		$rss = $ffFactory->newCommentListRssPresenter()->present(
188 188
 			$ffFactory->newListCommentsUseCase()->listComments(
189
-				new CommentListingRequest( 100, CommentListingRequest::FIRST_PAGE )
189
+				new CommentListingRequest(100, CommentListingRequest::FIRST_PAGE)
190 190
 			)
191 191
 		);
192 192
 
@@ -203,16 +203,16 @@  discard block
 block discarded – undo
203 203
 
204 204
 $app->get(
205 205
 	'list-comments.html',
206
-	function( Request $request ) use ( $app, $ffFactory ) {
206
+	function(Request $request) use ($app, $ffFactory) {
207 207
 		return new Response(
208 208
 			$ffFactory->newCommentListHtmlPresenter()->present(
209 209
 				$ffFactory->newListCommentsUseCase()->listComments(
210 210
 					new CommentListingRequest(
211 211
 						10,
212
-						(int)$request->query->get( 'page', '1' )
212
+						(int)$request->query->get('page', '1')
213 213
 					)
214 214
 				),
215
-				(int)$request->query->get( 'page', '1' )
215
+				(int)$request->query->get('page', '1')
216 216
 			)
217 217
 		);
218 218
 	}
@@ -220,150 +220,150 @@  discard block
 block discarded – undo
220 220
 
221 221
 $app->get(
222 222
 	'page/{pageName}',
223
-	function( Application $app, $pageName ) use ( $ffFactory ) {
224
-		$templateExists = $ffFactory->getTemplateNameValidator()->validate( $pageName )->isSuccessful();
223
+	function(Application $app, $pageName) use ($ffFactory) {
224
+		$templateExists = $ffFactory->getTemplateNameValidator()->validate($pageName)->isSuccessful();
225 225
 
226
-		return $ffFactory->getLayoutTemplate( 'DisplayPageLayout.twig' )->render( [
226
+		return $ffFactory->getLayoutTemplate('DisplayPageLayout.twig')->render([
227 227
 			'main_template' => $templateExists ? $pageName : '404message.html.twig',
228
-		] );
228
+		]);
229 229
 	}
230 230
 )
231
-->bind( 'page' );
231
+->bind('page');
232 232
 
233 233
 // Form for this is provided by route page/Subscription_Form
234 234
 $app->post(
235 235
 	'contact/subscribe',
236
-	function( Application $app, Request $request ) use ( $ffFactory ) {
236
+	function(Application $app, Request $request) use ($ffFactory) {
237 237
 		$useCase = $ffFactory->newAddSubscriptionUseCase();
238 238
 
239 239
 		$subscriptionRequest = new SubscriptionRequest();
240
-		$subscriptionRequest->setAddress( $request->get( 'address', '' ) );
241
-		$subscriptionRequest->setCity( $request->get( 'city', '' ) );
242
-		$subscriptionRequest->setPostcode( $request->get( 'postcode', '' ) );
240
+		$subscriptionRequest->setAddress($request->get('address', ''));
241
+		$subscriptionRequest->setCity($request->get('city', ''));
242
+		$subscriptionRequest->setPostcode($request->get('postcode', ''));
243 243
 
244
-		$subscriptionRequest->setFirstName( $request->get( 'firstName', '' ) );
245
-		$subscriptionRequest->setLastName( $request->get( 'lastName', '' ) );
246
-		$subscriptionRequest->setSalutation( $request->get( 'salutation', '' ) );
247
-		$subscriptionRequest->setTitle( $request->get( 'title', '' ) );
244
+		$subscriptionRequest->setFirstName($request->get('firstName', ''));
245
+		$subscriptionRequest->setLastName($request->get('lastName', ''));
246
+		$subscriptionRequest->setSalutation($request->get('salutation', ''));
247
+		$subscriptionRequest->setTitle($request->get('title', ''));
248 248
 
249
-		$subscriptionRequest->setEmail( $request->get( 'email', '' ) );
249
+		$subscriptionRequest->setEmail($request->get('email', ''));
250 250
 
251
-		$subscriptionRequest->setWikiloginFromValues( [
252
-			$request->request->get( 'wikilogin' ),
253
-			$request->cookies->get( 'spenden_wikilogin' ),
254
-		] );
251
+		$subscriptionRequest->setWikiloginFromValues([
252
+			$request->request->get('wikilogin'),
253
+			$request->cookies->get('spenden_wikilogin'),
254
+		]);
255 255
 
256
-		$responseModel = $useCase->addSubscription( $subscriptionRequest );
257
-		if ( $app['request.is_json'] ) {
258
-			return $app->json( $ffFactory->newAddSubscriptionJSONPresenter()->present( $responseModel ) );
256
+		$responseModel = $useCase->addSubscription($subscriptionRequest);
257
+		if ($app['request.is_json']) {
258
+			return $app->json($ffFactory->newAddSubscriptionJSONPresenter()->present($responseModel));
259 259
 		}
260
-		if ( $responseModel->isSuccessful() ) {
261
-			if ( $responseModel->needsModeration() ) {
262
-				return $app->redirect( $app['url_generator']->generate('page', [ 'pageName' => 'Subscription_Moderation' ] ) );
260
+		if ($responseModel->isSuccessful()) {
261
+			if ($responseModel->needsModeration()) {
262
+				return $app->redirect($app['url_generator']->generate('page', ['pageName' => 'Subscription_Moderation']));
263 263
 			}
264
-			return $app->redirect( $app['url_generator']->generate('page', [ 'pageName' => 'Subscription_Success' ] ) );
264
+			return $app->redirect($app['url_generator']->generate('page', ['pageName' => 'Subscription_Success']));
265 265
 		}
266
-		return $ffFactory->newAddSubscriptionHTMLPresenter()->present( $responseModel, $request->request->all() );
266
+		return $ffFactory->newAddSubscriptionHTMLPresenter()->present($responseModel, $request->request->all());
267 267
 	}
268 268
 )
269
-->bind( 'subscribe' );
269
+->bind('subscribe');
270 270
 
271
-$app->get( 'contact/confirm-subscription/{confirmationCode}', function ( $confirmationCode ) use ( $ffFactory ) {
271
+$app->get('contact/confirm-subscription/{confirmationCode}', function($confirmationCode) use ($ffFactory) {
272 272
 	$useCase = $ffFactory->newConfirmSubscriptionUseCase();
273
-	$response = $useCase->confirmSubscription( $confirmationCode );
274
-	return $ffFactory->newConfirmSubscriptionHtmlPresenter()->present( $response );
273
+	$response = $useCase->confirmSubscription($confirmationCode);
274
+	return $ffFactory->newConfirmSubscriptionHtmlPresenter()->present($response);
275 275
 } )
276
-->assert( 'confirmationCode', '^[0-9a-f]+$' );
276
+->assert('confirmationCode', '^[0-9a-f]+$');
277 277
 
278 278
 $app->get(
279 279
 	'check-iban',
280
-	function( Request $request ) use ( $app, $ffFactory ) {
280
+	function(Request $request) use ($app, $ffFactory) {
281 281
 		$useCase = $ffFactory->newCheckIbanUseCase();
282
-		$checkIbanResponse = $useCase->checkIban( new Iban( $request->query->get( 'iban', '' ) ) );
283
-		return $app->json( $ffFactory->newIbanPresenter()->present( $checkIbanResponse ) );
282
+		$checkIbanResponse = $useCase->checkIban(new Iban($request->query->get('iban', '')));
283
+		return $app->json($ffFactory->newIbanPresenter()->present($checkIbanResponse));
284 284
 	}
285 285
 );
286 286
 
287 287
 $app->get(
288 288
 	'generate-iban',
289
-	function( Request $request ) use ( $app, $ffFactory ) {
289
+	function(Request $request) use ($app, $ffFactory) {
290 290
 		$generateIbanRequest = new GenerateIbanRequest(
291
-			$request->query->get( 'accountNumber', '' ),
292
-			$request->query->get( 'bankCode', '' )
291
+			$request->query->get('accountNumber', ''),
292
+			$request->query->get('bankCode', '')
293 293
 		);
294 294
 
295
-		$generateIbanResponse = $ffFactory->newGenerateIbanUseCase()->generateIban( $generateIbanRequest );
296
-		return $app->json( $ffFactory->newIbanPresenter()->present( $generateIbanResponse ) );
295
+		$generateIbanResponse = $ffFactory->newGenerateIbanUseCase()->generateIban($generateIbanRequest);
296
+		return $app->json($ffFactory->newIbanPresenter()->present($generateIbanResponse));
297 297
 	}
298 298
 );
299 299
 
300 300
 $app->post(
301 301
 	'add-comment',
302
-	function( Request $request ) use ( $app, $ffFactory ) {
302
+	function(Request $request) use ($app, $ffFactory) {
303 303
 		$addCommentRequest = new AddCommentRequest();
304
-		$addCommentRequest->setCommentText( trim( $request->request->get( 'kommentar', '' ) ) );
305
-		$addCommentRequest->setIsPublic( $request->request->get( 'public', '0' ) === '1' );
306
-		$addCommentRequest->setAuthorDisplayName( trim( $request->request->get( 'eintrag', '' ) ) );
307
-		$addCommentRequest->setDonationId( (int)$request->request->get( 'sid', '' ) );
304
+		$addCommentRequest->setCommentText(trim($request->request->get('kommentar', '')));
305
+		$addCommentRequest->setIsPublic($request->request->get('public', '0') === '1');
306
+		$addCommentRequest->setAuthorDisplayName(trim($request->request->get('eintrag', '')));
307
+		$addCommentRequest->setDonationId((int)$request->request->get('sid', ''));
308 308
 		$addCommentRequest->freeze()->assertNoNullFields();
309 309
 
310
-		$updateToken = $request->request->get( 'utoken', '' );
310
+		$updateToken = $request->request->get('utoken', '');
311 311
 
312
-		if ( $updateToken === '' ) {
313
-			return $app->json( [
312
+		if ($updateToken === '') {
313
+			return $app->json([
314 314
 				'status' => 'ERR',
315
-				'message' => $ffFactory->getTranslator()->trans( 'comment_failure_access_denied' ),
316
-			] );
315
+				'message' => $ffFactory->getTranslator()->trans('comment_failure_access_denied'),
316
+			]);
317 317
 		}
318 318
 
319
-		$response = $ffFactory->newAddCommentUseCase( $updateToken )->addComment( $addCommentRequest );
319
+		$response = $ffFactory->newAddCommentUseCase($updateToken)->addComment($addCommentRequest);
320 320
 
321
-		if ( $response->isSuccessful() ) {
322
-			return $app->json( [
321
+		if ($response->isSuccessful()) {
322
+			return $app->json([
323 323
 				'status' => 'OK',
324
-				'message' => $ffFactory->getTranslator()->trans( $response->getSuccessMessage() ),
325
-			] );
324
+				'message' => $ffFactory->getTranslator()->trans($response->getSuccessMessage()),
325
+			]);
326 326
 		}
327 327
 
328
-		return $app->json( [
328
+		return $app->json([
329 329
 			'status' => 'ERR',
330
-			'message' => $ffFactory->getTranslator()->trans( $response->getErrorMessage() ),
331
-		] );
330
+			'message' => $ffFactory->getTranslator()->trans($response->getErrorMessage()),
331
+		]);
332 332
 	}
333 333
 );
334 334
 
335 335
 $app->post(
336 336
 	'contact/get-in-touch',
337
-	function( Request $request ) use ( $app, $ffFactory ) {
337
+	function(Request $request) use ($app, $ffFactory) {
338 338
 		$contactFormRequest = new GetInTouchRequest(
339
-			$request->get( 'firstname', '' ),
340
-			$request->get( 'lastname', '' ),
341
-			$request->get( 'email', '' ),
342
-			$request->get( 'subject', '' ),
343
-			$request->get( 'messageBody', '' )
339
+			$request->get('firstname', ''),
340
+			$request->get('lastname', ''),
341
+			$request->get('email', ''),
342
+			$request->get('subject', ''),
343
+			$request->get('messageBody', '')
344 344
 		);
345 345
 
346
-		$contactFormResponse = $ffFactory->newGetInTouchUseCase()->processContactRequest( $contactFormRequest );
347
-		if ( $contactFormResponse->isSuccessful() ) {
348
-			return $app->redirect( $app['url_generator']->generate( 'page', [ 'pageName' => 'KontaktBestaetigung' ] ) );
346
+		$contactFormResponse = $ffFactory->newGetInTouchUseCase()->processContactRequest($contactFormRequest);
347
+		if ($contactFormResponse->isSuccessful()) {
348
+			return $app->redirect($app['url_generator']->generate('page', ['pageName' => 'KontaktBestaetigung']));
349 349
 		}
350
-		return $ffFactory->newGetInTouchHTMLPresenter()->present( $contactFormResponse, $request->request->all() );
350
+		return $ffFactory->newGetInTouchHTMLPresenter()->present($contactFormResponse, $request->request->all());
351 351
 	}
352 352
 );
353 353
 
354 354
 $app->post(
355 355
 	'donation/cancel',
356
-	function( Request $request ) use ( $app, $ffFactory ) {
356
+	function(Request $request) use ($app, $ffFactory) {
357 357
 		$cancellationRequest = new CancelDonationRequest(
358
-			(int)$request->request->get( 'sid', '' )
358
+			(int)$request->request->get('sid', '')
359 359
 		);
360 360
 
361
-		$responseModel = $ffFactory->newCancelDonationUseCase( $request->request->get( 'utoken', '' ) )
362
-			->cancelDonation( $cancellationRequest );
361
+		$responseModel = $ffFactory->newCancelDonationUseCase($request->request->get('utoken', ''))
362
+			->cancelDonation($cancellationRequest);
363 363
 
364
-		$httpResponse = new Response( $ffFactory->newCancelDonationHtmlPresenter()->present( $responseModel ) );
365
-		if ( $responseModel->cancellationSucceeded() ) {
366
-			$httpResponse->headers->clearCookie( 'donation_timestamp' );
364
+		$httpResponse = new Response($ffFactory->newCancelDonationHtmlPresenter()->present($responseModel));
365
+		if ($responseModel->cancellationSucceeded()) {
366
+			$httpResponse->headers->clearCookie('donation_timestamp');
367 367
 		}
368 368
 
369 369
 		return $httpResponse;
@@ -373,112 +373,112 @@  discard block
 block discarded – undo
373 373
 
374 374
 $app->post(
375 375
 	'donation/add',
376
-	function( Application $app, Request $request ) use ( $ffFactory ) {
377
-		return ( new AddDonationHandler( $ffFactory, $app ) )
378
-			->handle( $request, $app['session']->get( 'piwikTracking', [] ) );
376
+	function(Application $app, Request $request) use ($ffFactory) {
377
+		return (new AddDonationHandler($ffFactory, $app))
378
+			->handle($request, $app['session']->get('piwikTracking', []));
379 379
 	}
380 380
 );
381 381
 
382 382
 // Show a donation form with pre-filled payment values, e.g. when coming from a banner
383
-$app->get( 'donation/new', function ( Application $app, Request $request ) use ( $ffFactory ) {
384
-	$amount = Euro::newFromFloat( ( new AmountParser( 'de_DE' ) )->parseAsFloat( $request->get( 'betrag', '' ) ) );
383
+$app->get('donation/new', function(Application $app, Request $request) use ($ffFactory) {
384
+	$amount = Euro::newFromFloat((new AmountParser('de_DE'))->parseAsFloat($request->get('betrag', '')));
385 385
 
386
-	return new Response( $ffFactory->newDonationFormPresenter()->present(
386
+	return new Response($ffFactory->newDonationFormPresenter()->present(
387 387
 		$amount,
388
-		$request->get( 'zahlweise', '' ),
389
-		intval( $request->get( 'periode', 0 ) )
390
-	) );
388
+		$request->get('zahlweise', ''),
389
+		intval($request->get('periode', 0))
390
+	));
391 391
 } );
392 392
 
393 393
 $app->post(
394 394
 	'apply-for-membership',
395
-	function( Application $app, Request $httpRequest ) use ( $ffFactory ) {
396
-		return ( new ApplyForMembershipHandler( $ffFactory, $app ) )->handle( $httpRequest );
395
+	function(Application $app, Request $httpRequest) use ($ffFactory) {
396
+		return (new ApplyForMembershipHandler($ffFactory, $app))->handle($httpRequest);
397 397
 	}
398 398
 );
399 399
 
400 400
 $app->get(
401 401
 	'show-membership-confirmation',
402
-	function( Application $app, Request $request ) use ( $ffFactory ) {
403
-		$confirmationRequest = new ShowMembershipAppConfirmationRequest( (int)$request->query->get( 'id', 0 ) );
402
+	function(Application $app, Request $request) use ($ffFactory) {
403
+		$confirmationRequest = new ShowMembershipAppConfirmationRequest((int)$request->query->get('id', 0));
404 404
 
405 405
 		return $ffFactory->newMembershipApplicationConfirmationHtmlPresenter()->present(
406
-			$ffFactory->newMembershipApplicationConfirmationUseCase( $request->query->get( 'token', '' ) )
407
-				->showConfirmation( $confirmationRequest )
406
+			$ffFactory->newMembershipApplicationConfirmationUseCase($request->query->get('token', ''))
407
+				->showConfirmation($confirmationRequest)
408 408
 		);
409 409
 	}
410
-)->bind( 'show-membership-confirmation' );
410
+)->bind('show-membership-confirmation');
411 411
 
412 412
 $app->get(
413 413
 	'cancel-membership-application',
414
-	function( Application $app, Request $request ) use ( $ffFactory ) {
414
+	function(Application $app, Request $request) use ($ffFactory) {
415 415
 		$cancellationRequest = new CancellationRequest(
416
-			(int)$request->query->get( 'id', '' )
416
+			(int)$request->query->get('id', '')
417 417
 		);
418 418
 
419 419
 		return $ffFactory->newCancelMembershipApplicationHtmlPresenter()->present(
420
-			$ffFactory->newCancelMembershipApplicationUseCase( $request->query->get( 'updateToken', '' ) )
421
-				->cancelApplication( $cancellationRequest )
420
+			$ffFactory->newCancelMembershipApplicationUseCase($request->query->get('updateToken', ''))
421
+				->cancelApplication($cancellationRequest)
422 422
 		);
423 423
 	}
424 424
 );
425 425
 
426 426
 $app->match(
427 427
 	'show-donation-confirmation',
428
-	function( Application $app, Request $request ) use ( $ffFactory ) {
429
-		return ( new ShowDonationConfirmationHandler( $ffFactory ) )->handle(
428
+	function(Application $app, Request $request) use ($ffFactory) {
429
+		return (new ShowDonationConfirmationHandler($ffFactory))->handle(
430 430
 			$request,
431
-			$app['session']->get( 'piwikTracking', [] )
431
+			$app['session']->get('piwikTracking', [])
432 432
 		);
433 433
 	}
434
-)->bind( 'show-donation-confirmation' )->method( 'GET|POST' );
434
+)->bind('show-donation-confirmation')->method('GET|POST');
435 435
 
436 436
 $app->post(
437 437
 	'handle-paypal-payment-notification',
438
-	function ( Application $app, Request $request ) use ( $ffFactory ) {
439
-		return ( new PayPalNotificationHandler( $ffFactory ) )->handle( $request );
438
+	function(Application $app, Request $request) use ($ffFactory) {
439
+		return (new PayPalNotificationHandler($ffFactory))->handle($request);
440 440
 	}
441 441
 );
442 442
 
443 443
 $app->get(
444 444
 	'handle-creditcard-payment-notification',
445
-	function ( Application $app, Request $request ) use ( $ffFactory ) {
445
+	function(Application $app, Request $request) use ($ffFactory) {
446 446
 		try {
447
-			$ffFactory->newCreditCardNotificationUseCase( $request->query->get( 'utoken', '' ) )
447
+			$ffFactory->newCreditCardNotificationUseCase($request->query->get('utoken', ''))
448 448
 				->handleNotification(
449
-					( new CreditCardPaymentNotificationRequest() )
450
-						->setTransactionId( $request->query->get( 'transactionId', '' ) )
451
-						->setDonationId( (int)$request->query->get( 'donation_id', '' ) )
452
-						->setAmount( Euro::newFromCents( (int)$request->query->get( 'amount' ) ) )
453
-						->setCustomerId( $request->query->get( 'customerId', '' ) )
454
-						->setSessionId( $request->query->get( 'sessionId', '' ) )
455
-						->setAuthId( $request->query->get(  'auth', '' ) )
456
-						->setTitle( $request->query->get( 'title', '' ) )
457
-						->setCountry( $request->query->get( 'country', '' ) )
458
-						->setCurrency( $request->query->get( 'currency', '' ) )
449
+					(new CreditCardPaymentNotificationRequest())
450
+						->setTransactionId($request->query->get('transactionId', ''))
451
+						->setDonationId((int)$request->query->get('donation_id', ''))
452
+						->setAmount(Euro::newFromCents((int)$request->query->get('amount')))
453
+						->setCustomerId($request->query->get('customerId', ''))
454
+						->setSessionId($request->query->get('sessionId', ''))
455
+						->setAuthId($request->query->get('auth', ''))
456
+						->setTitle($request->query->get('title', ''))
457
+						->setCountry($request->query->get('country', ''))
458
+						->setCurrency($request->query->get('currency', ''))
459 459
 				);
460 460
 
461 461
 			$response = CreditCardNotificationResponse::newSuccessResponse(
462
-				(int)$request->query->get( 'donation_id', '' ),
463
-				$request->query->get( 'token', '' )
462
+				(int)$request->query->get('donation_id', ''),
463
+				$request->query->get('token', '')
464 464
  			);
465
-		} catch ( CreditCardPaymentHandlerException $e ) {
466
-			$response = CreditCardNotificationResponse::newFailureResponse( $e->getMessage() );
465
+		} catch (CreditCardPaymentHandlerException $e) {
466
+			$response = CreditCardNotificationResponse::newFailureResponse($e->getMessage());
467 467
 		}
468 468
 
469
-		return new Response( $ffFactory->newCreditCardNotificationPresenter()->present( $response ) );
469
+		return new Response($ffFactory->newCreditCardNotificationPresenter()->present($response));
470 470
 	}
471 471
 );
472 472
 
473
-$app->get( '/', function ( Application $app, Request $request ) {
474
-	$app['session']->set( 'piwikTracking', array_filter(
473
+$app->get('/', function(Application $app, Request $request) {
474
+	$app['session']->set('piwikTracking', array_filter(
475 475
 			[
476
-				'paymentType' => $request->get( 'zahlweise', '' ),
477
-				'paymentAmount' => $request->get( 'betrag', '' ),
478
-				'paymentInterval' => $request->get( 'periode', '' )
476
+				'paymentType' => $request->get('zahlweise', ''),
477
+				'paymentAmount' => $request->get('betrag', ''),
478
+				'paymentInterval' => $request->get('periode', '')
479 479
 			],
480
-			function ( string $value ) {
481
-				return $value !== '' && strlen( $value ) < 20;
480
+			function(string $value) {
481
+				return $value !== '' && strlen($value) < 20;
482 482
 			} )
483 483
 	);
484 484
 
@@ -496,26 +496,26 @@  discard block
 block discarded – undo
496 496
 } );
497 497
 
498 498
 // redirect display page requests from old URLs
499
-$app->get( '/spenden/{page}', function( Application $app, Request $request, string $page ) {
500
-	return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle( '/page/' . $page );
501
-} )->assert( 'page', '[a-zA-Z_\-\s\x7f-\xff]+' );
499
+$app->get('/spenden/{page}', function(Application $app, Request $request, string $page) {
500
+	return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle('/page/' . $page);
501
+} )->assert('page', '[a-zA-Z_\-\s\x7f-\xff]+');
502 502
 
503 503
 // redirect different formats of comment lists
504
-$app->get( '/spenden/{outputFormat}.php', function( Application $app, Request $request, string $outputFormat ) {
505
-	return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle(
506
-		'/list-comments.' . ( $outputFormat === 'list' ? 'html' : $outputFormat )
504
+$app->get('/spenden/{outputFormat}.php', function(Application $app, Request $request, string $outputFormat) {
505
+	return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle(
506
+		'/list-comments.' . ($outputFormat === 'list' ? 'html' : $outputFormat)
507 507
 	);
508
-} )->assert( 'outputFormat', 'list|rss|json' );
508
+} )->assert('outputFormat', 'list|rss|json');
509 509
 
510 510
 // redirect all other calls to default route
511
-$app->get( '/spenden{page}', function( Application $app, Request $request ) {
512
-	return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle( '/' );
513
-} )->assert( 'page', '/?([a-z]+\.php)?' );
511
+$app->get('/spenden{page}', function(Application $app, Request $request) {
512
+	return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle('/');
513
+} )->assert('page', '/?([a-z]+\.php)?');
514 514
 
515
-$app->get( '/purge-cache', function( Application $app, Request $request ) use ( $ffFactory ) {
516
-	$request = new PurgeCacheRequest( $request->query->get( 'secret', '' ) );
515
+$app->get('/purge-cache', function(Application $app, Request $request) use ($ffFactory) {
516
+	$request = new PurgeCacheRequest($request->query->get('secret', ''));
517 517
 
518
-	$response = $ffFactory->newPurgeCacheUseCase()->purgeCache( $request );
518
+	$response = $ffFactory->newPurgeCacheUseCase()->purgeCache($request);
519 519
 
520 520
 	return new Response(
521 521
 		[
Please login to merge, or discard this patch.