Completed
Pull Request — master (#653)
by Jeroen De
62:06
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 {
@@ -705,45 +705,45 @@  discard block
 block discarded – undo
705 705
 	}
706 706
 
707 707
 	public function newCachePurger(): CachePurger {
708
-		return new AllOfTheCachePurger( $this->getTwig(), $this->getPageCache() );
708
+		return new AllOfTheCachePurger($this->getTwig(), $this->getPageCache());
709 709
 	}
710 710
 
711 711
 	private function newBankDataValidator(): BankDataValidator {
712
-		return new BankDataValidator( $this->newIbanValidator() );
712
+		return new BankDataValidator($this->newIbanValidator());
713 713
 	}
714 714
 
715 715
 	private function getMessenger(): Messenger {
716 716
 		return $this->pimple['messenger'];
717 717
 	}
718 718
 
719
-	public function setMessenger( Messenger $messenger ) {
719
+	public function setMessenger(Messenger $messenger) {
720 720
 		$this->pimple['messenger'] = $messenger;
721 721
 	}
722 722
 
723 723
 	public function setNullMessenger() {
724
-		$this->setMessenger( new Messenger(
724
+		$this->setMessenger(new Messenger(
725 725
 			Swift_NullTransport::newInstance(),
726 726
 			$this->getOperatorAddress()
727
-		) );
727
+		));
728 728
 	}
729 729
 
730 730
 	public function getOperatorAddress() {
731
-		return new EmailAddress( $this->config['operator-email'] );
731
+		return new EmailAddress($this->config['operator-email']);
732 732
 	}
733 733
 
734 734
 	public function newInternalErrorHTMLPresenter(): InternalErrorHtmlPresenter {
735
-		return new InternalErrorHtmlPresenter( $this->getIncludeTemplate( 'ErrorPage.twig' ) );
735
+		return new InternalErrorHtmlPresenter($this->getIncludeTemplate('ErrorPage.twig'));
736 736
 	}
737 737
 
738 738
 	public function newAccessDeniedHTMLPresenter(): InternalErrorHtmlPresenter {
739
-		return new InternalErrorHtmlPresenter( $this->getLayoutTemplate( 'AccessDenied.twig' ) );
739
+		return new InternalErrorHtmlPresenter($this->getLayoutTemplate('AccessDenied.twig'));
740 740
 	}
741 741
 
742 742
 	public function getTranslator(): TranslatorInterface {
743 743
 		return $this->pimple['translator'];
744 744
 	}
745 745
 
746
-	public function setTranslator( TranslatorInterface $translator ) {
746
+	public function setTranslator(TranslatorInterface $translator) {
747 747
 		$this->pimple['translator'] = $translator;
748 748
 	}
749 749
 
@@ -751,25 +751,25 @@  discard block
 block discarded – undo
751 751
 		return $this->pimple['twig_factory'];
752 752
 	}
753 753
 
754
-	private function newTextPolicyValidator( string $policyName ): TextPolicyValidator {
754
+	private function newTextPolicyValidator(string $policyName): TextPolicyValidator {
755 755
 		$contentProvider = $this->newWikiPageRetriever();
756 756
 		$textPolicyConfig = $this->config['text-policies'][$policyName];
757 757
 
758 758
 		return new TextPolicyValidator(
759
-			new PageRetrieverBasedStringList( $contentProvider, $textPolicyConfig['badwords'] ?? '' ),
760
-			new PageRetrieverBasedStringList( $contentProvider, $textPolicyConfig['whitewords'] ?? '' )
759
+			new PageRetrieverBasedStringList($contentProvider, $textPolicyConfig['badwords'] ?? ''),
760
+			new PageRetrieverBasedStringList($contentProvider, $textPolicyConfig['whitewords'] ?? '')
761 761
 		);
762 762
 	}
763 763
 
764 764
 	private function newCommentPolicyValidator(): TextPolicyValidator {
765
-		return $this->newTextPolicyValidator( 'comment' );
765
+		return $this->newTextPolicyValidator('comment');
766 766
 	}
767 767
 
768
-	public function newCancelDonationUseCase( string $updateToken ): CancelDonationUseCase {
768
+	public function newCancelDonationUseCase(string $updateToken): CancelDonationUseCase {
769 769
 		return new CancelDonationUseCase(
770 770
 			$this->getDonationRepository(),
771 771
 			$this->newCancelDonationMailer(),
772
-			$this->newDonationAuthorizer( $updateToken ),
772
+			$this->newDonationAuthorizer($updateToken),
773 773
 			$this->newDonationEventLogger()
774 774
 		);
775 775
 	}
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 			new TwigTemplate(
780 780
 				$this->getTwig(),
781 781
 				'Mail_Donation_Cancellation_Confirmation.twig',
782
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
782
+				['greeting_generator' => $this->getGreetingGenerator()]
783 783
 			),
784 784
 			'mail_subject_confirm_cancellation'
785 785
 		);
@@ -837,19 +837,19 @@  discard block
 block discarded – undo
837 837
 	}
838 838
 
839 839
 	public function newPayPalUrlGenerator() {
840
-		return new PayPalUrlGenerator( $this->getPayPalUrlConfig() );
840
+		return new PayPalUrlGenerator($this->getPayPalUrlConfig());
841 841
 	}
842 842
 
843 843
 	private function getPayPalUrlConfig() {
844
-		return PayPalUrlConfig::newFromConfig( $this->config['paypal'] );
844
+		return PayPalUrlConfig::newFromConfig($this->config['paypal']);
845 845
 	}
846 846
 
847 847
 	private function newCreditCardUrlGenerator() {
848
-		return new CreditCardUrlGenerator( $this->newCreditCardUrlConfig() );
848
+		return new CreditCardUrlGenerator($this->newCreditCardUrlConfig());
849 849
 	}
850 850
 
851 851
 	private function newCreditCardUrlConfig() {
852
-		return CreditCardUrlConfig::newFromConfig( $this->config['creditcard'] );
852
+		return CreditCardUrlConfig::newFromConfig($this->config['creditcard']);
853 853
 	}
854 854
 
855 855
 	public function getDonationRepository(): DonationRepository {
@@ -857,27 +857,27 @@  discard block
 block discarded – undo
857 857
 	}
858 858
 
859 859
 	public function newPaymentDataValidator(): PaymentDataValidator {
860
-		return new PaymentDataValidator( $this->config['donation-minimum-amount'], $this->config['donation-maximum-amount'] );
860
+		return new PaymentDataValidator($this->config['donation-minimum-amount'], $this->config['donation-maximum-amount']);
861 861
 	}
862 862
 
863 863
 	private function newAmountFormatter(): AmountFormatter {
864
-		return new AmountFormatter( $this->config['locale'] );
864
+		return new AmountFormatter($this->config['locale']);
865 865
 	}
866 866
 
867 867
 	public function newDecimalNumberFormatter(): NumberFormatter {
868
-		return new NumberFormatter( $this->config['locale'], NumberFormatter::DECIMAL );
868
+		return new NumberFormatter($this->config['locale'], NumberFormatter::DECIMAL);
869 869
 	}
870 870
 
871
-	public function newAddCommentUseCase( string $updateToken ): AddCommentUseCase {
871
+	public function newAddCommentUseCase(string $updateToken): AddCommentUseCase {
872 872
 		return new AddCommentUseCase(
873 873
 			$this->getDonationRepository(),
874
-			$this->newDonationAuthorizer( $updateToken ),
874
+			$this->newDonationAuthorizer($updateToken),
875 875
 			$this->newCommentPolicyValidator(),
876 876
 			$this->newAddCommentValidator()
877 877
 		);
878 878
 	}
879 879
 
880
-	private function newDonationAuthorizer( string $updateToken = null, string $accessToken = null ): DonationAuthorizer {
880
+	private function newDonationAuthorizer(string $updateToken = null, string $accessToken = null): DonationAuthorizer {
881 881
 		return new DoctrineDonationAuthorizer(
882 882
 			$this->getEntityManager(),
883 883
 			$updateToken,
@@ -891,13 +891,13 @@  discard block
 block discarded – undo
891 891
 
892 892
 	public function newDonationConfirmationPresenter() {
893 893
 		return new DonationConfirmationHtmlPresenter(
894
-			$this->getIncludeTemplate( 'DonationConfirmation.twig', [ 'piwikGoals' => [ 3 ] ] )
894
+			$this->getIncludeTemplate('DonationConfirmation.twig', ['piwikGoals' => [3]])
895 895
 		);
896 896
 	}
897 897
 
898 898
 	public function newCreditCardPaymentHtmlPresenter() {
899 899
 		return new CreditCardPaymentHtmlPresenter(
900
-			$this->getIncludeTemplate( 'CreditCardPaymentIframe.twig' ),
900
+			$this->getIncludeTemplate('CreditCardPaymentIframe.twig'),
901 901
 			$this->getTranslator(),
902 902
 			$this->newCreditCardUrlGenerator()
903 903
 		);
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
 
906 906
 	public function newCancelDonationHtmlPresenter() {
907 907
 		return new CancelDonationHtmlPresenter(
908
-			$this->getIncludeTemplate( 'Donation_Cancellation_Confirmation.twig' )
908
+			$this->getIncludeTemplate('Donation_Cancellation_Confirmation.twig')
909 909
 		);
910 910
 	}
911 911
 
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 			new TwigTemplate(
926 926
 				$this->getTwig(),
927 927
 				'Mail_Membership_Application_Confirmation.twig',
928
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
928
+				['greeting_generator' => $this->getGreetingGenerator()]
929 929
 			),
930 930
 			'mail_subject_confirm_membership_application'
931 931
 		);
@@ -940,16 +940,16 @@  discard block
 block discarded – undo
940 940
 	}
941 941
 
942 942
 	private function newMembershipApplicationTracker(): ApplicationTracker {
943
-		return new DoctrineApplicationTracker( $this->getEntityManager() );
943
+		return new DoctrineApplicationTracker($this->getEntityManager());
944 944
 	}
945 945
 
946 946
 	private function newMembershipApplicationPiwikTracker(): ApplicationPiwikTracker {
947
-		return new DoctrineApplicationPiwikTracker( $this->getEntityManager() );
947
+		return new DoctrineApplicationPiwikTracker($this->getEntityManager());
948 948
 	}
949 949
 
950
-	public function newCancelMembershipApplicationUseCase( string $updateToken ): CancelMembershipApplicationUseCase {
950
+	public function newCancelMembershipApplicationUseCase(string $updateToken): CancelMembershipApplicationUseCase {
951 951
 		return new CancelMembershipApplicationUseCase(
952
-			$this->newMembershipApplicationAuthorizer( $updateToken ),
952
+			$this->newMembershipApplicationAuthorizer($updateToken),
953 953
 			$this->getMembershipApplicationRepository(),
954 954
 			$this->newCancelMembershipApplicationMailer()
955 955
 		);
@@ -974,27 +974,27 @@  discard block
 block discarded – undo
974 974
 			new TwigTemplate(
975 975
 				$this->getTwig(),
976 976
 				'Mail_Membership_Application_Cancellation_Confirmation.twig',
977
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
977
+				['greeting_generator' => $this->getGreetingGenerator()]
978 978
 			),
979 979
 			'mail_subject_confirm_membership_application_cancellation'
980 980
 		);
981 981
 	}
982 982
 
983
-	public function newMembershipApplicationConfirmationUseCase( string $accessToken ) {
983
+	public function newMembershipApplicationConfirmationUseCase(string $accessToken) {
984 984
 		return new ShowMembershipApplicationConfirmationUseCase(
985
-			$this->newMembershipApplicationAuthorizer( null, $accessToken ), $this->getMembershipApplicationRepository(),
985
+			$this->newMembershipApplicationAuthorizer(null, $accessToken), $this->getMembershipApplicationRepository(),
986 986
 			$this->newMembershipApplicationTokenFetcher()
987 987
 		);
988 988
 	}
989 989
 
990
-	public function newShowDonationConfirmationUseCase( string $accessToken ): ShowDonationConfirmationUseCase {
990
+	public function newShowDonationConfirmationUseCase(string $accessToken): ShowDonationConfirmationUseCase {
991 991
 		return new ShowDonationConfirmationUseCase(
992
-			$this->newDonationAuthorizer( null, $accessToken ),
992
+			$this->newDonationAuthorizer(null, $accessToken),
993 993
 			$this->getDonationRepository()
994 994
 		);
995 995
 	}
996 996
 
997
-	public function setDonationConfirmationPageSelector( DonationConfirmationPageSelector $selector ) {
997
+	public function setDonationConfirmationPageSelector(DonationConfirmationPageSelector $selector) {
998 998
 		$this->pimple['confirmation-page-selector'] = $selector;
999 999
 	}
1000 1000
 
@@ -1005,21 +1005,21 @@  discard block
 block discarded – undo
1005 1005
 	public function newDonationFormViolationPresenter() {
1006 1006
 		// TODO make the template name dependent on the 'form' value from the HTTP POST request
1007 1007
 		// (we need different form pages for A/B testing)
1008
-		$template = $this->getLayoutTemplate( 'DisplayPageLayout.twig', [ 'main_template' => 'DonationForm.twig' ] );
1009
-		return new DonationFormViolationPresenter( $template, $this->newAmountFormatter() );
1008
+		$template = $this->getLayoutTemplate('DisplayPageLayout.twig', ['main_template' => 'DonationForm.twig']);
1009
+		return new DonationFormViolationPresenter($template, $this->newAmountFormatter());
1010 1010
 	}
1011 1011
 
1012 1012
 	public function newDonationFormPresenter() {
1013 1013
 		// TODO make the template name dependent on the 'form' value from the HTTP POST request
1014 1014
 		// (we need different form pages for A/B testing)
1015
-		$template = $this->getLayoutTemplate( 'DisplayPageLayout.twig', [ 'main_template' => 'DonationForm.twig' ] );
1016
-		return new DonationFormPresenter( $template, $this->newAmountFormatter() );
1015
+		$template = $this->getLayoutTemplate('DisplayPageLayout.twig', ['main_template' => 'DonationForm.twig']);
1016
+		return new DonationFormPresenter($template, $this->newAmountFormatter());
1017 1017
 	}
1018 1018
 
1019
-	public function newHandlePayPalPaymentNotificationUseCase( string $updateToken ) {
1019
+	public function newHandlePayPalPaymentNotificationUseCase(string $updateToken) {
1020 1020
 		return new HandlePayPalPaymentNotificationUseCase(
1021 1021
 			$this->getDonationRepository(),
1022
-			$this->newDonationAuthorizer( $updateToken ),
1022
+			$this->newDonationAuthorizer($updateToken),
1023 1023
 			$this->newDonationConfirmationMailer(),
1024 1024
 			$this->getLogger(),
1025 1025
 			$this->newDonationEventLogger()
@@ -1030,14 +1030,14 @@  discard block
 block discarded – undo
1030 1030
 		return $this->pimple['paypal-payment-notification-verifier'];
1031 1031
 	}
1032 1032
 
1033
-	public function setPayPalPaymentNotificationVerifier( PaymentNotificationVerifier $verifier ) {
1033
+	public function setPayPalPaymentNotificationVerifier(PaymentNotificationVerifier $verifier) {
1034 1034
 		$this->pimple['paypal-payment-notification-verifier'] = $verifier;
1035 1035
 	}
1036 1036
 
1037
-	public function newCreditCardNotificationUseCase( string $updateToken ) {
1037
+	public function newCreditCardNotificationUseCase(string $updateToken) {
1038 1038
 		return new CreditCardNotificationUseCase(
1039 1039
 			$this->getDonationRepository(),
1040
-			$this->newDonationAuthorizer( $updateToken ),
1040
+			$this->newDonationAuthorizer($updateToken),
1041 1041
 			$this->getCreditCardService(),
1042 1042
 			$this->newDonationConfirmationMailer(),
1043 1043
 			$this->getLogger(),
@@ -1047,23 +1047,23 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
 	public function newCancelMembershipApplicationHtmlPresenter() {
1049 1049
 		return new CancelMembershipApplicationHtmlPresenter(
1050
-			$this->getIncludeTemplate( 'Membership_Application_Cancellation_Confirmation.twig' )
1050
+			$this->getIncludeTemplate('Membership_Application_Cancellation_Confirmation.twig')
1051 1051
 		);
1052 1052
 	}
1053 1053
 
1054 1054
 	public function newMembershipApplicationConfirmationHtmlPresenter() {
1055 1055
 		return new MembershipApplicationConfirmationHtmlPresenter(
1056
-			$this->getIncludeTemplate( 'MembershipApplicationConfirmation.twig' )
1056
+			$this->getIncludeTemplate('MembershipApplicationConfirmation.twig')
1057 1057
 		);
1058 1058
 	}
1059 1059
 
1060 1060
 	public function newMembershipFormViolationPresenter() {
1061 1061
 		return new MembershipFormViolationPresenter(
1062
-			$this->getIncludeTemplate( 'MembershipApplication.twig' )
1062
+			$this->getIncludeTemplate('MembershipApplication.twig')
1063 1063
 		);
1064 1064
 	}
1065 1065
 
1066
-	public function setCreditCardService( CreditCardService $ccService ) {
1066
+	public function setCreditCardService(CreditCardService $ccService) {
1067 1067
 		$this->pimple['credit-card-api-service'] = $ccService;
1068 1068
 	}
1069 1069
 
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 			new TwigTemplate(
1077 1077
 				$this->getTwig(),
1078 1078
 				'CreditCardPaymentNotification.twig',
1079
-				[ 'returnUrl' => $this->config['creditcard']['return-url'] ]
1079
+				['returnUrl' => $this->config['creditcard']['return-url']]
1080 1080
 			)
1081 1081
 		);
1082 1082
 	}
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 		);
1098 1098
 	}
1099 1099
 
1100
-	public function setTokenGenerator( TokenGenerator $tokenGenerator ) {
1100
+	public function setTokenGenerator(TokenGenerator $tokenGenerator) {
1101 1101
 		$this->pimple['token_generator'] = $tokenGenerator;
1102 1102
 	}
1103 1103
 
@@ -1120,22 +1120,22 @@  discard block
 block discarded – undo
1120 1120
 	private function newDonationPolicyValidator(): AddDonationPolicyValidator {
1121 1121
 		return new AddDonationPolicyValidator(
1122 1122
 			$this->newDonationAmountPolicyValidator(),
1123
-			$this->newTextPolicyValidator( 'fields' )
1123
+			$this->newTextPolicyValidator('fields')
1124 1124
 		);
1125 1125
 	}
1126 1126
 
1127 1127
 	private function newDonationAmountPolicyValidator(): AmountPolicyValidator {
1128 1128
 		// in the future, this might come from the configuration
1129
-		return new AmountPolicyValidator( 1000, 200, 300 );
1129
+		return new AmountPolicyValidator(1000, 200, 300);
1130 1130
 	}
1131 1131
 
1132 1132
 	public function getDonationTimeframeLimit() {
1133 1133
 		return $this->config['donation-timeframe-limit'];
1134 1134
 	}
1135 1135
 
1136
-	public function newSystemMessageResponse( string $message ) {
1137
-		$test = $this->getIncludeTemplate( 'System_Message.twig' );
1138
-		return $test->render( [ 'message' => $message ] );
1136
+	public function newSystemMessageResponse(string $message) {
1137
+		$test = $this->getIncludeTemplate('System_Message.twig');
1138
+		return $test->render(['message' => $message]);
1139 1139
 	}
1140 1140
 
1141 1141
 	public function getMembershipApplicationTimeframeLimit() {
@@ -1151,26 +1151,26 @@  discard block
 block discarded – undo
1151 1151
 	}
1152 1152
 
1153 1153
 	public function enablePageCache() {
1154
-		$this->pimple['page_cache'] = $this->pimple->share( function() {
1155
-			return new FilesystemCache( $this->getCachePath() . '/pages' );
1154
+		$this->pimple['page_cache'] = $this->pimple->share(function() {
1155
+			return new FilesystemCache($this->getCachePath() . '/pages');
1156 1156
 		} );
1157 1157
 	}
1158 1158
 
1159
-	private function addProfilingDecorator( $objectToDecorate, string $profilingLabel ) {
1160
-		if ( $this->profiler === null ) {
1159
+	private function addProfilingDecorator($objectToDecorate, string $profilingLabel) {
1160
+		if ($this->profiler === null) {
1161 1161
 			return $objectToDecorate;
1162 1162
 		}
1163 1163
 
1164
-		$builder = new ProfilingDecoratorBuilder( $this->profiler, $this->getProfilerDataCollector() );
1164
+		$builder = new ProfilingDecoratorBuilder($this->profiler, $this->getProfilerDataCollector());
1165 1165
 
1166
-		return $builder->decorate( $objectToDecorate, $profilingLabel );
1166
+		return $builder->decorate($objectToDecorate, $profilingLabel);
1167 1167
 	}
1168 1168
 
1169
-	public function setProfiler( Stopwatch $profiler ) {
1169
+	public function setProfiler(Stopwatch $profiler) {
1170 1170
 		$this->profiler = $profiler;
1171 1171
 	}
1172 1172
 
1173
-	public function setLogger( LoggerInterface $logger ) {
1173
+	public function setLogger(LoggerInterface $logger) {
1174 1174
 		$this->pimple['logger'] = $logger;
1175 1175
 	}
1176 1176
 
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
 	}
1180 1180
 
1181 1181
 	private function newIbanValidator(): IbanValidator {
1182
-		return new IbanValidator( $this->newBankDataConverter(), $this->config['banned-ibans'] );
1182
+		return new IbanValidator($this->newBankDataConverter(), $this->config['banned-ibans']);
1183 1183
 	}
1184 1184
 
1185 1185
 	public function getCachePurgingSecret(): string {
Please login to merge, or discard this patch.
app/routes.php 2 patches
Spacing   +203 added lines, -203 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;
@@ -41,141 +41,141 @@  discard block
 block discarded – undo
41 41
 use WMDE\Fundraising\Frontend\SubscriptionContext\UseCases\AddSubscription\SubscriptionRequest;
42 42
 use WMDE\Fundraising\Frontend\Validation\MembershipFeeValidator;
43 43
 
44
-$app->before( function( Request $request ) {
45
-	foreach ( [ $request->request, $request->query ] as $parameterBag ) {
46
-		foreach ( $parameterBag->keys() as $key ) {
47
-			if ( is_string( $parameterBag->get( $key ) ) ) {
48
-				$parameterBag->set( $key, trim( $parameterBag->get( $key ) ) );
44
+$app->before(function(Request $request) {
45
+	foreach ([$request->request, $request->query] as $parameterBag) {
46
+		foreach ($parameterBag->keys() as $key) {
47
+			if (is_string($parameterBag->get($key))) {
48
+				$parameterBag->set($key, trim($parameterBag->get($key)));
49 49
 			}
50 50
 		}
51 51
 	}
52
-}, Application::EARLY_EVENT );
52
+}, Application::EARLY_EVENT);
53 53
 
54 54
 $app->post(
55 55
 	'validate-email',
56
-	function( Request $request ) use ( $app, $ffFactory ) {
57
-		$validationResult = $ffFactory->getEmailValidator()->validate( $request->request->get( 'email', '' ) );
58
-		return $app->json( [ 'status' => $validationResult->isSuccessful() ? 'OK' : 'ERR' ] );
56
+	function(Request $request) use ($app, $ffFactory) {
57
+		$validationResult = $ffFactory->getEmailValidator()->validate($request->request->get('email', ''));
58
+		return $app->json(['status' => $validationResult->isSuccessful() ? 'OK' : 'ERR']);
59 59
 	}
60 60
 );
61 61
 
62 62
 $app->post(
63 63
 	'validate-payment-data',
64
-	function( Request $request ) use ( $app, $ffFactory ) {
64
+	function(Request $request) use ($app, $ffFactory) {
65 65
 
66
-		$amount = (float) $ffFactory->newDecimalNumberFormatter()->parse( $request->get( 'amount', '0' ) );
66
+		$amount = (float)$ffFactory->newDecimalNumberFormatter()->parse($request->get('amount', '0'));
67 67
 		$validator = $ffFactory->newPaymentDataValidator();
68
-		$validationResult = $validator->validate( $amount, (string) $request->get( 'paymentType', '' ) );
68
+		$validationResult = $validator->validate($amount, (string)$request->get('paymentType', ''));
69 69
 
70
-		if ( $validationResult->isSuccessful() ) {
71
-			return $app->json( [ 'status' => 'OK' ] );
70
+		if ($validationResult->isSuccessful()) {
71
+			return $app->json(['status' => 'OK']);
72 72
 		} else {
73 73
 			$errors = [];
74
-			foreach( $validationResult->getViolations() as $violation ) {
75
-				$errors[ $violation->getSource() ] = $ffFactory->getTranslator()->trans( $violation->getMessageIdentifier() );
74
+			foreach ($validationResult->getViolations() as $violation) {
75
+				$errors[$violation->getSource()] = $ffFactory->getTranslator()->trans($violation->getMessageIdentifier());
76 76
 			}
77
-			return $app->json( [ 'status' => 'ERR', 'messages' => $errors ] );
77
+			return $app->json(['status' => 'ERR', 'messages' => $errors]);
78 78
 		}
79 79
 	}
80 80
 );
81 81
 
82 82
 $app->post(
83 83
 	'validate-address',
84
-	function( Request $request ) use ( $app, $ffFactory ) {
84
+	function(Request $request) use ($app, $ffFactory) {
85 85
 		$routeHandler = new class() {
86 86
 
87
-			public function handle( FunFunFactory $ffFactory, Application $app, Request $request ) {
88
-				if ( $request->get( 'adressType', '' ) === 'anonym' ) {
89
-					return $app->json( [ 'status' => 'OK' ] );
87
+			public function handle(FunFunFactory $ffFactory, Application $app, Request $request) {
88
+				if ($request->get('adressType', '') === 'anonym') {
89
+					return $app->json(['status' => 'OK']);
90 90
 				}
91 91
 
92
-				$personalInfo = $this->getPersonalInfoFromRequest( $request );
92
+				$personalInfo = $this->getPersonalInfoFromRequest($request);
93 93
 				$personalInfoValidator = $ffFactory->newPersonalInfoValidator();
94
-				$validationResult = $personalInfoValidator->validate( $personalInfo );
94
+				$validationResult = $personalInfoValidator->validate($personalInfo);
95 95
 
96
-				if ( $validationResult->isSuccessful() ) {
97
-					return $app->json( [ 'status' => 'OK' ] );
96
+				if ($validationResult->isSuccessful()) {
97
+					return $app->json(['status' => 'OK']);
98 98
 				} else {
99 99
 					$errors = [];
100
-					foreach( $validationResult->getViolations() as $violation ) {
101
-						$errors[$violation->getSource()] = $ffFactory->getTranslator()->trans( $violation->getMessageIdentifier() );
100
+					foreach ($validationResult->getViolations() as $violation) {
101
+						$errors[$violation->getSource()] = $ffFactory->getTranslator()->trans($violation->getMessageIdentifier());
102 102
 					}
103
-					return $app->json( [ 'status' => 'ERR', 'messages' => $errors ] );
103
+					return $app->json(['status' => 'ERR', 'messages' => $errors]);
104 104
 				}
105 105
 			}
106 106
 
107
-			private function getPersonalInfoFromRequest( Request $request ): Donor {
107
+			private function getPersonalInfoFromRequest(Request $request): Donor {
108 108
 				return new Donor(
109
-					$this->getNameFromRequest( $request ),
110
-					$this->getPhysicalAddressFromRequest( $request ),
111
-					$request->get( 'email', '' )
109
+					$this->getNameFromRequest($request),
110
+					$this->getPhysicalAddressFromRequest($request),
111
+					$request->get('email', '')
112 112
 				);
113 113
 			}
114 114
 
115
-			private function getPhysicalAddressFromRequest( Request $request ): DonorAddress {
115
+			private function getPhysicalAddressFromRequest(Request $request): DonorAddress {
116 116
 				$address = new DonorAddress();
117 117
 
118
-				$address->setStreetAddress( $request->get( 'street', '' ) );
119
-				$address->setPostalCode( $request->get( 'postcode', '' ) );
120
-				$address->setCity( $request->get( 'city', '' ) );
121
-				$address->setCountryCode( $request->get( 'country', '' ) );
118
+				$address->setStreetAddress($request->get('street', ''));
119
+				$address->setPostalCode($request->get('postcode', ''));
120
+				$address->setCity($request->get('city', ''));
121
+				$address->setCountryCode($request->get('country', ''));
122 122
 
123 123
 				return $address->freeze()->assertNoNullFields();
124 124
 			}
125 125
 
126
-			private function getNameFromRequest( Request $request ): DonorName {
127
-				$name = $request->get( 'addressType', '' ) === 'firma'
126
+			private function getNameFromRequest(Request $request): DonorName {
127
+				$name = $request->get('addressType', '') === 'firma'
128 128
 					? DonorName::newCompanyName() : DonorName::newPrivatePersonName();
129 129
 
130
-				$name->setSalutation( $request->get( 'salutation', '' ) );
131
-				$name->setTitle( $request->get( 'title', '' ) );
132
-				$name->setCompanyName( $request->get( 'companyName', '' ) );
133
-				$name->setFirstName( $request->get( 'firstName', '' ) );
134
-				$name->setLastName( $request->get( 'lastName', '' ) );
130
+				$name->setSalutation($request->get('salutation', ''));
131
+				$name->setTitle($request->get('title', ''));
132
+				$name->setCompanyName($request->get('companyName', ''));
133
+				$name->setFirstName($request->get('firstName', ''));
134
+				$name->setLastName($request->get('lastName', ''));
135 135
 
136 136
 				return $name->freeze()->assertNoNullFields();
137 137
 			}
138 138
 		};
139 139
 
140
-		return $routeHandler->handle( $ffFactory, $app, $request );
140
+		return $routeHandler->handle($ffFactory, $app, $request);
141 141
 	}
142 142
 );
143 143
 
144 144
 $app->post(
145 145
 	'validate-fee',
146
-	function( Request $httpRequest ) use ( $app, $ffFactory ) {
146
+	function(Request $httpRequest) use ($app, $ffFactory) {
147 147
 		$validator = new MembershipFeeValidator();
148 148
 		$result = $validator->validate(
149
-			str_replace( ',', '.', $httpRequest->request->get( 'amount', '' ) ),
150
-			(int) $httpRequest->request->get( 'paymentIntervalInMonths', '0' ),
151
-			$httpRequest->request->get( 'addressType', '' )
149
+			str_replace(',', '.', $httpRequest->request->get('amount', '')),
150
+			(int)$httpRequest->request->get('paymentIntervalInMonths', '0'),
151
+			$httpRequest->request->get('addressType', '')
152 152
 		);
153 153
 
154
-		if ( $result->isSuccessful() ) {
155
-			return $app->json( [ 'status' => 'OK' ] );
154
+		if ($result->isSuccessful()) {
155
+			return $app->json(['status' => 'OK']);
156 156
 		} else {
157 157
 			$errors = $result->getViolations();
158
-			return $app->json( [ 'status' => 'ERR', 'message' => implode( "\n", $errors ) ] );
158
+			return $app->json(['status' => 'ERR', 'message' => implode("\n", $errors)]);
159 159
 		}
160 160
 	}
161 161
 );
162 162
 
163 163
 $app->get(
164 164
 	'list-comments.json',
165
-	function( Request $request ) use ( $app, $ffFactory ) {
165
+	function(Request $request) use ($app, $ffFactory) {
166 166
 		$response = $app->json(
167 167
 			$ffFactory->newCommentListJsonPresenter()->present(
168 168
 				$ffFactory->newListCommentsUseCase()->listComments(
169 169
 					new CommentListingRequest(
170
-						(int)$request->query->get( 'n', '10' ),
171
-						(int)$request->query->get( 'page', '1' )
170
+						(int)$request->query->get('n', '10'),
171
+						(int)$request->query->get('page', '1')
172 172
 					)
173 173
 				)
174 174
 			)
175 175
 		);
176 176
 
177
-		if ( $request->query->get( 'f' ) ) {
178
-			$response->setCallback( $request->query->get( 'f' ) );
177
+		if ($request->query->get('f')) {
178
+			$response->setCallback($request->query->get('f'));
179 179
 		}
180 180
 
181 181
 		return $response;
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 
185 185
 $app->get(
186 186
 	'list-comments.rss',
187
-	function() use ( $app, $ffFactory ) {
187
+	function() use ($app, $ffFactory) {
188 188
 		$rss = $ffFactory->newCommentListRssPresenter()->present(
189 189
 			$ffFactory->newListCommentsUseCase()->listComments(
190
-				new CommentListingRequest( 100, CommentListingRequest::FIRST_PAGE )
190
+				new CommentListingRequest(100, CommentListingRequest::FIRST_PAGE)
191 191
 			)
192 192
 		);
193 193
 
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
 
205 205
 $app->get(
206 206
 	'list-comments.html',
207
-	function( Request $request ) use ( $app, $ffFactory ) {
207
+	function(Request $request) use ($app, $ffFactory) {
208 208
 		return new Response(
209 209
 			$ffFactory->newCommentListHtmlPresenter()->present(
210 210
 				$ffFactory->newListCommentsUseCase()->listComments(
211 211
 					new CommentListingRequest(
212 212
 						10,
213
-						(int)$request->query->get( 'page', '1' )
213
+						(int)$request->query->get('page', '1')
214 214
 					)
215 215
 				),
216
-				(int)$request->query->get( 'page', '1' )
216
+				(int)$request->query->get('page', '1')
217 217
 			)
218 218
 		);
219 219
 	}
@@ -221,150 +221,150 @@  discard block
 block discarded – undo
221 221
 
222 222
 $app->get(
223 223
 	'page/{pageName}',
224
-	function( Application $app, $pageName ) use ( $ffFactory ) {
225
-		$templateExists = $ffFactory->getTemplateNameValidator()->validate( $pageName )->isSuccessful();
224
+	function(Application $app, $pageName) use ($ffFactory) {
225
+		$templateExists = $ffFactory->getTemplateNameValidator()->validate($pageName)->isSuccessful();
226 226
 
227
-		return $ffFactory->getLayoutTemplate( 'DisplayPageLayout.twig' )->render( [
227
+		return $ffFactory->getLayoutTemplate('DisplayPageLayout.twig')->render([
228 228
 			'main_template' => $templateExists ? $pageName : '404message.html.twig',
229
-		] );
229
+		]);
230 230
 	}
231 231
 )
232
-->bind( 'page' );
232
+->bind('page');
233 233
 
234 234
 // Form for this is provided by route page/Subscription_Form
235 235
 $app->post(
236 236
 	'contact/subscribe',
237
-	function( Application $app, Request $request ) use ( $ffFactory ) {
237
+	function(Application $app, Request $request) use ($ffFactory) {
238 238
 		$useCase = $ffFactory->newAddSubscriptionUseCase();
239 239
 
240 240
 		$subscriptionRequest = new SubscriptionRequest();
241
-		$subscriptionRequest->setAddress( $request->get( 'address', '' ) );
242
-		$subscriptionRequest->setCity( $request->get( 'city', '' ) );
243
-		$subscriptionRequest->setPostcode( $request->get( 'postcode', '' ) );
241
+		$subscriptionRequest->setAddress($request->get('address', ''));
242
+		$subscriptionRequest->setCity($request->get('city', ''));
243
+		$subscriptionRequest->setPostcode($request->get('postcode', ''));
244 244
 
245
-		$subscriptionRequest->setFirstName( $request->get( 'firstName', '' ) );
246
-		$subscriptionRequest->setLastName( $request->get( 'lastName', '' ) );
247
-		$subscriptionRequest->setSalutation( $request->get( 'salutation', '' ) );
248
-		$subscriptionRequest->setTitle( $request->get( 'title', '' ) );
245
+		$subscriptionRequest->setFirstName($request->get('firstName', ''));
246
+		$subscriptionRequest->setLastName($request->get('lastName', ''));
247
+		$subscriptionRequest->setSalutation($request->get('salutation', ''));
248
+		$subscriptionRequest->setTitle($request->get('title', ''));
249 249
 
250
-		$subscriptionRequest->setEmail( $request->get( 'email', '' ) );
250
+		$subscriptionRequest->setEmail($request->get('email', ''));
251 251
 
252
-		$subscriptionRequest->setWikiloginFromValues( [
253
-			$request->request->get( 'wikilogin' ),
254
-			$request->cookies->get( 'spenden_wikilogin' ),
255
-		] );
252
+		$subscriptionRequest->setWikiloginFromValues([
253
+			$request->request->get('wikilogin'),
254
+			$request->cookies->get('spenden_wikilogin'),
255
+		]);
256 256
 
257
-		$responseModel = $useCase->addSubscription( $subscriptionRequest );
258
-		if ( $app['request.is_json'] ) {
259
-			return $app->json( $ffFactory->newAddSubscriptionJSONPresenter()->present( $responseModel ) );
257
+		$responseModel = $useCase->addSubscription($subscriptionRequest);
258
+		if ($app['request.is_json']) {
259
+			return $app->json($ffFactory->newAddSubscriptionJSONPresenter()->present($responseModel));
260 260
 		}
261
-		if ( $responseModel->isSuccessful() ) {
262
-			if ( $responseModel->needsModeration() ) {
263
-				return $app->redirect( $app['url_generator']->generate('page', [ 'pageName' => 'Subscription_Moderation' ] ) );
261
+		if ($responseModel->isSuccessful()) {
262
+			if ($responseModel->needsModeration()) {
263
+				return $app->redirect($app['url_generator']->generate('page', ['pageName' => 'Subscription_Moderation']));
264 264
 			}
265
-			return $app->redirect( $app['url_generator']->generate('page', [ 'pageName' => 'Subscription_Success' ] ) );
265
+			return $app->redirect($app['url_generator']->generate('page', ['pageName' => 'Subscription_Success']));
266 266
 		}
267
-		return $ffFactory->newAddSubscriptionHTMLPresenter()->present( $responseModel, $request->request->all() );
267
+		return $ffFactory->newAddSubscriptionHTMLPresenter()->present($responseModel, $request->request->all());
268 268
 	}
269 269
 )
270
-->bind( 'subscribe' );
270
+->bind('subscribe');
271 271
 
272
-$app->get( 'contact/confirm-subscription/{confirmationCode}', function ( $confirmationCode ) use ( $ffFactory ) {
272
+$app->get('contact/confirm-subscription/{confirmationCode}', function($confirmationCode) use ($ffFactory) {
273 273
 	$useCase = $ffFactory->newConfirmSubscriptionUseCase();
274
-	$response = $useCase->confirmSubscription( $confirmationCode );
275
-	return $ffFactory->newConfirmSubscriptionHtmlPresenter()->present( $response );
274
+	$response = $useCase->confirmSubscription($confirmationCode);
275
+	return $ffFactory->newConfirmSubscriptionHtmlPresenter()->present($response);
276 276
 } )
277
-->assert( 'confirmationCode', '^[0-9a-f]+$' );
277
+->assert('confirmationCode', '^[0-9a-f]+$');
278 278
 
279 279
 $app->get(
280 280
 	'check-iban',
281
-	function( Request $request ) use ( $app, $ffFactory ) {
281
+	function(Request $request) use ($app, $ffFactory) {
282 282
 		$useCase = $ffFactory->newCheckIbanUseCase();
283
-		$checkIbanResponse = $useCase->checkIban( new Iban( $request->query->get( 'iban', '' ) ) );
284
-		return $app->json( $ffFactory->newIbanPresenter()->present( $checkIbanResponse ) );
283
+		$checkIbanResponse = $useCase->checkIban(new Iban($request->query->get('iban', '')));
284
+		return $app->json($ffFactory->newIbanPresenter()->present($checkIbanResponse));
285 285
 	}
286 286
 );
287 287
 
288 288
 $app->get(
289 289
 	'generate-iban',
290
-	function( Request $request ) use ( $app, $ffFactory ) {
290
+	function(Request $request) use ($app, $ffFactory) {
291 291
 		$generateIbanRequest = new GenerateIbanRequest(
292
-			$request->query->get( 'accountNumber', '' ),
293
-			$request->query->get( 'bankCode', '' )
292
+			$request->query->get('accountNumber', ''),
293
+			$request->query->get('bankCode', '')
294 294
 		);
295 295
 
296
-		$generateIbanResponse = $ffFactory->newGenerateIbanUseCase()->generateIban( $generateIbanRequest );
297
-		return $app->json( $ffFactory->newIbanPresenter()->present( $generateIbanResponse ) );
296
+		$generateIbanResponse = $ffFactory->newGenerateIbanUseCase()->generateIban($generateIbanRequest);
297
+		return $app->json($ffFactory->newIbanPresenter()->present($generateIbanResponse));
298 298
 	}
299 299
 );
300 300
 
301 301
 $app->post(
302 302
 	'add-comment',
303
-	function( Request $request ) use ( $app, $ffFactory ) {
303
+	function(Request $request) use ($app, $ffFactory) {
304 304
 		$addCommentRequest = new AddCommentRequest();
305
-		$addCommentRequest->setCommentText( trim( $request->request->get( 'kommentar', '' ) ) );
306
-		$addCommentRequest->setIsPublic( $request->request->get( 'public', '0' ) === '1' );
307
-		$addCommentRequest->setAuthorDisplayName( trim( $request->request->get( 'eintrag', '' ) ) );
308
-		$addCommentRequest->setDonationId( (int)$request->request->get( 'sid', '' ) );
305
+		$addCommentRequest->setCommentText(trim($request->request->get('kommentar', '')));
306
+		$addCommentRequest->setIsPublic($request->request->get('public', '0') === '1');
307
+		$addCommentRequest->setAuthorDisplayName(trim($request->request->get('eintrag', '')));
308
+		$addCommentRequest->setDonationId((int)$request->request->get('sid', ''));
309 309
 		$addCommentRequest->freeze()->assertNoNullFields();
310 310
 
311
-		$updateToken = $request->request->get( 'utoken', '' );
311
+		$updateToken = $request->request->get('utoken', '');
312 312
 
313
-		if ( $updateToken === '' ) {
314
-			return $app->json( [
313
+		if ($updateToken === '') {
314
+			return $app->json([
315 315
 				'status' => 'ERR',
316
-				'message' => $ffFactory->getTranslator()->trans( 'comment_failure_access_denied' ),
317
-			] );
316
+				'message' => $ffFactory->getTranslator()->trans('comment_failure_access_denied'),
317
+			]);
318 318
 		}
319 319
 
320
-		$response = $ffFactory->newAddCommentUseCase( $updateToken )->addComment( $addCommentRequest );
320
+		$response = $ffFactory->newAddCommentUseCase($updateToken)->addComment($addCommentRequest);
321 321
 
322
-		if ( $response->isSuccessful() ) {
323
-			return $app->json( [
322
+		if ($response->isSuccessful()) {
323
+			return $app->json([
324 324
 				'status' => 'OK',
325
-				'message' => $ffFactory->getTranslator()->trans( $response->getSuccessMessage() ),
326
-			] );
325
+				'message' => $ffFactory->getTranslator()->trans($response->getSuccessMessage()),
326
+			]);
327 327
 		}
328 328
 
329
-		return $app->json( [
329
+		return $app->json([
330 330
 			'status' => 'ERR',
331
-			'message' => $ffFactory->getTranslator()->trans( $response->getErrorMessage() ),
332
-		] );
331
+			'message' => $ffFactory->getTranslator()->trans($response->getErrorMessage()),
332
+		]);
333 333
 	}
334 334
 );
335 335
 
336 336
 $app->post(
337 337
 	'contact/get-in-touch',
338
-	function( Request $request ) use ( $app, $ffFactory ) {
338
+	function(Request $request) use ($app, $ffFactory) {
339 339
 		$contactFormRequest = new GetInTouchRequest(
340
-			$request->get( 'firstname', '' ),
341
-			$request->get( 'lastname', '' ),
342
-			$request->get( 'email', '' ),
343
-			$request->get( 'subject', '' ),
344
-			$request->get( 'messageBody', '' )
340
+			$request->get('firstname', ''),
341
+			$request->get('lastname', ''),
342
+			$request->get('email', ''),
343
+			$request->get('subject', ''),
344
+			$request->get('messageBody', '')
345 345
 		);
346 346
 
347
-		$contactFormResponse = $ffFactory->newGetInTouchUseCase()->processContactRequest( $contactFormRequest );
348
-		if ( $contactFormResponse->isSuccessful() ) {
349
-			return $app->redirect( $app['url_generator']->generate( 'page', [ 'pageName' => 'KontaktBestaetigung' ] ) );
347
+		$contactFormResponse = $ffFactory->newGetInTouchUseCase()->processContactRequest($contactFormRequest);
348
+		if ($contactFormResponse->isSuccessful()) {
349
+			return $app->redirect($app['url_generator']->generate('page', ['pageName' => 'KontaktBestaetigung']));
350 350
 		}
351
-		return $ffFactory->newGetInTouchHTMLPresenter()->present( $contactFormResponse, $request->request->all() );
351
+		return $ffFactory->newGetInTouchHTMLPresenter()->present($contactFormResponse, $request->request->all());
352 352
 	}
353 353
 );
354 354
 
355 355
 $app->post(
356 356
 	'donation/cancel',
357
-	function( Request $request ) use ( $app, $ffFactory ) {
357
+	function(Request $request) use ($app, $ffFactory) {
358 358
 		$cancellationRequest = new CancelDonationRequest(
359
-			(int)$request->request->get( 'sid', '' )
359
+			(int)$request->request->get('sid', '')
360 360
 		);
361 361
 
362
-		$responseModel = $ffFactory->newCancelDonationUseCase( $request->request->get( 'utoken', '' ) )
363
-			->cancelDonation( $cancellationRequest );
362
+		$responseModel = $ffFactory->newCancelDonationUseCase($request->request->get('utoken', ''))
363
+			->cancelDonation($cancellationRequest);
364 364
 
365
-		$httpResponse = new Response( $ffFactory->newCancelDonationHtmlPresenter()->present( $responseModel ) );
366
-		if ( $responseModel->cancellationSucceeded() ) {
367
-			$httpResponse->headers->clearCookie( 'donation_timestamp' );
365
+		$httpResponse = new Response($ffFactory->newCancelDonationHtmlPresenter()->present($responseModel));
366
+		if ($responseModel->cancellationSucceeded()) {
367
+			$httpResponse->headers->clearCookie('donation_timestamp');
368 368
 		}
369 369
 
370 370
 		return $httpResponse;
@@ -374,112 +374,112 @@  discard block
 block discarded – undo
374 374
 
375 375
 $app->post(
376 376
 	'donation/add',
377
-	function( Application $app, Request $request ) use ( $ffFactory ) {
378
-		return ( new AddDonationHandler( $ffFactory, $app ) )
379
-			->handle( $request, $app['session']->get( 'piwikTracking', [] ) );
377
+	function(Application $app, Request $request) use ($ffFactory) {
378
+		return (new AddDonationHandler($ffFactory, $app))
379
+			->handle($request, $app['session']->get('piwikTracking', []));
380 380
 	}
381 381
 );
382 382
 
383 383
 // Show a donation form with pre-filled payment values, e.g. when coming from a banner
384
-$app->get( 'donation/new', function ( Application $app, Request $request ) use ( $ffFactory ) {
385
-	$amount = Euro::newFromFloat( ( new AmountParser( 'de_DE' ) )->parseAsFloat( $request->get( 'betrag', '' ) ) );
384
+$app->get('donation/new', function(Application $app, Request $request) use ($ffFactory) {
385
+	$amount = Euro::newFromFloat((new AmountParser('de_DE'))->parseAsFloat($request->get('betrag', '')));
386 386
 
387
-	return new Response( $ffFactory->newDonationFormPresenter()->present(
387
+	return new Response($ffFactory->newDonationFormPresenter()->present(
388 388
 		$amount,
389
-		$request->get( 'zahlweise', '' ),
390
-		intval( $request->get( 'periode', 0 ) )
391
-	) );
389
+		$request->get('zahlweise', ''),
390
+		intval($request->get('periode', 0))
391
+	));
392 392
 } );
393 393
 
394 394
 $app->post(
395 395
 	'apply-for-membership',
396
-	function( Application $app, Request $httpRequest ) use ( $ffFactory ) {
397
-		return ( new ApplyForMembershipHandler( $ffFactory, $app ) )->handle( $httpRequest );
396
+	function(Application $app, Request $httpRequest) use ($ffFactory) {
397
+		return (new ApplyForMembershipHandler($ffFactory, $app))->handle($httpRequest);
398 398
 	}
399 399
 );
400 400
 
401 401
 $app->get(
402 402
 	'show-membership-confirmation',
403
-	function( Application $app, Request $request ) use ( $ffFactory ) {
404
-		$confirmationRequest = new ShowMembershipAppConfirmationRequest( (int)$request->query->get( 'id', 0 ) );
403
+	function(Application $app, Request $request) use ($ffFactory) {
404
+		$confirmationRequest = new ShowMembershipAppConfirmationRequest((int)$request->query->get('id', 0));
405 405
 
406 406
 		return $ffFactory->newMembershipApplicationConfirmationHtmlPresenter()->present(
407
-			$ffFactory->newMembershipApplicationConfirmationUseCase( $request->query->get( 'token', '' ) )
408
-				->showConfirmation( $confirmationRequest )
407
+			$ffFactory->newMembershipApplicationConfirmationUseCase($request->query->get('token', ''))
408
+				->showConfirmation($confirmationRequest)
409 409
 		);
410 410
 	}
411
-)->bind( 'show-membership-confirmation' );
411
+)->bind('show-membership-confirmation');
412 412
 
413 413
 $app->get(
414 414
 	'cancel-membership-application',
415
-	function( Application $app, Request $request ) use ( $ffFactory ) {
415
+	function(Application $app, Request $request) use ($ffFactory) {
416 416
 		$cancellationRequest = new CancellationRequest(
417
-			(int)$request->query->get( 'id', '' )
417
+			(int)$request->query->get('id', '')
418 418
 		);
419 419
 
420 420
 		return $ffFactory->newCancelMembershipApplicationHtmlPresenter()->present(
421
-			$ffFactory->newCancelMembershipApplicationUseCase( $request->query->get( 'updateToken', '' ) )
422
-				->cancelApplication( $cancellationRequest )
421
+			$ffFactory->newCancelMembershipApplicationUseCase($request->query->get('updateToken', ''))
422
+				->cancelApplication($cancellationRequest)
423 423
 		);
424 424
 	}
425 425
 );
426 426
 
427 427
 $app->match(
428 428
 	'show-donation-confirmation',
429
-	function( Application $app, Request $request ) use ( $ffFactory ) {
430
-		return ( new ShowDonationConfirmationHandler( $ffFactory ) )->handle(
429
+	function(Application $app, Request $request) use ($ffFactory) {
430
+		return (new ShowDonationConfirmationHandler($ffFactory))->handle(
431 431
 			$request,
432
-			$app['session']->get( 'piwikTracking', [] )
432
+			$app['session']->get('piwikTracking', [])
433 433
 		);
434 434
 	}
435
-)->bind( 'show-donation-confirmation' )->method( 'GET|POST' );
435
+)->bind('show-donation-confirmation')->method('GET|POST');
436 436
 
437 437
 $app->post(
438 438
 	'handle-paypal-payment-notification',
439
-	function ( Application $app, Request $request ) use ( $ffFactory ) {
440
-		return ( new PayPalNotificationHandler( $ffFactory ) )->handle( $request );
439
+	function(Application $app, Request $request) use ($ffFactory) {
440
+		return (new PayPalNotificationHandler($ffFactory))->handle($request);
441 441
 	}
442 442
 );
443 443
 
444 444
 $app->get(
445 445
 	'handle-creditcard-payment-notification',
446
-	function ( Application $app, Request $request ) use ( $ffFactory ) {
446
+	function(Application $app, Request $request) use ($ffFactory) {
447 447
 		try {
448
-			$ffFactory->newCreditCardNotificationUseCase( $request->query->get( 'utoken', '' ) )
448
+			$ffFactory->newCreditCardNotificationUseCase($request->query->get('utoken', ''))
449 449
 				->handleNotification(
450
-					( new CreditCardPaymentNotificationRequest() )
451
-						->setTransactionId( $request->query->get( 'transactionId', '' ) )
452
-						->setDonationId( (int)$request->query->get( 'donation_id', '' ) )
453
-						->setAmount( Euro::newFromCents( (int)$request->query->get( 'amount' ) ) )
454
-						->setCustomerId( $request->query->get( 'customerId', '' ) )
455
-						->setSessionId( $request->query->get( 'sessionId', '' ) )
456
-						->setAuthId( $request->query->get(  'auth', '' ) )
457
-						->setTitle( $request->query->get( 'title', '' ) )
458
-						->setCountry( $request->query->get( 'country', '' ) )
459
-						->setCurrency( $request->query->get( 'currency', '' ) )
450
+					(new CreditCardPaymentNotificationRequest())
451
+						->setTransactionId($request->query->get('transactionId', ''))
452
+						->setDonationId((int)$request->query->get('donation_id', ''))
453
+						->setAmount(Euro::newFromCents((int)$request->query->get('amount')))
454
+						->setCustomerId($request->query->get('customerId', ''))
455
+						->setSessionId($request->query->get('sessionId', ''))
456
+						->setAuthId($request->query->get('auth', ''))
457
+						->setTitle($request->query->get('title', ''))
458
+						->setCountry($request->query->get('country', ''))
459
+						->setCurrency($request->query->get('currency', ''))
460 460
 				);
461 461
 
462 462
 			$response = CreditCardNotificationResponse::newSuccessResponse(
463
-				(int)$request->query->get( 'donation_id', '' ),
464
-				$request->query->get( 'token', '' )
463
+				(int)$request->query->get('donation_id', ''),
464
+				$request->query->get('token', '')
465 465
  			);
466
-		} catch ( CreditCardPaymentHandlerException $e ) {
467
-			$response = CreditCardNotificationResponse::newFailureResponse( $e->getMessage() );
466
+		} catch (CreditCardPaymentHandlerException $e) {
467
+			$response = CreditCardNotificationResponse::newFailureResponse($e->getMessage());
468 468
 		}
469 469
 
470
-		return new Response( $ffFactory->newCreditCardNotificationPresenter()->present( $response ) );
470
+		return new Response($ffFactory->newCreditCardNotificationPresenter()->present($response));
471 471
 	}
472 472
 );
473 473
 
474
-$app->get( '/', function ( Application $app, Request $request ) {
475
-	$app['session']->set( 'piwikTracking', array_filter(
474
+$app->get('/', function(Application $app, Request $request) {
475
+	$app['session']->set('piwikTracking', array_filter(
476 476
 			[
477
-				'paymentType' => $request->get( 'zahlweise', '' ),
478
-				'paymentAmount' => $request->get( 'betrag', '' ),
479
-				'paymentInterval' => $request->get( 'periode', '' )
477
+				'paymentType' => $request->get('zahlweise', ''),
478
+				'paymentAmount' => $request->get('betrag', ''),
479
+				'paymentInterval' => $request->get('periode', '')
480 480
 			],
481
-			function ( string $value ) {
482
-				return $value !== '' && strlen( $value ) < 20;
481
+			function(string $value) {
482
+				return $value !== '' && strlen($value) < 20;
483 483
 			} )
484 484
 	);
485 485
 
@@ -497,25 +497,25 @@  discard block
 block discarded – undo
497 497
 } );
498 498
 
499 499
 // redirect display page requests from old URLs
500
-$app->get( '/spenden/{page}', function( Application $app, Request $request, string $page ) {
501
-	return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle( '/page/' . $page );
502
-} )->assert( 'page', '[a-zA-Z_\-\s\x7f-\xff]+' );
500
+$app->get('/spenden/{page}', function(Application $app, Request $request, string $page) {
501
+	return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle('/page/' . $page);
502
+} )->assert('page', '[a-zA-Z_\-\s\x7f-\xff]+');
503 503
 
504 504
 // redirect different formats of comment lists
505
-$app->get( '/spenden/{outputFormat}.php', function( Application $app, Request $request, string $outputFormat ) {
506
-	return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle(
507
-		'/list-comments.' . ( $outputFormat === 'list' ? 'html' : $outputFormat )
505
+$app->get('/spenden/{outputFormat}.php', function(Application $app, Request $request, string $outputFormat) {
506
+	return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle(
507
+		'/list-comments.' . ($outputFormat === 'list' ? 'html' : $outputFormat)
508 508
 	);
509
-} )->assert( 'outputFormat', 'list|rss|json' );
509
+} )->assert('outputFormat', 'list|rss|json');
510 510
 
511 511
 // redirect all other calls to default route
512
-$app->get( '/spenden{page}', function( Application $app, Request $request ) {
513
-	return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle( '/' );
514
-} )->assert( 'page', '/?([a-z]+\.php)?' );
512
+$app->get('/spenden{page}', function(Application $app, Request $request) {
513
+	return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle('/');
514
+} )->assert('page', '/?([a-z]+\.php)?');
515 515
 
516
-$app->get( '/purge-cache', function( Application $app, Request $request ) use ( $ffFactory ) {
517
-	if ( $request->query->get( 'secret', '' ) !== $ffFactory->getCachePurgingSecret() ) {
518
-		return new Response( 'ACCESS DENIED' );
516
+$app->get('/purge-cache', function(Application $app, Request $request) use ($ffFactory) {
517
+	if ($request->query->get('secret', '') !== $ffFactory->getCachePurgingSecret()) {
518
+		return new Response('ACCESS DENIED');
519 519
 	}
520 520
 
521 521
 	$purger = $ffFactory->newCachePurger();
@@ -523,11 +523,11 @@  discard block
 block discarded – undo
523 523
 	try {
524 524
 		$purger->purgeCache();
525 525
 	}
526
-	catch ( CachePurgingException $ex ) {
527
-		return new Response( 'ERROR' );
526
+	catch (CachePurgingException $ex) {
527
+		return new Response('ERROR');
528 528
 	}
529 529
 
530
-	return new Response( 'SUCCESS' );
530
+	return new Response('SUCCESS');
531 531
 } );
532 532
 
533 533
 return $app;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -522,8 +522,7 @@
 block discarded – undo
522 522
 
523 523
 	try {
524 524
 		$purger->purgeCache();
525
-	}
526
-	catch ( CachePurgingException $ex ) {
525
+	} catch ( CachePurgingException $ex ) {
527 526
 		return new Response( 'ERROR' );
528 527
 	}
529 528
 
Please login to merge, or discard this patch.