Completed
Pull Request — master (#1096)
by Jeroen De
93:43 queued 28:43
created
src/Presentation/Presenters/DonationConfirmationHtmlPresenter.php 1 patch
Spacing   +28 added lines, -28 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\Presentation\Presenters;
6 6
 
@@ -25,41 +25,41 @@  discard block
 block discarded – undo
25 25
 	private $template;
26 26
 	private $urlGenerator;
27 27
 
28
-	public function __construct( TwigTemplate $template, UrlGenerator $urlGenerator ) {
28
+	public function __construct(TwigTemplate $template, UrlGenerator $urlGenerator) {
29 29
 		$this->template = $template;
30 30
 		$this->urlGenerator = $urlGenerator;
31 31
 	}
32 32
 
33
-	public function present( Donation $donation, string $updateToken, string $accessToken,
34
-							 SelectedConfirmationPage $selectedPage, PiwikEvents $piwikEvents ): string {
33
+	public function present(Donation $donation, string $updateToken, string $accessToken,
34
+							 SelectedConfirmationPage $selectedPage, PiwikEvents $piwikEvents): string {
35 35
 		return $this->template->render(
36
-			$this->getConfirmationPageArguments( $donation, $updateToken, $accessToken, $selectedPage, $piwikEvents )
36
+			$this->getConfirmationPageArguments($donation, $updateToken, $accessToken, $selectedPage, $piwikEvents)
37 37
 		);
38 38
 	}
39 39
 
40
-	private function getConfirmationPageArguments( Donation $donation, string $updateToken, string $accessToken,
41
-												   SelectedConfirmationPage $selectedPage, PiwikEvents $piwikEvents ): array {
40
+	private function getConfirmationPageArguments(Donation $donation, string $updateToken, string $accessToken,
41
+												   SelectedConfirmationPage $selectedPage, PiwikEvents $piwikEvents): array {
42 42
 
43 43
 		return [
44 44
 			'template_name' => $selectedPage->getPageTitle(),
45 45
 			'templateCampaign' => $selectedPage->getCampaignCode(),
46 46
 			'donation' => [
47 47
 				'id' => $donation->getId(),
48
-				'status' => $this->mapStatus( $donation->getStatus() ),
48
+				'status' => $this->mapStatus($donation->getStatus()),
49 49
 				'amount' => $donation->getAmount()->getEuroFloat(),
50 50
 				'interval' => $donation->getPaymentIntervalInMonths(),
51 51
 				'paymentType' => $donation->getPaymentType(),
52 52
 				'optsIntoNewsletter' => $donation->getOptsIntoNewsletter(),
53
-				'bankTransferCode' => $this->getBankTransferCode( $donation->getPaymentMethod() ),
53
+				'bankTransferCode' => $this->getBankTransferCode($donation->getPaymentMethod()),
54 54
 				// TODO: use locale to determine the date format
55
-				'creationDate' => ( new \DateTime() )->format( 'd.m.Y' ),
55
+				'creationDate' => (new \DateTime())->format('d.m.Y'),
56 56
 				// TODO: set cookie duration for "hide banner cookie"
57 57
 				'cookieDuration' => '15552000', // 180 days
58 58
 				'updateToken' => $updateToken
59 59
 			],
60
-			'person' => $this->getPersonArguments( $donation ),
61
-			'bankData' => $this->getBankDataArguments( $donation->getPaymentMethod() ),
62
-			'initialFormValues' => $this->getInitialMembershipFormValues( $donation ),
60
+			'person' => $this->getPersonArguments($donation),
61
+			'bankData' => $this->getBankDataArguments($donation->getPaymentMethod()),
62
+			'initialFormValues' => $this->getInitialMembershipFormValues($donation),
63 63
 			'piwikEvents' => $piwikEvents->getEvents(),
64 64
 			'commentUrl' => $this->urlGenerator->generateUrl(
65 65
 				'AddCommentPage',
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 		];
73 73
 	}
74 74
 
75
-	private function getPersonArguments( Donation $donation ): array {
76
-		if ( $donation->getDonor() !== null ) {
75
+	private function getPersonArguments(Donation $donation): array {
76
+		if ($donation->getDonor() !== null) {
77 77
 			return [
78 78
 				'salutation' => $donation->getDonor()->getName()->getSalutation(),
79 79
 				'fullName' => $donation->getDonor()->getName()->getFullName(),
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
 		return [];
90 90
 	}
91 91
 
92
-	private function getBankTransferCode( PaymentMethod $paymentMethod ): string {
93
-		if ( $paymentMethod instanceof BankTransferPayment ) {
92
+	private function getBankTransferCode(PaymentMethod $paymentMethod): string {
93
+		if ($paymentMethod instanceof BankTransferPayment) {
94 94
 			return $paymentMethod->getBankTransferCode();
95 95
 		}
96 96
 
97 97
 		return '';
98 98
 	}
99 99
 
100
-	private function getBankDataArguments( PaymentMethod $paymentMethod ): array {
101
-		if ( $paymentMethod instanceof DirectDebitPayment ) {
100
+	private function getBankDataArguments(PaymentMethod $paymentMethod): array {
101
+		if ($paymentMethod instanceof DirectDebitPayment) {
102 102
 			return [
103 103
 				'iban' => $paymentMethod->getBankData()->getIban()->toString(),
104 104
 				'bic' => $paymentMethod->getBankData()->getBic(),
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 		return [];
110 110
 	}
111 111
 
112
-	private function getInitialMembershipFormValues( Donation $donation ): array {
112
+	private function getInitialMembershipFormValues(Donation $donation): array {
113 113
 		return array_merge(
114
-			$this->getMembershipFormPersonValues( $donation->getDonor() ),
115
-			$this->getMembershipFormBankDataValues( $donation->getPaymentMethod() )
114
+			$this->getMembershipFormPersonValues($donation->getDonor()),
115
+			$this->getMembershipFormBankDataValues($donation->getPaymentMethod())
116 116
 		);
117 117
 	}
118 118
 
119
-	private function getMembershipFormPersonValues( Donor $donor = null ): array {
120
-		if ( $donor === null ) {
119
+	private function getMembershipFormPersonValues(Donor $donor = null): array {
120
+		if ($donor === null) {
121 121
 			return [];
122 122
 		}
123 123
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 		];
137 137
 	}
138 138
 
139
-	private function getMembershipFormBankDataValues( PaymentMethod $paymentMethod ): array {
140
-		if ( !$paymentMethod instanceof DirectDebitPayment ) {
139
+	private function getMembershipFormBankDataValues(PaymentMethod $paymentMethod): array {
140
+		if (!$paymentMethod instanceof DirectDebitPayment) {
141 141
 			return [];
142 142
 		}
143 143
 
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 	 * @param string $status
157 157
 	 * @return string
158 158
 	 */
159
-	private function mapStatus( string $status ): string {
160
-		switch ( $status ) {
159
+	private function mapStatus(string $status): string {
160
+		switch ($status) {
161 161
 			case Donation::STATUS_MODERATION:
162 162
 				return 'status-pending';
163 163
 			case Donation::STATUS_NEW:
Please login to merge, or discard this patch.
src/Factories/FunFunFactory.php 1 patch
Spacing   +206 added lines, -206 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
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	private $profiler = null;
192 192
 
193
-	public function __construct( array $config ) {
193
+	public function __construct(array $config) {
194 194
 		$this->config = $config;
195 195
 		$this->pimple = $this->newPimple();
196 196
 	}
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 		};
216 216
 
217 217
 		$pimple['dbal_connection'] = function() {
218
-			return DriverManager::getConnection( $this->config['db'] );
218
+			return DriverManager::getConnection($this->config['db']);
219 219
 		};
220 220
 
221 221
 		$pimple['entity_manager'] = function() {
222
-			$entityManager = ( new StoreFactory( $this->getConnection(), $this->getVarPath() . '/doctrine_proxies' ) )
222
+			$entityManager = (new StoreFactory($this->getConnection(), $this->getVarPath() . '/doctrine_proxies'))
223 223
 				->getEntityManager();
224
-			if ( $this->addDoctrineSubscribers ) {
225
-				$entityManager->getEventManager()->addEventSubscriber( $this->newDoctrineDonationPrePersistSubscriber() );
226
-				$entityManager->getEventManager()->addEventSubscriber( $this->newDoctrineMembershipApplicationPrePersistSubscriber() );
224
+			if ($this->addDoctrineSubscribers) {
225
+				$entityManager->getEventManager()->addEventSubscriber($this->newDoctrineDonationPrePersistSubscriber());
226
+				$entityManager->getEventManager()->addEventSubscriber($this->newDoctrineMembershipApplicationPrePersistSubscriber());
227 227
 			}
228 228
 
229 229
 			return $entityManager;
@@ -231,53 +231,53 @@  discard block
 block discarded – undo
231 231
 
232 232
 		$pimple['subscription_repository'] = function() {
233 233
 			return new LoggingSubscriptionRepository(
234
-				new DoctrineSubscriptionRepository( $this->getEntityManager() ),
234
+				new DoctrineSubscriptionRepository($this->getEntityManager()),
235 235
 				$this->getLogger()
236 236
 			);
237 237
 		};
238 238
 
239 239
 		$pimple['donation_repository'] = function() {
240 240
 			return new LoggingDonationRepository(
241
-				new DoctrineDonationRepository( $this->getEntityManager() ),
241
+				new DoctrineDonationRepository($this->getEntityManager()),
242 242
 				$this->getLogger()
243 243
 			);
244 244
 		};
245 245
 
246 246
 		$pimple['membership_application_repository'] = function() {
247 247
 			return new LoggingApplicationRepository(
248
-				new DoctrineApplicationRepository( $this->getEntityManager() ),
248
+				new DoctrineApplicationRepository($this->getEntityManager()),
249 249
 				$this->getLogger()
250 250
 			);
251 251
 		};
252 252
 
253 253
 		$pimple['comment_repository'] = function() {
254 254
 			$finder = new LoggingCommentFinder(
255
-				new DoctrineCommentFinder( $this->getEntityManager() ),
255
+				new DoctrineCommentFinder($this->getEntityManager()),
256 256
 				$this->getLogger()
257 257
 			);
258 258
 
259
-			return $this->addProfilingDecorator( $finder, 'CommentFinder' );
259
+			return $this->addProfilingDecorator($finder, 'CommentFinder');
260 260
 		};
261 261
 
262 262
 		$pimple['mail_validator'] = function() {
263
-			return new EmailValidator( new InternetDomainNameValidator() );
263
+			return new EmailValidator(new InternetDomainNameValidator());
264 264
 		};
265 265
 
266 266
 		$pimple['subscription_validator'] = function() {
267 267
 			return new SubscriptionValidator(
268 268
 				$this->getEmailValidator(),
269
-				$this->newTextPolicyValidator( 'fields' ),
269
+				$this->newTextPolicyValidator('fields'),
270 270
 				$this->newSubscriptionDuplicateValidator(),
271 271
 				$this->newHonorificValidator()
272 272
 			);
273 273
 		};
274 274
 
275 275
 		$pimple['template_name_validator'] = function() {
276
-			return new TemplateNameValidator( $this->getSkinTwig() );
276
+			return new TemplateNameValidator($this->getSkinTwig());
277 277
 		};
278 278
 
279 279
 		$pimple['contact_validator'] = function() {
280
-			return new GetInTouchValidator( $this->getEmailValidator() );
280
+			return new GetInTouchValidator($this->getEmailValidator());
281 281
 		};
282 282
 
283 283
 		$pimple['greeting_generator'] = function() {
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 			];
292 292
 			$locale = $this->config['locale'];
293 293
 			$messagesPath = $this->getI18nDirectory() . $this->config['translation']['message-dir'];
294
-			$translator = $translationFactory->create( $loaders, $locale );
294
+			$translator = $translationFactory->create($loaders, $locale);
295 295
 			foreach ($this->config['translation']['files'] as $domain => $file) {
296
-				$translator->addResource( 'json', $messagesPath . '/' . $file, $locale, $domain );
296
+				$translator->addResource('json', $messagesPath . '/' . $file, $locale, $domain);
297 297
 			}
298 298
 
299 299
 			return $translator;
@@ -301,27 +301,27 @@  discard block
 block discarded – undo
301 301
 
302 302
 		// In the future, this could be locale-specific or filled from a DB table
303 303
 		$pimple['honorifics'] = function() {
304
-			return new Honorifics( [
304
+			return new Honorifics([
305 305
 				'' => 'Kein Titel',
306 306
 				'Dr.' => 'Dr.',
307 307
 				'Prof.' => 'Prof.',
308 308
 				'Prof. Dr.' => 'Prof. Dr.'
309
-			] );
309
+			]);
310 310
 		};
311 311
 
312 312
 		$pimple['twig'] = function() {
313 313
 			$config = $this->config['twig'];
314 314
 			$config['loaders']['filesystem']['template-dir'] = 'skins/' . $this->getSkinSettings()->getSkin() . '/templates';
315 315
 
316
-			$twigFactory = $this->newTwigFactory( $config );
316
+			$twigFactory = $this->newTwigFactory($config);
317 317
 			$configurator = $twigFactory->newTwigEnvironmentConfigurator();
318 318
 
319
-			$loaders = array_filter( [
319
+			$loaders = array_filter([
320 320
 				$twigFactory->newFileSystemLoader(),
321 321
 				$twigFactory->newArrayLoader(), // This is just a fallback for testing
322
-			] );
322
+			]);
323 323
 			$extensions = [
324
-				$twigFactory->newTranslationExtension( $this->getTranslator() ),
324
+				$twigFactory->newTranslationExtension($this->getTranslator()),
325 325
 				new Twig_Extensions_Extension_Intl()
326 326
 			];
327 327
 			$filters = [
@@ -332,48 +332,48 @@  discard block
 block discarded – undo
332 332
 			$functions = [
333 333
 				new Twig_SimpleFunction(
334 334
 					'web_content',
335
-					function( string $name, array $context = [] ): string {
336
-						return $this->getContentProvider()->getWeb( $name, $context );
335
+					function(string $name, array $context = []): string {
336
+						return $this->getContentProvider()->getWeb($name, $context);
337 337
 					},
338
-					[ 'is_safe' => [ 'html' ] ]
338
+					['is_safe' => ['html']]
339 339
 				),
340 340
 			];
341 341
 
342
-			return $configurator->getEnvironment( $this->pimple['skin_twig_environment'], $loaders, $extensions, $filters, $functions );
342
+			return $configurator->getEnvironment($this->pimple['skin_twig_environment'], $loaders, $extensions, $filters, $functions);
343 343
 		};
344 344
 
345 345
 		$pimple['mailer_twig'] = function() {
346
-			$twigFactory = $this->newTwigFactory( $this->config['mailer-twig'] );
346
+			$twigFactory = $this->newTwigFactory($this->config['mailer-twig']);
347 347
 			$configurator = $twigFactory->newTwigEnvironmentConfigurator();
348 348
 
349
-			$loaders = array_filter( [
349
+			$loaders = array_filter([
350 350
 				$twigFactory->newFileSystemLoader(),
351 351
 				$twigFactory->newArrayLoader(), // This is just a fallback for testing
352
-			] );
352
+			]);
353 353
 			$extensions = [
354
-				$twigFactory->newTranslationExtension( $this->getTranslator() ),
354
+				$twigFactory->newTranslationExtension($this->getTranslator()),
355 355
 				new Twig_Extensions_Extension_Intl(),
356 356
 			];
357 357
 			$filters = [];
358 358
 			$functions = [
359 359
 				new Twig_SimpleFunction(
360 360
 					'mail_content',
361
-					function( string $name, array $context = [] ): string {
362
-						return $this->getContentProvider()->getMail( $name, $context );
361
+					function(string $name, array $context = []): string {
362
+						return $this->getContentProvider()->getMail($name, $context);
363 363
 					},
364
-					[ 'is_safe' => [ 'all' ] ]
364
+					['is_safe' => ['all']]
365 365
 				),
366 366
 				new Twig_SimpleFunction(
367 367
 					'url',
368
-					function( string $name, array $parameters = [] ): string {
369
-						return $this->getUrlGenerator()->generateUrl( $name, $parameters );
368
+					function(string $name, array $parameters = []): string {
369
+						return $this->getUrlGenerator()->generateUrl($name, $parameters);
370 370
 					}
371 371
 				)
372 372
 			];
373 373
 
374 374
 			$twigEnvironment = new Twig_Environment();
375 375
 
376
-			return $configurator->getEnvironment( $twigEnvironment, $loaders, $extensions, $filters, $functions );
376
+			return $configurator->getEnvironment($twigEnvironment, $loaders, $extensions, $filters, $functions);
377 377
 		};
378 378
 
379 379
 		$pimple['messenger_suborganization'] = function() {
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 		};
394 394
 
395 395
 		$pimple['confirmation-page-selector'] = function() {
396
-			return new DonationConfirmationPageSelector( $this->config['confirmation-pages'] );
396
+			return new DonationConfirmationPageSelector($this->config['confirmation-pages']);
397 397
 		};
398 398
 
399 399
 		$pimple['paypal-payment-notification-verifier'] = function() {
@@ -432,14 +432,14 @@  discard block
 block discarded – undo
432 432
 		$pimple['donation_token_generator'] = function() {
433 433
 			return new RandomTokenGenerator(
434 434
 				$this->config['token-length'],
435
-				new \DateInterval( $this->config['token-validity-timestamp'] )
435
+				new \DateInterval($this->config['token-validity-timestamp'])
436 436
 			);
437 437
 		};
438 438
 
439 439
 		$pimple['membership_token_generator'] = function() {
440 440
 			return new RandomMembershipTokenGenerator(
441 441
 				$this->config['token-length'],
442
-				new \DateInterval( $this->config['token-validity-timestamp'] )
442
+				new \DateInterval($this->config['token-validity-timestamp'])
443 443
 			);
444 444
 		};
445 445
 
@@ -451,41 +451,41 @@  discard block
 block discarded – undo
451 451
 			return new VoidCache();
452 452
 		};
453 453
 
454
-		$pimple['page_view_tracker'] = function () {
455
-			return new PageViewTracker( $this->newServerSideTracker(), $this->config['piwik']['siteUrlBase'] );
454
+		$pimple['page_view_tracker'] = function() {
455
+			return new PageViewTracker($this->newServerSideTracker(), $this->config['piwik']['siteUrlBase']);
456 456
 		};
457 457
 
458
-		$pimple['cachebusting_fileprefixer'] = function () {
459
-			return new FilePrefixer( $this->getFilePrefix() );
458
+		$pimple['cachebusting_fileprefixer'] = function() {
459
+			return new FilePrefixer($this->getFilePrefix());
460 460
 		};
461 461
 
462
-		$pimple['content_page_selector'] = function () {
463
-			$json = (new SimpleFileFetcher())->fetchFile( $this->getI18nDirectory() . '/data/pages.json' );
464
-			$config = json_decode( $json, true ) ?? [];
462
+		$pimple['content_page_selector'] = function() {
463
+			$json = (new SimpleFileFetcher())->fetchFile($this->getI18nDirectory() . '/data/pages.json');
464
+			$config = json_decode($json, true) ?? [];
465 465
 
466
-			return new PageSelector( $config );
466
+			return new PageSelector($config);
467 467
 		};
468 468
 
469
-		$pimple['content_provider'] = function () {
470
-			return new ContentProvider( [
469
+		$pimple['content_provider'] = function() {
470
+			return new ContentProvider([
471 471
 				'content_path' => $this->getI18nDirectory(),
472 472
 				'cache' => $this->config['twig']['enable-cache'] ? $this->getCachePath() . '/content' : false,
473 473
 				'globals' => [
474 474
 					'basepath' => $this->config['web-basepath']
475 475
 				]
476
-			] );
476
+			]);
477 477
 		};
478 478
 
479 479
 		$pimple['payment-delay-calculator'] = function() {
480
-			return new DefaultPaymentDelayCalculator( $this->getPaymentDelayInDays() );
480
+			return new DefaultPaymentDelayCalculator($this->getPaymentDelayInDays());
481 481
 		};
482 482
 
483
-		$pimple['sofort-client'] = function () {
483
+		$pimple['sofort-client'] = function() {
484 484
 			$config = $this->config['sofort'];
485
-			return new SofortClient( $config['config-key'] );
485
+			return new SofortClient($config['config-key']);
486 486
 		};
487 487
 
488
-		$pimple['cookie-builder'] = function (): CookieBuilder {
488
+		$pimple['cookie-builder'] = function(): CookieBuilder {
489 489
 			return new CookieBuilder(
490 490
 				$this->config['cookie']['expiration'],
491 491
 				$this->config['cookie']['path'],
@@ -497,13 +497,13 @@  discard block
 block discarded – undo
497 497
 			);
498 498
 		};
499 499
 
500
-		$pimple['skin-settings'] = function (): SkinSettings {
500
+		$pimple['skin-settings'] = function(): SkinSettings {
501 501
 			$config = $this->config['skin'];
502
-			return new SkinSettings( $config['options'], $config['default'], $config['cookie-lifetime'] );
502
+			return new SkinSettings($config['options'], $config['default'], $config['cookie-lifetime']);
503 503
 		};
504 504
 
505
-		$pimple['payment-types-settings'] = function (): PaymentTypesSettings {
506
-			return new PaymentTypesSettings( $this->config['payment-types'] );
505
+		$pimple['payment-types-settings'] = function(): PaymentTypesSettings {
506
+			return new PaymentTypesSettings($this->config['payment-types']);
507 507
 		};
508 508
 
509 509
 		return $pimple;
@@ -519,17 +519,17 @@  discard block
 block discarded – undo
519 519
 
520 520
 	private function newDonationEventLogger(): DonationEventLogger {
521 521
 		return new BestEffortDonationEventLogger(
522
-			new DoctrineDonationEventLogger( $this->getEntityManager() ),
522
+			new DoctrineDonationEventLogger($this->getEntityManager()),
523 523
 			$this->getLogger()
524 524
 		);
525 525
 	}
526 526
 
527 527
 	public function newInstaller(): Installer {
528
-		return ( new StoreFactory( $this->getConnection() ) )->newInstaller();
528
+		return (new StoreFactory($this->getConnection()))->newInstaller();
529 529
 	}
530 530
 
531 531
 	public function newListCommentsUseCase(): ListCommentsUseCase {
532
-		return new ListCommentsUseCase( $this->getCommentFinder() );
532
+		return new ListCommentsUseCase($this->getCommentFinder());
533 533
 	}
534 534
 
535 535
 	public function newCommentListJsonPresenter(): CommentListJsonPresenter {
@@ -537,14 +537,14 @@  discard block
 block discarded – undo
537 537
 	}
538 538
 
539 539
 	public function newCommentListRssPresenter(): CommentListRssPresenter {
540
-		return new CommentListRssPresenter( new TwigTemplate(
540
+		return new CommentListRssPresenter(new TwigTemplate(
541 541
 			$this->getSkinTwig(),
542 542
 			'Comment_List.rss.twig'
543
-		) );
543
+		));
544 544
 	}
545 545
 
546 546
 	public function newCommentListHtmlPresenter(): CommentListHtmlPresenter {
547
-		return new CommentListHtmlPresenter( $this->getLayoutTemplate( 'Comment_List.html.twig', [ 'piwikGoals' => [ 1 ] ] ) );
547
+		return new CommentListHtmlPresenter($this->getLayoutTemplate('Comment_List.html.twig', ['piwikGoals' => [1]]));
548 548
 	}
549 549
 
550 550
 	private function getCommentFinder(): CommentFinder {
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 		return $this->pimple['subscription_repository'];
556 556
 	}
557 557
 
558
-	public function setSubscriptionRepository( SubscriptionRepository $subscriptionRepository ): void {
558
+	public function setSubscriptionRepository(SubscriptionRepository $subscriptionRepository): void {
559 559
 		$this->pimple['subscription_repository'] = $subscriptionRepository;
560 560
 	}
561 561
 
@@ -572,25 +572,25 @@  discard block
 block discarded – undo
572 572
 	}
573 573
 
574 574
 	public function newAddSubscriptionHtmlPresenter(): AddSubscriptionHtmlPresenter {
575
-		return new AddSubscriptionHtmlPresenter( $this->getLayoutTemplate( 'Subscription_Form.html.twig' ), $this->getTranslator() );
575
+		return new AddSubscriptionHtmlPresenter($this->getLayoutTemplate('Subscription_Form.html.twig'), $this->getTranslator());
576 576
 	}
577 577
 
578 578
 	public function newConfirmSubscriptionHtmlPresenter(): ConfirmSubscriptionHtmlPresenter {
579 579
 		return new ConfirmSubscriptionHtmlPresenter(
580
-			$this->getLayoutTemplate( 'Confirm_Subscription.twig' ),
580
+			$this->getLayoutTemplate('Confirm_Subscription.twig'),
581 581
 			$this->getTranslator()
582 582
 		);
583 583
 	}
584 584
 
585 585
 	public function newAddSubscriptionJsonPresenter(): AddSubscriptionJsonPresenter {
586
-		return new AddSubscriptionJsonPresenter( $this->getTranslator() );
586
+		return new AddSubscriptionJsonPresenter($this->getTranslator());
587 587
 	}
588 588
 
589 589
 	public function newGetInTouchHtmlPresenter(): GetInTouchHtmlPresenter {
590
-		return new GetInTouchHtmlPresenter( $this->getLayoutTemplate( 'contact_form.html.twig' ), $this->getTranslator() );
590
+		return new GetInTouchHtmlPresenter($this->getLayoutTemplate('contact_form.html.twig'), $this->getTranslator());
591 591
 	}
592 592
 
593
-	public function setSkinTwigEnvironment( Twig_Environment $twig ): void {
593
+	public function setSkinTwigEnvironment(Twig_Environment $twig): void {
594 594
 		$this->pimple['skin_twig_environment'] = $twig;
595 595
 	}
596 596
 
@@ -609,19 +609,19 @@  discard block
 block discarded – undo
609 609
 	 * @param array $context Additional variables for the template
610 610
 	 * @return TwigTemplate
611 611
 	 */
612
-	public function getLayoutTemplate( string $templateName, array $context = [] ): TwigTemplate {
612
+	public function getLayoutTemplate(string $templateName, array $context = []): TwigTemplate {
613 613
 		 return new TwigTemplate(
614 614
 			$this->getSkinTwig(),
615 615
 			$templateName,
616
-			array_merge( $this->getDefaultTwigVariables(), $context )
616
+			array_merge($this->getDefaultTwigVariables(), $context)
617 617
 		);
618 618
 	}
619 619
 
620
-	public function getMailerTemplate( string $templateName, array $context = [] ): TwigTemplate {
620
+	public function getMailerTemplate(string $templateName, array $context = []): TwigTemplate {
621 621
 		return new TwigTemplate(
622 622
 			$this->getMailerTwig(),
623 623
 			$templateName,
624
-			array_merge( $this->getDefaultTwigVariables(), $context )
624
+			array_merge($this->getDefaultTwigVariables(), $context)
625 625
 		);
626 626
 	}
627 627
 
@@ -633,13 +633,13 @@  discard block
 block discarded – undo
633 633
 	 * @param string $templateName Template to include
634 634
 	 * @return TwigTemplate
635 635
 	 */
636
-	private function getIncludeTemplate( string $templateName, array $context = [] ): TwigTemplate {
636
+	private function getIncludeTemplate(string $templateName, array $context = []): TwigTemplate {
637 637
 		return new TwigTemplate(
638 638
 			$this->getSkinTwig(),
639 639
 			'Include_in_Layout.twig',
640 640
 			array_merge(
641 641
 				$this->getDefaultTwigVariables(),
642
-				[ 'main_template' => $templateName ],
642
+				['main_template' => $templateName],
643 643
 				$context
644 644
 			)
645 645
 		);
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 			new TwigTemplate(
723 723
 					$this->getMailerTwig(),
724 724
 					'Subscription_Confirmation.txt.twig',
725
-					[ 'greeting_generator' => $this->getGreetingGenerator() ]
725
+					['greeting_generator' => $this->getGreetingGenerator()]
726 726
 			),
727 727
 			'mail_subject_subscription_confirmed'
728 728
 		);
@@ -734,16 +734,16 @@  discard block
 block discarded – undo
734 734
 	 * So much decoration going on that explicitly hinting what we return (Robustness principle) would be confusing
735 735
 	 * (you'd expect a TemplateBasedMailer, not a LoggingMailer), so we hint the interface instead.
736 736
 	 */
737
-	private function newTemplateMailer( Messenger $messenger, TwigTemplate $template, string $messageKey ): TemplateMailerInterface {
737
+	private function newTemplateMailer(Messenger $messenger, TwigTemplate $template, string $messageKey): TemplateMailerInterface {
738 738
 		$mailer = new TemplateBasedMailer(
739 739
 			$messenger,
740 740
 			$template,
741
-			$this->getTranslator()->trans( $messageKey )
741
+			$this->getTranslator()->trans($messageKey)
742 742
 		);
743 743
 
744
-		$mailer = new LoggingMailer( $mailer, $this->getLogger() );
744
+		$mailer = new LoggingMailer($mailer, $this->getLogger());
745 745
 
746
-		return $this->addProfilingDecorator( $mailer, 'Mailer' );
746
+		return $this->addProfilingDecorator($mailer, 'Mailer');
747 747
 	}
748 748
 
749 749
 	public function getGreetingGenerator(): GreetingGenerator {
@@ -751,11 +751,11 @@  discard block
 block discarded – undo
751 751
 	}
752 752
 
753 753
 	public function newCheckIbanUseCase(): CheckIbanUseCase {
754
-		return new CheckIbanUseCase( $this->newBankDataConverter(), $this->newIbanValidator() );
754
+		return new CheckIbanUseCase($this->newBankDataConverter(), $this->newIbanValidator());
755 755
 	}
756 756
 
757 757
 	public function newGenerateIbanUseCase(): GenerateIbanUseCase {
758
-		return new GenerateIbanUseCase( $this->newBankDataConverter(), $this->newIbanValidator() );
758
+		return new GenerateIbanUseCase($this->newBankDataConverter(), $this->newIbanValidator());
759 759
 	}
760 760
 
761 761
 	public function newIbanPresenter(): IbanPresenter {
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
 	}
764 764
 
765 765
 	public function newBankDataConverter(): BankDataConverter {
766
-		return new BankDataConverter( $this->config['bank-data-file'] );
766
+		return new BankDataConverter($this->config['bank-data-file']);
767 767
 	}
768 768
 
769
-	public function setSubscriptionValidator( SubscriptionValidator $subscriptionValidator ): void {
769
+	public function setSubscriptionValidator(SubscriptionValidator $subscriptionValidator): void {
770 770
 		$this->pimple['subscription_validator'] = $subscriptionValidator;
771 771
 	}
772 772
 
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 	private function newContactUserMailer(): TemplateMailerInterface {
782 782
 		return $this->newTemplateMailer(
783 783
 			$this->getSuborganizationMessenger(),
784
-			new TwigTemplate( $this->getMailerTwig(), 'Contact_Confirm_to_User.txt.twig' ),
784
+			new TwigTemplate($this->getMailerTwig(), 'Contact_Confirm_to_User.txt.twig'),
785 785
 			'mail_subject_getintouch'
786 786
 		);
787 787
 	}
@@ -789,8 +789,8 @@  discard block
 block discarded – undo
789 789
 	private function newContactOperatorMailer(): OperatorMailer {
790 790
 		return new OperatorMailer(
791 791
 			$this->getSuborganizationMessenger(),
792
-			new TwigTemplate( $this->getMailerTwig(), 'Contact_Forward_to_Operator.txt.twig' ),
793
-			$this->getTranslator()->trans( 'mail_subject_getintouch_forward' )
792
+			new TwigTemplate($this->getMailerTwig(), 'Contact_Forward_to_Operator.txt.twig'),
793
+			$this->getTranslator()->trans('mail_subject_getintouch_forward')
794 794
 		);
795 795
 	}
796 796
 
@@ -807,12 +807,12 @@  discard block
 block discarded – undo
807 807
 
808 808
 	private function newSubscriptionDuplicateCutoffDate(): \DateTime {
809 809
 		$cutoffDateTime = new \DateTime();
810
-		$cutoffDateTime->sub( new \DateInterval( $this->config['subscription-interval'] ) );
810
+		$cutoffDateTime->sub(new \DateInterval($this->config['subscription-interval']));
811 811
 		return $cutoffDateTime;
812 812
 	}
813 813
 
814 814
 	private function newHonorificValidator(): AllowedValuesValidator {
815
-		return new AllowedValuesValidator( $this->getHonorifics()->getKeys() );
815
+		return new AllowedValuesValidator($this->getHonorifics()->getKeys());
816 816
 	}
817 817
 
818 818
 	private function getHonorifics(): Honorifics {
@@ -821,20 +821,20 @@  discard block
 block discarded – undo
821 821
 
822 822
 	public function newAuthorizedCachePurger(): AuthorizedCachePurger {
823 823
 		return new AuthorizedCachePurger(
824
-			new AllOfTheCachePurger( $this->getSkinTwig(), $this->getPageCache(), $this->getRenderedPageCache() ),
824
+			new AllOfTheCachePurger($this->getSkinTwig(), $this->getPageCache(), $this->getRenderedPageCache()),
825 825
 			$this->config['purging-secret']
826 826
 		);
827 827
 	}
828 828
 
829 829
 	private function newBankDataValidator(): BankDataValidator {
830
-		return new BankDataValidator( $this->newIbanValidator() );
830
+		return new BankDataValidator($this->newIbanValidator());
831 831
 	}
832 832
 
833 833
 	private function getSuborganizationMessenger(): Messenger {
834 834
 		return $this->pimple['messenger_suborganization'];
835 835
 	}
836 836
 
837
-	public function setSuborganizationMessenger( Messenger $messenger ): void {
837
+	public function setSuborganizationMessenger(Messenger $messenger): void {
838 838
 		$this->pimple['messenger_suborganization'] = $messenger;
839 839
 	}
840 840
 
@@ -842,57 +842,57 @@  discard block
 block discarded – undo
842 842
 		return $this->pimple['messenger_organization'];
843 843
 	}
844 844
 
845
-	public function setOrganizationMessenger( Messenger $messenger ): void {
845
+	public function setOrganizationMessenger(Messenger $messenger): void {
846 846
 		$this->pimple['messenger_organization'] = $messenger;
847 847
 	}
848 848
 
849 849
 	public function setNullMessenger(): void {
850
-		$this->setSuborganizationMessenger( new Messenger(
850
+		$this->setSuborganizationMessenger(new Messenger(
851 851
 			Swift_NullTransport::newInstance(),
852 852
 			$this->getSubOrganizationEmailAddress()
853
-		) );
854
-		$this->setOrganizationMessenger( new Messenger(
853
+		));
854
+		$this->setOrganizationMessenger(new Messenger(
855 855
 			Swift_NullTransport::newInstance(),
856 856
 			$this->getOrganizationEmailAddress()
857
-		) );
857
+		));
858 858
 	}
859 859
 
860 860
 	public function getSubOrganizationEmailAddress(): EmailAddress {
861
-		return new EmailAddress( $this->config['contact-info']['suborganization']['email'] );
861
+		return new EmailAddress($this->config['contact-info']['suborganization']['email']);
862 862
 	}
863 863
 
864 864
 	public function getOrganizationEmailAddress(): EmailAddress {
865
-		return new EmailAddress( $this->config['contact-info']['organization']['email'] );
865
+		return new EmailAddress($this->config['contact-info']['organization']['email']);
866 866
 	}
867 867
 
868 868
 	public function newInternalErrorHtmlPresenter(): InternalErrorHtmlPresenter {
869
-		return new InternalErrorHtmlPresenter( $this->getLayoutTemplate( 'Error_Page.html.twig' ) );
869
+		return new InternalErrorHtmlPresenter($this->getLayoutTemplate('Error_Page.html.twig'));
870 870
 	}
871 871
 
872 872
 	public function newAccessDeniedHtmlPresenter(): InternalErrorHtmlPresenter {
873
-		return new InternalErrorHtmlPresenter( $this->getLayoutTemplate( 'Access_Denied.twig' ) );
873
+		return new InternalErrorHtmlPresenter($this->getLayoutTemplate('Access_Denied.twig'));
874 874
 	}
875 875
 
876 876
 	public function getTranslator(): TranslatorInterface {
877 877
 		return $this->pimple['translator'];
878 878
 	}
879 879
 
880
-	public function setTranslator( TranslatorInterface $translator ): void {
880
+	public function setTranslator(TranslatorInterface $translator): void {
881 881
 		$this->pimple['translator'] = $translator;
882 882
 	}
883 883
 
884
-	private function newTwigFactory( array $twigConfig ): TwigFactory {
884
+	private function newTwigFactory(array $twigConfig): TwigFactory {
885 885
 		return new TwigFactory(
886 886
 			array_merge_recursive(
887 887
 				$twigConfig,
888
-				[ 'web-basepath' => $this->config['web-basepath'] ]
888
+				['web-basepath' => $this->config['web-basepath']]
889 889
 			),
890 890
 			$this->getCachePath() . '/twig',
891 891
 			$this->config['locale']
892 892
 		);
893 893
 	}
894 894
 
895
-	private function newTextPolicyValidator( string $policyName ): TextPolicyValidator {
895
+	private function newTextPolicyValidator(string $policyName): TextPolicyValidator {
896 896
 		$fetcher = new ErrorLoggingFileFetcher(
897 897
 			new SimpleFileFetcher(),
898 898
 			$this->getLogger()
@@ -901,24 +901,24 @@  discard block
 block discarded – undo
901 901
 		return new TextPolicyValidator(
902 902
 			new WordListFileReader(
903 903
 				$fetcher,
904
-				$textPolicyConfig['badwords'] ? $this->getAbsolutePath( $textPolicyConfig['badwords'] ) : ''
904
+				$textPolicyConfig['badwords'] ? $this->getAbsolutePath($textPolicyConfig['badwords']) : ''
905 905
 			),
906 906
 			new WordListFileReader(
907 907
 				$fetcher,
908
-				$textPolicyConfig['whitewords'] ? $this->getAbsolutePath( $textPolicyConfig['whitewords'] ) : ''
908
+				$textPolicyConfig['whitewords'] ? $this->getAbsolutePath($textPolicyConfig['whitewords']) : ''
909 909
 			)
910 910
 		);
911 911
 	}
912 912
 
913 913
 	private function newCommentPolicyValidator(): TextPolicyValidator {
914
-		return $this->newTextPolicyValidator( 'comment' );
914
+		return $this->newTextPolicyValidator('comment');
915 915
 	}
916 916
 
917
-	public function newCancelDonationUseCase( string $updateToken ): CancelDonationUseCase {
917
+	public function newCancelDonationUseCase(string $updateToken): CancelDonationUseCase {
918 918
 		return new CancelDonationUseCase(
919 919
 			$this->getDonationRepository(),
920 920
 			$this->newCancelDonationMailer(),
921
-			$this->newDonationAuthorizer( $updateToken ),
921
+			$this->newDonationAuthorizer($updateToken),
922 922
 			$this->newDonationEventLogger()
923 923
 		);
924 924
 	}
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 			new TwigTemplate(
930 930
 				$this->getMailerTwig(),
931 931
 				'Donation_Cancellation_Confirmation.txt.twig',
932
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
932
+				['greeting_generator' => $this->getGreetingGenerator()]
933 933
 			),
934 934
 			'mail_subject_confirm_cancellation'
935 935
 		);
@@ -988,23 +988,23 @@  discard block
 block discarded – undo
988 988
 	public function newPayPalUrlGeneratorForDonations(): PayPalUrlGenerator {
989 989
 		return new PayPalUrlGenerator(
990 990
 			$this->getPayPalUrlConfigForDonations(),
991
-			$this->getTranslator()->trans( 'item_name_donation' )
991
+			$this->getTranslator()->trans('item_name_donation')
992 992
 		);
993 993
 	}
994 994
 
995 995
 	public function newPayPalUrlGeneratorForMembershipApplications(): PayPalUrlGenerator {
996 996
 		return new PayPalUrlGenerator(
997 997
 			$this->getPayPalUrlConfigForMembershipApplications(),
998
-			$this->getTranslator()->trans( 'item_name_membership' )
998
+			$this->getTranslator()->trans('item_name_membership')
999 999
 		);
1000 1000
 	}
1001 1001
 
1002 1002
 	private function getPayPalUrlConfigForDonations(): PayPalConfig {
1003
-		return PayPalConfig::newFromConfig( $this->config['paypal-donation'] );
1003
+		return PayPalConfig::newFromConfig($this->config['paypal-donation']);
1004 1004
 	}
1005 1005
 
1006 1006
 	private function getPayPalUrlConfigForMembershipApplications(): PayPalConfig {
1007
-		return PayPalConfig::newFromConfig( $this->config['paypal-membership'] );
1007
+		return PayPalConfig::newFromConfig($this->config['paypal-membership']);
1008 1008
 	}
1009 1009
 
1010 1010
 	public function newSofortUrlGeneratorForDonations(): SofortUrlGenerator {
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
 
1013 1013
 		return new SofortUrlGenerator(
1014 1014
 			new SofortConfig(
1015
-				$this->getTranslator()->trans( 'item_name_donation', [], 'messages' ),
1015
+				$this->getTranslator()->trans('item_name_donation', [], 'messages'),
1016 1016
 				$config['return-url'],
1017 1017
 				$config['cancel-url'],
1018 1018
 				$config['notification-url']
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 		);
1022 1022
 	}
1023 1023
 
1024
-	public function setSofortClient( SofortClient $client ): void {
1024
+	public function setSofortClient(SofortClient $client): void {
1025 1025
 		$this->pimple['sofort-client'] = $client;
1026 1026
 	}
1027 1027
 
@@ -1030,11 +1030,11 @@  discard block
 block discarded – undo
1030 1030
 	}
1031 1031
 
1032 1032
 	private function newCreditCardUrlGenerator(): CreditCardUrlGenerator {
1033
-		return new CreditCardUrlGenerator( $this->newCreditCardUrlConfig() );
1033
+		return new CreditCardUrlGenerator($this->newCreditCardUrlConfig());
1034 1034
 	}
1035 1035
 
1036 1036
 	private function newCreditCardUrlConfig(): CreditCardConfig {
1037
-		return CreditCardConfig::newFromConfig( $this->config['creditcard'] );
1037
+		return CreditCardConfig::newFromConfig($this->config['creditcard']);
1038 1038
 	}
1039 1039
 
1040 1040
 	public function getDonationRepository(): DonationRepository {
@@ -1050,23 +1050,23 @@  discard block
 block discarded – undo
1050 1050
 	}
1051 1051
 
1052 1052
 	private function newAmountFormatter(): AmountFormatter {
1053
-		return new AmountFormatter( $this->config['locale'] );
1053
+		return new AmountFormatter($this->config['locale']);
1054 1054
 	}
1055 1055
 
1056 1056
 	public function newDecimalNumberFormatter(): NumberFormatter {
1057
-		return new NumberFormatter( $this->config['locale'], NumberFormatter::DECIMAL );
1057
+		return new NumberFormatter($this->config['locale'], NumberFormatter::DECIMAL);
1058 1058
 	}
1059 1059
 
1060
-	public function newAddCommentUseCase( string $updateToken ): AddCommentUseCase {
1060
+	public function newAddCommentUseCase(string $updateToken): AddCommentUseCase {
1061 1061
 		return new AddCommentUseCase(
1062 1062
 			$this->getDonationRepository(),
1063
-			$this->newDonationAuthorizer( $updateToken ),
1063
+			$this->newDonationAuthorizer($updateToken),
1064 1064
 			$this->newCommentPolicyValidator(),
1065 1065
 			$this->newAddCommentValidator()
1066 1066
 		);
1067 1067
 	}
1068 1068
 
1069
-	private function newDonationAuthorizer( string $updateToken = null, string $accessToken = null ): DonationAuthorizer {
1069
+	private function newDonationAuthorizer(string $updateToken = null, string $accessToken = null): DonationAuthorizer {
1070 1070
 		return new DoctrineDonationAuthorizer(
1071 1071
 			$this->getEntityManager(),
1072 1072
 			$updateToken,
@@ -1082,12 +1082,12 @@  discard block
 block discarded – undo
1082 1082
 		return $this->pimple['membership_token_generator'];
1083 1083
 	}
1084 1084
 
1085
-	public function newDonationConfirmationPresenter( string $templateName = 'Donation_Confirmation.html.twig' ): DonationConfirmationHtmlPresenter {
1085
+	public function newDonationConfirmationPresenter(string $templateName = 'Donation_Confirmation.html.twig'): DonationConfirmationHtmlPresenter {
1086 1086
 		return new DonationConfirmationHtmlPresenter(
1087 1087
 			$this->getLayoutTemplate(
1088 1088
 				$templateName,
1089 1089
 				[
1090
-					'piwikGoals' => [ 3 ],
1090
+					'piwikGoals' => [3],
1091 1091
 					'paymentTypes' => $this->getPaymentTypesSettings()->getEnabledForMembershipApplication()
1092 1092
 				]
1093 1093
 			),
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
 	public function newCancelDonationHtmlPresenter(): CancelDonationHtmlPresenter {
1106 1106
 		return new CancelDonationHtmlPresenter(
1107
-			$this->getLayoutTemplate( 'Donation_Cancellation_Confirmation.html.twig' )
1107
+			$this->getLayoutTemplate('Donation_Cancellation_Confirmation.html.twig')
1108 1108
 		);
1109 1109
 	}
1110 1110
 
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 			new TwigTemplate(
1128 1128
 				$this->getMailerTwig(),
1129 1129
 				'Membership_Application_Confirmation.txt.twig',
1130
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
1130
+				['greeting_generator' => $this->getGreetingGenerator()]
1131 1131
 			),
1132 1132
 			'mail_subject_confirm_membership_application'
1133 1133
 		);
@@ -1142,11 +1142,11 @@  discard block
 block discarded – undo
1142 1142
 	}
1143 1143
 
1144 1144
 	private function newMembershipApplicationTracker(): ApplicationTracker {
1145
-		return new DoctrineApplicationTracker( $this->getEntityManager() );
1145
+		return new DoctrineApplicationTracker($this->getEntityManager());
1146 1146
 	}
1147 1147
 
1148 1148
 	private function newMembershipApplicationPiwikTracker(): ApplicationPiwikTracker {
1149
-		return new DoctrineApplicationPiwikTracker( $this->getEntityManager() );
1149
+		return new DoctrineApplicationPiwikTracker($this->getEntityManager());
1150 1150
 	}
1151 1151
 
1152 1152
 	private function getPaymentDelayCalculator(): PaymentDelayCalculator {
@@ -1157,20 +1157,20 @@  discard block
 block discarded – undo
1157 1157
 		return $this->getPayPalUrlConfigForMembershipApplications()->getDelayInDays();
1158 1158
 	}
1159 1159
 
1160
-	public function setPaymentDelayCalculator( PaymentDelayCalculator $paymentDelayCalculator ): void {
1160
+	public function setPaymentDelayCalculator(PaymentDelayCalculator $paymentDelayCalculator): void {
1161 1161
 		$this->pimple['payment-delay-calculator'] = $paymentDelayCalculator;
1162 1162
 	}
1163 1163
 
1164 1164
 	private function newApplyForMembershipPolicyValidator(): ApplyForMembershipPolicyValidator {
1165 1165
 		return new ApplyForMembershipPolicyValidator(
1166
-			$this->newTextPolicyValidator( 'fields' ),
1166
+			$this->newTextPolicyValidator('fields'),
1167 1167
 			$this->config['email-address-blacklist']
1168 1168
 		);
1169 1169
 	}
1170 1170
 
1171
-	public function newCancelMembershipApplicationUseCase( string $updateToken ): CancelMembershipApplicationUseCase {
1171
+	public function newCancelMembershipApplicationUseCase(string $updateToken): CancelMembershipApplicationUseCase {
1172 1172
 		return new CancelMembershipApplicationUseCase(
1173
-			$this->newMembershipApplicationAuthorizer( $updateToken ),
1173
+			$this->newMembershipApplicationAuthorizer($updateToken),
1174 1174
 			$this->getMembershipApplicationRepository(),
1175 1175
 			$this->newCancelMembershipApplicationMailer()
1176 1176
 		);
@@ -1196,28 +1196,28 @@  discard block
 block discarded – undo
1196 1196
 			new TwigTemplate(
1197 1197
 				$this->getMailerTwig(),
1198 1198
 				'Membership_Application_Cancellation_Confirmation.txt.twig',
1199
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
1199
+				['greeting_generator' => $this->getGreetingGenerator()]
1200 1200
 			),
1201 1201
 			'mail_subject_confirm_membership_application_cancellation'
1202 1202
 		);
1203 1203
 	}
1204 1204
 
1205
-	public function newMembershipApplicationConfirmationUseCase( string $accessToken ): ShowMembershipApplicationConfirmationUseCase {
1205
+	public function newMembershipApplicationConfirmationUseCase(string $accessToken): ShowMembershipApplicationConfirmationUseCase {
1206 1206
 		return new ShowMembershipApplicationConfirmationUseCase(
1207
-			$this->newMembershipApplicationAuthorizer( null, $accessToken ), $this->getMembershipApplicationRepository(),
1207
+			$this->newMembershipApplicationAuthorizer(null, $accessToken), $this->getMembershipApplicationRepository(),
1208 1208
 			$this->newMembershipApplicationTokenFetcher()
1209 1209
 		);
1210 1210
 	}
1211 1211
 
1212
-	public function newShowDonationConfirmationUseCase( string $accessToken ): ShowDonationConfirmationUseCase {
1212
+	public function newShowDonationConfirmationUseCase(string $accessToken): ShowDonationConfirmationUseCase {
1213 1213
 		return new ShowDonationConfirmationUseCase(
1214
-			$this->newDonationAuthorizer( null, $accessToken ),
1214
+			$this->newDonationAuthorizer(null, $accessToken),
1215 1215
 			$this->newDonationTokenFetcher(),
1216 1216
 			$this->getDonationRepository()
1217 1217
 		);
1218 1218
 	}
1219 1219
 
1220
-	public function setDonationConfirmationPageSelector( DonationConfirmationPageSelector $selector ): void {
1220
+	public function setDonationConfirmationPageSelector(DonationConfirmationPageSelector $selector): void {
1221 1221
 		$this->pimple['confirmation-page-selector'] = $selector;
1222 1222
 	}
1223 1223
 
@@ -1226,57 +1226,57 @@  discard block
 block discarded – undo
1226 1226
 	}
1227 1227
 
1228 1228
 	public function newDonationFormViolationPresenter(): DonationFormViolationPresenter {
1229
-		return new DonationFormViolationPresenter( $this->getDonationFormTemplate(), $this->newAmountFormatter() );
1229
+		return new DonationFormViolationPresenter($this->getDonationFormTemplate(), $this->newAmountFormatter());
1230 1230
 	}
1231 1231
 
1232 1232
 	public function newDonationFormPresenter(): DonationFormPresenter {
1233
-		return new DonationFormPresenter( $this->getDonationFormTemplate(), $this->newAmountFormatter() );
1233
+		return new DonationFormPresenter($this->getDonationFormTemplate(), $this->newAmountFormatter());
1234 1234
 	}
1235 1235
 
1236 1236
 	private function getDonationFormTemplate(): TwigTemplate {
1237 1237
 		// TODO make the template name dependent on the 'form' value from the HTTP POST request
1238 1238
 		// (we need different form pages for A/B testing)
1239
-		return $this->getLayoutTemplate( 'Donation_Form.html.twig', [
1239
+		return $this->getLayoutTemplate('Donation_Form.html.twig', [
1240 1240
 			'paymentTypes' => $this->getPaymentTypesSettings()->getEnabledForDonation()
1241
-		] );
1241
+		]);
1242 1242
 	}
1243 1243
 
1244 1244
 	public function getMembershipApplicationFormTemplate(): TwigTemplate {
1245
-		return $this->getLayoutTemplate( 'Membership_Application.html.twig', [
1245
+		return $this->getLayoutTemplate('Membership_Application.html.twig', [
1246 1246
 			'paymentTypes' => $this->getPaymentTypesSettings()->getEnabledForMembershipApplication()
1247
-		] );
1247
+		]);
1248 1248
 	}
1249 1249
 
1250
-	public function newHandleSofortPaymentNotificationUseCase( string $updateToken ): SofortPaymentNotificationUseCase {
1250
+	public function newHandleSofortPaymentNotificationUseCase(string $updateToken): SofortPaymentNotificationUseCase {
1251 1251
 		return new SofortPaymentNotificationUseCase(
1252 1252
 			$this->getDonationRepository(),
1253
-			$this->newDonationAuthorizer( $updateToken ),
1253
+			$this->newDonationAuthorizer($updateToken),
1254 1254
 			$this->newDonationConfirmationMailer()
1255 1255
 		);
1256 1256
 	}
1257 1257
 
1258
-	public function newHandlePayPalPaymentNotificationUseCase( string $updateToken ): HandlePayPalPaymentNotificationUseCase {
1258
+	public function newHandlePayPalPaymentNotificationUseCase(string $updateToken): HandlePayPalPaymentNotificationUseCase {
1259 1259
 		return new HandlePayPalPaymentNotificationUseCase(
1260 1260
 			$this->getDonationRepository(),
1261
-			$this->newDonationAuthorizer( $updateToken ),
1261
+			$this->newDonationAuthorizer($updateToken),
1262 1262
 			$this->newDonationConfirmationMailer(),
1263 1263
 			$this->newDonationEventLogger()
1264 1264
 		);
1265 1265
 	}
1266 1266
 
1267
-	public function newMembershipApplicationSubscriptionSignupNotificationUseCase( string $updateToken ): HandleSubscriptionSignupNotificationUseCase {
1267
+	public function newMembershipApplicationSubscriptionSignupNotificationUseCase(string $updateToken): HandleSubscriptionSignupNotificationUseCase {
1268 1268
 		return new HandleSubscriptionSignupNotificationUseCase(
1269 1269
 			$this->getMembershipApplicationRepository(),
1270
-			$this->newMembershipApplicationAuthorizer( $updateToken ),
1270
+			$this->newMembershipApplicationAuthorizer($updateToken),
1271 1271
 			$this->newApplyForMembershipMailer(),
1272 1272
 			$this->getLogger()
1273 1273
 		);
1274 1274
 	}
1275 1275
 
1276
-	public function newMembershipApplicationSubscriptionPaymentNotificationUseCase( string $updateToken ): HandleSubscriptionPaymentNotificationUseCase {
1276
+	public function newMembershipApplicationSubscriptionPaymentNotificationUseCase(string $updateToken): HandleSubscriptionPaymentNotificationUseCase {
1277 1277
 		return new HandleSubscriptionPaymentNotificationUseCase(
1278 1278
 			$this->getMembershipApplicationRepository(),
1279
-			$this->newMembershipApplicationAuthorizer( $updateToken ),
1279
+			$this->newMembershipApplicationAuthorizer($updateToken),
1280 1280
 			$this->newApplyForMembershipMailer(),
1281 1281
 			$this->getLogger()
1282 1282
 		);
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 		return $this->pimple['paypal-payment-notification-verifier'];
1287 1287
 	}
1288 1288
 
1289
-	public function setPayPalPaymentNotificationVerifier( PaymentNotificationVerifier $verifier ): void {
1289
+	public function setPayPalPaymentNotificationVerifier(PaymentNotificationVerifier $verifier): void {
1290 1290
 		$this->pimple['paypal-payment-notification-verifier'] = $verifier;
1291 1291
 	}
1292 1292
 
@@ -1294,14 +1294,14 @@  discard block
 block discarded – undo
1294 1294
 		return $this->pimple['paypal-membership-fee-notification-verifier'];
1295 1295
 	}
1296 1296
 
1297
-	public function setPayPalMembershipFeeNotificationVerifier( PaymentNotificationVerifier $verifier ): void {
1297
+	public function setPayPalMembershipFeeNotificationVerifier(PaymentNotificationVerifier $verifier): void {
1298 1298
 		$this->pimple['paypal-membership-fee-notification-verifier'] = $verifier;
1299 1299
 	}
1300 1300
 
1301
-	public function newCreditCardNotificationUseCase( string $updateToken ): CreditCardNotificationUseCase {
1301
+	public function newCreditCardNotificationUseCase(string $updateToken): CreditCardNotificationUseCase {
1302 1302
 		return new CreditCardNotificationUseCase(
1303 1303
 			$this->getDonationRepository(),
1304
-			$this->newDonationAuthorizer( $updateToken ),
1304
+			$this->newDonationAuthorizer($updateToken),
1305 1305
 			$this->getCreditCardService(),
1306 1306
 			$this->newDonationConfirmationMailer(),
1307 1307
 			$this->getLogger(),
@@ -1311,13 +1311,13 @@  discard block
 block discarded – undo
1311 1311
 
1312 1312
 	public function newCancelMembershipApplicationHtmlPresenter(): CancelMembershipApplicationHtmlPresenter {
1313 1313
 		return new CancelMembershipApplicationHtmlPresenter(
1314
-			$this->getLayoutTemplate( 'Membership_Application_Cancellation_Confirmation.html.twig' )
1314
+			$this->getLayoutTemplate('Membership_Application_Cancellation_Confirmation.html.twig')
1315 1315
 		);
1316 1316
 	}
1317 1317
 
1318 1318
 	public function newMembershipApplicationConfirmationHtmlPresenter(): MembershipApplicationConfirmationHtmlPresenter {
1319 1319
 		return new MembershipApplicationConfirmationHtmlPresenter(
1320
-			$this->getLayoutTemplate( 'Membership_Application_Confirmation.html.twig' )
1320
+			$this->getLayoutTemplate('Membership_Application_Confirmation.html.twig')
1321 1321
 		);
1322 1322
 	}
1323 1323
 
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
 		);
1328 1328
 	}
1329 1329
 
1330
-	public function setCreditCardService( CreditCardService $ccService ): void {
1330
+	public function setCreditCardService(CreditCardService $ccService): void {
1331 1331
 		$this->pimple['credit-card-api-service'] = $ccService;
1332 1332
 	}
1333 1333
 
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
 			new TwigTemplate(
1341 1341
 				$this->getSkinTwig(),
1342 1342
 				'Credit_Card_Payment_Notification.txt.twig',
1343
-				[ 'returnUrl' => $this->config['creditcard']['return-url'] ]
1343
+				['returnUrl' => $this->config['creditcard']['return-url']]
1344 1344
 			)
1345 1345
 		);
1346 1346
 	}
@@ -1359,11 +1359,11 @@  discard block
 block discarded – undo
1359 1359
 		);
1360 1360
 	}
1361 1361
 
1362
-	public function setDonationTokenGenerator( TokenGenerator $tokenGenerator ): void {
1362
+	public function setDonationTokenGenerator(TokenGenerator $tokenGenerator): void {
1363 1363
 		$this->pimple['donation_token_generator'] = $tokenGenerator;
1364 1364
 	}
1365 1365
 
1366
-	public function setMembershipTokenGenerator( MembershipTokenGenerator $tokenGenerator ): void {
1366
+	public function setMembershipTokenGenerator(MembershipTokenGenerator $tokenGenerator): void {
1367 1367
 		$this->pimple['membership_token_generator'] = $tokenGenerator;
1368 1368
 	}
1369 1369
 
@@ -1386,23 +1386,23 @@  discard block
 block discarded – undo
1386 1386
 	private function newDonationPolicyValidator(): AddDonationPolicyValidator {
1387 1387
 		return new AddDonationPolicyValidator(
1388 1388
 			$this->newDonationAmountPolicyValidator(),
1389
-			$this->newTextPolicyValidator( 'fields' ),
1389
+			$this->newTextPolicyValidator('fields'),
1390 1390
 			$this->config['email-address-blacklist']
1391 1391
 		);
1392 1392
 	}
1393 1393
 
1394 1394
 	private function newDonationAmountPolicyValidator(): AmountPolicyValidator {
1395 1395
 		// in the future, this might come from the configuration
1396
-		return new AmountPolicyValidator( 1000, 1000 );
1396
+		return new AmountPolicyValidator(1000, 1000);
1397 1397
 	}
1398 1398
 
1399 1399
 	public function getDonationTimeframeLimit(): string {
1400 1400
 		return $this->config['donation-timeframe-limit'];
1401 1401
 	}
1402 1402
 
1403
-	public function newSystemMessageResponse( string $message ): string {
1404
-		return $this->getLayoutTemplate( 'System_Message.html.twig' )
1405
-			->render( [ 'message' => $message ] );
1403
+	public function newSystemMessageResponse(string $message): string {
1404
+		return $this->getLayoutTemplate('System_Message.html.twig')
1405
+			->render(['message' => $message]);
1406 1406
 	}
1407 1407
 
1408 1408
 	public function getMembershipApplicationTimeframeLimit(): string {
@@ -1423,41 +1423,41 @@  discard block
 block discarded – undo
1423 1423
 
1424 1424
 	public function enablePageCache(): void {
1425 1425
 		$this->pimple['page_cache'] = function() {
1426
-			return new FilesystemCache( $this->getCachePath() . '/pages/raw' );
1426
+			return new FilesystemCache($this->getCachePath() . '/pages/raw');
1427 1427
 		};
1428 1428
 
1429 1429
 		$this->pimple['rendered_page_cache'] = function() {
1430
-			return new FilesystemCache( $this->getCachePath() . '/pages/rendered' );
1430
+			return new FilesystemCache($this->getCachePath() . '/pages/rendered');
1431 1431
 		};
1432 1432
 	}
1433 1433
 
1434
-	private function addProfilingDecorator( $objectToDecorate, string $profilingLabel ) {	// @codingStandardsIgnoreLine
1435
-		if ( $this->profiler === null ) {
1434
+	private function addProfilingDecorator($objectToDecorate, string $profilingLabel) {	// @codingStandardsIgnoreLine
1435
+		if ($this->profiler === null) {
1436 1436
 			return $objectToDecorate;
1437 1437
 		}
1438 1438
 
1439
-		$builder = new ProfilingDecoratorBuilder( $this->profiler, $this->getProfilerDataCollector() );
1439
+		$builder = new ProfilingDecoratorBuilder($this->profiler, $this->getProfilerDataCollector());
1440 1440
 
1441
-		return $builder->decorate( $objectToDecorate, $profilingLabel );
1441
+		return $builder->decorate($objectToDecorate, $profilingLabel);
1442 1442
 	}
1443 1443
 
1444
-	public function setProfiler( Stopwatch $profiler ): void {
1444
+	public function setProfiler(Stopwatch $profiler): void {
1445 1445
 		$this->profiler = $profiler;
1446 1446
 	}
1447 1447
 
1448
-	public function setEmailValidator( EmailValidator $validator ): void {
1448
+	public function setEmailValidator(EmailValidator $validator): void {
1449 1449
 		$this->pimple['mail_validator'] = $validator;
1450 1450
 	}
1451 1451
 
1452
-	public function setLogger( LoggerInterface $logger ): void {
1452
+	public function setLogger(LoggerInterface $logger): void {
1453 1453
 		$this->pimple['logger'] = $logger;
1454 1454
 	}
1455 1455
 
1456
-	public function setPaypalLogger( LoggerInterface $logger ): void {
1456
+	public function setPaypalLogger(LoggerInterface $logger): void {
1457 1457
 		$this->pimple['paypal_logger'] = $logger;
1458 1458
 	}
1459 1459
 
1460
-	public function setSofortLogger( LoggerInterface $logger ): void {
1460
+	public function setSofortLogger(LoggerInterface $logger): void {
1461 1461
 		$this->pimple['sofort_logger'] = $logger;
1462 1462
 	}
1463 1463
 
@@ -1466,10 +1466,10 @@  discard block
 block discarded – undo
1466 1466
 	}
1467 1467
 
1468 1468
 	private function newIbanValidator(): KontoCheckIbanValidator {
1469
-		return new KontoCheckIbanValidator( $this->newBankDataConverter(), $this->config['banned-ibans'] );
1469
+		return new KontoCheckIbanValidator($this->newBankDataConverter(), $this->config['banned-ibans']);
1470 1470
 	}
1471 1471
 
1472
-	public function setFilePrefixer( FilePrefixer $prefixer ): void {
1472
+	public function setFilePrefixer(FilePrefixer $prefixer): void {
1473 1473
 		$this->pimple['cachebusting_fileprefixer'] = $prefixer;
1474 1474
 	}
1475 1475
 
@@ -1479,26 +1479,26 @@  discard block
 block discarded – undo
1479 1479
 
1480 1480
 	private function getFilePrefix(): string {
1481 1481
 		$prefixContentFile = $this->getVarPath() . '/file_prefix.txt';
1482
-		if ( !file_exists( $prefixContentFile ) ) {
1482
+		if (!file_exists($prefixContentFile)) {
1483 1483
 			return '';
1484 1484
 		}
1485
-		return $prefix = preg_replace( '/[^0-9a-f]/', '', file_get_contents( $prefixContentFile ) );
1485
+		return $prefix = preg_replace('/[^0-9a-f]/', '', file_get_contents($prefixContentFile));
1486 1486
 	}
1487 1487
 
1488
-	public function newDonationAcceptedEventHandler( string $updateToken ): DonationAcceptedEventHandler {
1488
+	public function newDonationAcceptedEventHandler(string $updateToken): DonationAcceptedEventHandler {
1489 1489
 		return new DonationAcceptedEventHandler(
1490
-			$this->newDonationAuthorizer( $updateToken ),
1490
+			$this->newDonationAuthorizer($updateToken),
1491 1491
 			$this->getDonationRepository(),
1492 1492
 			$this->newDonationConfirmationMailer()
1493 1493
 		);
1494 1494
 	}
1495 1495
 
1496 1496
 	public function newPageNotFoundHtmlPresenter(): PageNotFoundPresenter {
1497
-		return new PageNotFoundPresenter( $this->getLayoutTemplate( 'Page_not_found.html.twig' ) );
1497
+		return new PageNotFoundPresenter($this->getLayoutTemplate('Page_not_found.html.twig'));
1498 1498
 	}
1499 1499
 
1500
-	public function setPageViewTracker( PageViewTracker $tracker ): void {
1501
-		$this->pimple['page_view_tracker'] = function () use ( $tracker )  {
1500
+	public function setPageViewTracker(PageViewTracker $tracker): void {
1501
+		$this->pimple['page_view_tracker'] = function() use ($tracker)  {
1502 1502
 			return $tracker;
1503 1503
 		};
1504 1504
 	}
@@ -1511,25 +1511,25 @@  discard block
 block discarded – undo
1511 1511
 		// the "https:" prefix does NOT get any slashes because baseURL is stored in a protocol-agnostic way
1512 1512
 		// (e.g. "//tracking.wikimedia.de" )
1513 1513
 		return new PiwikServerSideTracker(
1514
-			new \PiwikTracker( $this->config['piwik']['siteId'], 'https:' . $this->config['piwik']['baseUrl'] )
1514
+			new \PiwikTracker($this->config['piwik']['siteId'], 'https:' . $this->config['piwik']['baseUrl'])
1515 1515
 		);
1516 1516
 	}
1517 1517
 
1518 1518
 	public function getI18nDirectory(): string {
1519
-		return $this->getAbsolutePath( $this->config['i18n-base-path'] ) . '/' . $this->config['locale'];
1519
+		return $this->getAbsolutePath($this->config['i18n-base-path']) . '/' . $this->config['locale'];
1520 1520
 	}
1521 1521
 
1522 1522
 	/**
1523 1523
 	 * If the pathname does not start with a slash, make the path absolute to root dir of application
1524 1524
 	 */
1525
-	private function getAbsolutePath( string $path ): string {
1526
-		if ( $path[0] === '/' ) {
1525
+	private function getAbsolutePath(string $path): string {
1526
+		if ($path[0] === '/') {
1527 1527
 			return $path;
1528 1528
 		}
1529 1529
 		return __DIR__ . '/../../' . $path;
1530 1530
 	}
1531 1531
 
1532
-	public function setContentPagePageSelector( PageSelector $pageSelector ): void {
1532
+	public function setContentPagePageSelector(PageSelector $pageSelector): void {
1533 1533
 		$this->pimple['content_page_selector'] = $pageSelector;
1534 1534
 	}
1535 1535
 
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 		return $this->pimple['content_page_selector'];
1538 1538
 	}
1539 1539
 
1540
-	public function setContentProvider( ContentProvider $contentProvider ): void {
1540
+	public function setContentProvider(ContentProvider $contentProvider): void {
1541 1541
 		$this->pimple['content_provider'] = $contentProvider;
1542 1542
 	}
1543 1543
 
@@ -1555,7 +1555,7 @@  discard block
 block discarded – undo
1555 1555
 		return $this->pimple['url_generator'];
1556 1556
 	}
1557 1557
 
1558
-	public function setUrlGenerator( UrlGenerator $urlGenerator ): void {
1558
+	public function setUrlGenerator(UrlGenerator $urlGenerator): void {
1559 1559
 		$this->pimple['url_generator'] = $urlGenerator;
1560 1560
 	}
1561 1561
 
@@ -1572,12 +1572,12 @@  discard block
 block discarded – undo
1572 1572
 	}
1573 1573
 
1574 1574
 	public function newDonationAmountConstraint(): ValidatorConstraint {
1575
-		return new RequiredConstraint( [
1576
-			new TypeConstraint( [ 'type' => 'digit' ] ),
1577
-			new RangeConstraint( [
1578
-				'min' => Euro::newFromInt( $this->config['donation-minimum-amount'] )->getEuroCents(),
1579
-				'max' => Euro::newFromInt( $this->config['donation-maximum-amount'] )->getEuroCents()
1580
-			] )
1581
-		] );
1575
+		return new RequiredConstraint([
1576
+			new TypeConstraint(['type' => 'digit']),
1577
+			new RangeConstraint([
1578
+				'min' => Euro::newFromInt($this->config['donation-minimum-amount'])->getEuroCents(),
1579
+				'max' => Euro::newFromInt($this->config['donation-maximum-amount'])->getEuroCents()
1580
+			])
1581
+		]);
1582 1582
 	}
1583 1583
 }
Please login to merge, or discard this patch.
Presentation/Presenters/DonationConfirmationHtmlPresenterTest.php 1 patch
Spacing   +16 added lines, -16 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\Tests\Integration\Presentation\Presenters;
6 6
 
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 		$expectedParameters['donation']['status'] = self::STATUS_BOOKED;
32 32
 
33 33
 		$presenter = new DonationConfirmationHtmlPresenter(
34
-			$this->newTwigTemplateMock( $expectedParameters ),
34
+			$this->newTwigTemplateMock($expectedParameters),
35 35
 			new FakeUrlGenerator()
36 36
 		);
37 37
 
38 38
 		$donation = ValidDonation::newBookedAnonymousPayPalDonation();
39
-		$donation->assignId( self::DONATION_ID );
39
+		$donation->assignId(self::DONATION_ID);
40 40
 
41 41
 		$presenter->present(
42 42
 			$donation,
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 				'paymentType' => 'PPL',
59 59
 				'optsIntoNewsletter' => false,
60 60
 				'bankTransferCode' => '',
61
-				'creationDate' => ( new \DateTime() )->format( 'd.m.Y' ),
61
+				'creationDate' => (new \DateTime())->format('d.m.Y'),
62 62
 				'cookieDuration' => '15552000',
63 63
 				'updateToken' => self::UPDATE_TOKEN
64 64
 			],
@@ -66,29 +66,29 @@  discard block
 block discarded – undo
66 66
 			'bankData' => [],
67 67
 			'initialFormValues' => [],
68 68
 			'piwikEvents' => [
69
-				[ 'setCustomVariable', 1, 'Payment', 'some value', PiwikEvents::SCOPE_VISIT ],
70
-				[ 'trackGoal', 4095 ]
69
+				['setCustomVariable', 1, 'Payment', 'some value', PiwikEvents::SCOPE_VISIT],
70
+				['trackGoal', 4095]
71 71
 			],
72 72
 			'commentUrl' => 'https://such.a.url/AddCommentPage?donationId=42&updateToken=update_token&accessToken=access_token'
73 73
 		];
74 74
 	}
75 75
 
76
-	private function newTwigTemplateMock( array $expectedParameters ): TwigTemplate {
77
-		$twig = $this->createMock( TwigTemplate::class );
78
-		$twig->expects( $this->once() )
79
-			->method( 'render' )
80
-			->with( $expectedParameters );
76
+	private function newTwigTemplateMock(array $expectedParameters): TwigTemplate {
77
+		$twig = $this->createMock(TwigTemplate::class);
78
+		$twig->expects($this->once())
79
+			->method('render')
80
+			->with($expectedParameters);
81 81
 		return $twig;
82 82
 	}
83 83
 
84 84
 	private function newSelectedConfirmationPage(): SelectedConfirmationPage {
85
-		return $this->createMock( SelectedConfirmationPage::class );
85
+		return $this->createMock(SelectedConfirmationPage::class);
86 86
 	}
87 87
 
88 88
 	private function newPiwikEvents(): PiwikEvents {
89 89
 		$piwikEvents = new PiwikEvents();
90
-		$piwikEvents->triggerSetCustomVariable( 1, 'some value', PiwikEvents::SCOPE_VISIT );
91
-		$piwikEvents->triggerTrackGoal( 4095 );
90
+		$piwikEvents->triggerSetCustomVariable(1, 'some value', PiwikEvents::SCOPE_VISIT);
91
+		$piwikEvents->triggerTrackGoal(4095);
92 92
 		return $piwikEvents;
93 93
 	}
94 94
 
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 		$expectedParameters['donation']['status'] = self::STATUS_UNCONFIRMED;
98 98
 
99 99
 		$presenter = new DonationConfirmationHtmlPresenter(
100
-			$this->newTwigTemplateMock( $expectedParameters ),
100
+			$this->newTwigTemplateMock($expectedParameters),
101 101
 			new FakeUrlGenerator()
102 102
 		);
103 103
 
104 104
 		$donation = ValidDonation::newIncompleteAnonymousPayPalDonation();
105
-		$donation->assignId( self::DONATION_ID );
105
+		$donation->assignId(self::DONATION_ID);
106 106
 
107 107
 		$presenter->present(
108 108
 			$donation,
Please login to merge, or discard this patch.
app/routes.php 1 patch
Spacing   +197 added lines, -197 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;
@@ -48,96 +48,96 @@  discard block
 block discarded – undo
48 48
 
49 49
 $app->post(
50 50
 	'validate-email',
51
-	function( Request $request ) use ( $app, $ffFactory ) {
52
-		$validationResult = $ffFactory->getEmailValidator()->validate( $request->request->get( 'email', '' ) );
53
-		return $app->json( [ 'status' => $validationResult->isSuccessful() ? 'OK' : 'ERR' ] );
51
+	function(Request $request) use ($app, $ffFactory) {
52
+		$validationResult = $ffFactory->getEmailValidator()->validate($request->request->get('email', ''));
53
+		return $app->json(['status' => $validationResult->isSuccessful() ? 'OK' : 'ERR']);
54 54
 	}
55 55
 );
56 56
 
57 57
 $app->post(
58 58
 	'validate-payment-data',
59
-	function( Request $request ) use ( $app, $ffFactory ) {
59
+	function(Request $request) use ($app, $ffFactory) {
60 60
 
61
-		$amount = (float) $ffFactory->newDecimalNumberFormatter()->parse( $request->get( 'amount', '0' ) );
61
+		$amount = (float)$ffFactory->newDecimalNumberFormatter()->parse($request->get('amount', '0'));
62 62
 		$validator = $ffFactory->newPaymentDataValidator();
63
-		$validationResult = $validator->validate( $amount, (string) $request->get( 'paymentType', '' ) );
63
+		$validationResult = $validator->validate($amount, (string)$request->get('paymentType', ''));
64 64
 
65
-		if ( $validationResult->isSuccessful() ) {
66
-			return $app->json( [ 'status' => 'OK' ] );
65
+		if ($validationResult->isSuccessful()) {
66
+			return $app->json(['status' => 'OK']);
67 67
 		} else {
68 68
 			$errors = [];
69
-			foreach( $validationResult->getViolations() as $violation ) {
70
-				$errors[ $violation->getSource() ] = $ffFactory->getTranslator()->trans( $violation->getMessageIdentifier() );
69
+			foreach ($validationResult->getViolations() as $violation) {
70
+				$errors[$violation->getSource()] = $ffFactory->getTranslator()->trans($violation->getMessageIdentifier());
71 71
 			}
72
-			return $app->json( [ 'status' => 'ERR', 'messages' => $errors ] );
72
+			return $app->json(['status' => 'ERR', 'messages' => $errors]);
73 73
 		}
74 74
 	}
75 75
 );
76 76
 
77 77
 $app->post(
78 78
 	'validate-address', // Validates donor information. This route is named badly.
79
-	function( Request $request ) use ( $app, $ffFactory ) {
80
-		return ( new ValidateDonorHandler( $ffFactory, $app ) )->handle( $request );
79
+	function(Request $request) use ($app, $ffFactory) {
80
+		return (new ValidateDonorHandler($ffFactory, $app))->handle($request);
81 81
 	}
82 82
 );
83 83
 
84 84
 $app->post(
85 85
 	'validate-donation-amount',
86
-	function( Request $httpRequest ) use ( $app, $ffFactory ) {
86
+	function(Request $httpRequest) use ($app, $ffFactory) {
87 87
 
88
-		$constraint = new Collection( [
88
+		$constraint = new Collection([
89 89
 			'allowExtraFields' => false,
90 90
 			'fields' => [
91 91
 				'amount' => $ffFactory->newDonationAmountConstraint()
92 92
 			]
93
-		] );
93
+		]);
94 94
 
95
-		$violations = Validation::createValidator()->validate( $httpRequest->request->all(), $constraint );
95
+		$violations = Validation::createValidator()->validate($httpRequest->request->all(), $constraint);
96 96
 
97
-		if ( $violations->count() > 0 ) {
97
+		if ($violations->count() > 0) {
98 98
 			$mapper = new ConstraintViolationListMapper();
99
-			return $app->json( [ 'status' => 'ERR', 'messages' => $mapper->map( $violations ) ] );
99
+			return $app->json(['status' => 'ERR', 'messages' => $mapper->map($violations)]);
100 100
 		}
101 101
 
102
-		return $app->json( [ 'status' => 'OK' ] );
102
+		return $app->json(['status' => 'OK']);
103 103
 	}
104 104
 );
105 105
 
106 106
 $app->post(
107 107
 	'validate-fee',
108
-	function( Request $httpRequest ) use ( $app, $ffFactory ) {
108
+	function(Request $httpRequest) use ($app, $ffFactory) {
109 109
 		$validator = new MembershipFeeValidator();
110 110
 		$result = $validator->validate(
111
-			str_replace( ',', '.', $httpRequest->request->get( 'amount', '' ) ),
112
-			(int) $httpRequest->request->get( 'paymentIntervalInMonths', '0' ),
113
-			$httpRequest->request->get( 'addressType', '' )
111
+			str_replace(',', '.', $httpRequest->request->get('amount', '')),
112
+			(int)$httpRequest->request->get('paymentIntervalInMonths', '0'),
113
+			$httpRequest->request->get('addressType', '')
114 114
 		);
115 115
 
116
-		if ( $result->isSuccessful() ) {
117
-			return $app->json( [ 'status' => 'OK' ] );
116
+		if ($result->isSuccessful()) {
117
+			return $app->json(['status' => 'OK']);
118 118
 		} else {
119 119
 			$errors = $result->getViolations();
120
-			return $app->json( [ 'status' => 'ERR', 'messages' => $errors ] );
120
+			return $app->json(['status' => 'ERR', 'messages' => $errors]);
121 121
 		}
122 122
 	}
123 123
 );
124 124
 
125 125
 $app->get(
126 126
 	'list-comments.json',
127
-	function( Request $request ) use ( $app, $ffFactory ) {
127
+	function(Request $request) use ($app, $ffFactory) {
128 128
 		$response = $app->json(
129 129
 			$ffFactory->newCommentListJsonPresenter()->present(
130 130
 				$ffFactory->newListCommentsUseCase()->listComments(
131 131
 					new CommentListingRequest(
132
-						(int)$request->query->get( 'n', '10' ),
133
-						(int)$request->query->get( 'page', '1' )
132
+						(int)$request->query->get('n', '10'),
133
+						(int)$request->query->get('page', '1')
134 134
 					)
135 135
 				)
136 136
 			)
137 137
 		);
138 138
 
139
-		if ( $request->query->get( 'f' ) ) {
140
-			$response->setCallback( $request->query->get( 'f' ) );
139
+		if ($request->query->get('f')) {
140
+			$response->setCallback($request->query->get('f'));
141 141
 		}
142 142
 
143 143
 		return $response;
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 
147 147
 $app->get(
148 148
 	'list-comments.rss',
149
-	function() use ( $app, $ffFactory ) {
149
+	function() use ($app, $ffFactory) {
150 150
 		$rss = $ffFactory->newCommentListRssPresenter()->present(
151 151
 			$ffFactory->newListCommentsUseCase()->listComments(
152
-				new CommentListingRequest( 100, CommentListingRequest::FIRST_PAGE )
152
+				new CommentListingRequest(100, CommentListingRequest::FIRST_PAGE)
153 153
 			)
154 154
 		);
155 155
 
@@ -162,130 +162,130 @@  discard block
 block discarded – undo
162 162
 			]
163 163
 		);
164 164
 	}
165
-)->bind( 'list-comments.rss' );
165
+)->bind('list-comments.rss');
166 166
 
167 167
 $app->get(
168 168
 	'list-comments.html',
169
-	function( Request $request ) use ( $app, $ffFactory ) {
169
+	function(Request $request) use ($app, $ffFactory) {
170 170
 		return new Response(
171 171
 			$ffFactory->newCommentListHtmlPresenter()->present(
172 172
 				$ffFactory->newListCommentsUseCase()->listComments(
173 173
 					new CommentListingRequest(
174 174
 						10,
175
-						(int)$request->query->get( 'page', '1' )
175
+						(int)$request->query->get('page', '1')
176 176
 					)
177 177
 				),
178
-				(int)$request->query->get( 'page', '1' )
178
+				(int)$request->query->get('page', '1')
179 179
 			)
180 180
 		);
181 181
 	}
182
-)->bind( 'list-comments.html' );
182
+)->bind('list-comments.html');
183 183
 
184 184
 $app->get(
185 185
 	'page/{pageName}',
186
-	function( $pageName ) use ( $ffFactory ) {
186
+	function($pageName) use ($ffFactory) {
187 187
 		$pageSelector = $ffFactory->getContentPagePageSelector();
188 188
 
189 189
 		try {
190
-			$pageId = $pageSelector->getPageId( $pageName );
191
-		} catch ( PageNotFoundException $exception ) {
192
-			throw new NotFoundHttpException( "Page page name '$pageName' not found." );
190
+			$pageId = $pageSelector->getPageId($pageName);
191
+		} catch (PageNotFoundException $exception) {
192
+			throw new NotFoundHttpException("Page page name '$pageName' not found.");
193 193
 		}
194 194
 
195 195
 		try {
196
-			return $ffFactory->getLayoutTemplate( 'Display_Page_Layout.twig' )->render( [
196
+			return $ffFactory->getLayoutTemplate('Display_Page_Layout.twig')->render([
197 197
 				'page_id' => $pageId
198
-			] );
199
-		} catch ( Twig_Error_Runtime $exception ) {
198
+			]);
199
+		} catch (Twig_Error_Runtime $exception) {
200 200
 			if ($exception->getPrevious() instanceof ContentNotFoundException) {
201
-				throw new NotFoundHttpException( "Content for page id '$pageId' not found." );
201
+				throw new NotFoundHttpException("Content for page id '$pageId' not found.");
202 202
 			}
203 203
 
204 204
 			throw $exception;
205 205
 		}
206 206
 	}
207 207
 )
208
-->bind( 'page' );
208
+->bind('page');
209 209
 
210 210
 // Form for this is provided by route page/Subscription_Form
211 211
 $app->match(
212 212
 	'contact/subscribe',
213
-	function( Application $app, Request $request ) use ( $ffFactory ) {
214
-		return ( new AddSubscriptionHandler( $ffFactory, $app ) )
215
-			->handle( $request );
213
+	function(Application $app, Request $request) use ($ffFactory) {
214
+		return (new AddSubscriptionHandler($ffFactory, $app))
215
+			->handle($request);
216 216
 	}
217 217
 )
218
-->method( 'GET|POST' )
219
-->bind( 'subscribe' );
218
+->method('GET|POST')
219
+->bind('subscribe');
220 220
 
221
-$app->get( 'contact/confirm-subscription/{confirmationCode}', function ( $confirmationCode ) use ( $ffFactory ) {
221
+$app->get('contact/confirm-subscription/{confirmationCode}', function($confirmationCode) use ($ffFactory) {
222 222
 	$useCase = $ffFactory->newConfirmSubscriptionUseCase();
223
-	$response = $useCase->confirmSubscription( $confirmationCode );
224
-	return $ffFactory->newConfirmSubscriptionHtmlPresenter()->present( $response );
223
+	$response = $useCase->confirmSubscription($confirmationCode);
224
+	return $ffFactory->newConfirmSubscriptionHtmlPresenter()->present($response);
225 225
 } )
226
-->assert( 'confirmationCode', '^[0-9a-f]+$' )
227
-->bind( 'confirm-subscription' );
226
+->assert('confirmationCode', '^[0-9a-f]+$')
227
+->bind('confirm-subscription');
228 228
 
229 229
 $app->get(
230 230
 	'check-iban',
231
-	function( Request $request ) use ( $app, $ffFactory ) {
231
+	function(Request $request) use ($app, $ffFactory) {
232 232
 		$useCase = $ffFactory->newCheckIbanUseCase();
233
-		$checkIbanResponse = $useCase->checkIban( new Iban( $request->query->get( 'iban', '' ) ) );
234
-		return $app->json( $ffFactory->newIbanPresenter()->present( $checkIbanResponse ) );
233
+		$checkIbanResponse = $useCase->checkIban(new Iban($request->query->get('iban', '')));
234
+		return $app->json($ffFactory->newIbanPresenter()->present($checkIbanResponse));
235 235
 	}
236 236
 );
237 237
 
238 238
 $app->get(
239 239
 	'generate-iban',
240
-	function( Request $request ) use ( $app, $ffFactory ) {
240
+	function(Request $request) use ($app, $ffFactory) {
241 241
 		$generateIbanRequest = new GenerateIbanRequest(
242
-			$request->query->get( 'accountNumber', '' ),
243
-			$request->query->get( 'bankCode', '' )
242
+			$request->query->get('accountNumber', ''),
243
+			$request->query->get('bankCode', '')
244 244
 		);
245 245
 
246
-		$generateIbanResponse = $ffFactory->newGenerateIbanUseCase()->generateIban( $generateIbanRequest );
247
-		return $app->json( $ffFactory->newIbanPresenter()->present( $generateIbanResponse ) );
246
+		$generateIbanResponse = $ffFactory->newGenerateIbanUseCase()->generateIban($generateIbanRequest);
247
+		return $app->json($ffFactory->newIbanPresenter()->present($generateIbanResponse));
248 248
 	}
249 249
 );
250 250
 
251 251
 $app->post(
252 252
 	'add-comment',
253
-	function( Request $request ) use ( $app, $ffFactory ) {
253
+	function(Request $request) use ($app, $ffFactory) {
254 254
 		$addCommentRequest = new AddCommentRequest();
255
-		$addCommentRequest->setCommentText( trim( $request->request->get( 'comment', '' ) ) );
256
-		$addCommentRequest->setIsPublic( $request->request->get( 'public', '0' ) === '1' );
257
-		$addCommentRequest->setAuthorDisplayName( trim( $request->request->get( 'displayName', '' ) ) );
258
-		$addCommentRequest->setDonationId( (int)$request->request->get( 'donationId', '' ) );
255
+		$addCommentRequest->setCommentText(trim($request->request->get('comment', '')));
256
+		$addCommentRequest->setIsPublic($request->request->get('public', '0') === '1');
257
+		$addCommentRequest->setAuthorDisplayName(trim($request->request->get('displayName', '')));
258
+		$addCommentRequest->setDonationId((int)$request->request->get('donationId', ''));
259 259
 		$addCommentRequest->freeze()->assertNoNullFields();
260 260
 
261
-		$updateToken = $request->request->get( 'updateToken', '' );
261
+		$updateToken = $request->request->get('updateToken', '');
262 262
 
263
-		if ( $updateToken === '' ) {
264
-			return $app->json( [
263
+		if ($updateToken === '') {
264
+			return $app->json([
265 265
 				'status' => 'ERR',
266
-				'message' => $ffFactory->getTranslator()->trans( 'comment_failure_access_denied' ),
267
-			] );
266
+				'message' => $ffFactory->getTranslator()->trans('comment_failure_access_denied'),
267
+			]);
268 268
 		}
269 269
 
270
-		$response = $ffFactory->newAddCommentUseCase( $updateToken )->addComment( $addCommentRequest );
270
+		$response = $ffFactory->newAddCommentUseCase($updateToken)->addComment($addCommentRequest);
271 271
 
272
-		if ( $response->isSuccessful() ) {
273
-			return $app->json( [
272
+		if ($response->isSuccessful()) {
273
+			return $app->json([
274 274
 				'status' => 'OK',
275
-				'message' => $ffFactory->getTranslator()->trans( $response->getSuccessMessage() ),
276
-			] );
275
+				'message' => $ffFactory->getTranslator()->trans($response->getSuccessMessage()),
276
+			]);
277 277
 		}
278 278
 
279
-		return $app->json( [
279
+		return $app->json([
280 280
 			'status' => 'ERR',
281
-			'message' => $ffFactory->getTranslator()->trans( $response->getErrorMessage() ),
282
-		] );
281
+			'message' => $ffFactory->getTranslator()->trans($response->getErrorMessage()),
282
+		]);
283 283
 	}
284 284
 );
285 285
 
286 286
 $app->get(
287 287
 	'add-comment',
288
-	function( Request $request ) use ( $app, $ffFactory ) {
288
+	function(Request $request) use ($app, $ffFactory) {
289 289
 		$template = $ffFactory->getLayoutTemplate(
290 290
 			'Donation_Comment.html.twig'
291 291
 		);
@@ -293,61 +293,61 @@  discard block
 block discarded – undo
293 293
 		return new Response(
294 294
 			$template->render(
295 295
 				[
296
-					'donationId' => (int)$request->query->get( 'donationId', '' ),
297
-					'updateToken' => $request->query->get( 'updateToken', '' ),
296
+					'donationId' => (int)$request->query->get('donationId', ''),
297
+					'updateToken' => $request->query->get('updateToken', ''),
298 298
 					'cancelUrl' => $app['url_generator']->generate(
299 299
 						'show-donation-confirmation',
300 300
 						[
301
-							'id' => (int)$request->query->get( 'donationId', '' ),
302
-							'accessToken' => $request->query->get( 'accessToken', '' )
301
+							'id' => (int)$request->query->get('donationId', ''),
302
+							'accessToken' => $request->query->get('accessToken', '')
303 303
 						]
304 304
 					)
305 305
 				]
306 306
 			)
307 307
 		);
308 308
 	}
309
-)->bind( 'AddCommentPage' );
309
+)->bind('AddCommentPage');
310 310
 
311 311
 $app->post(
312 312
 	'contact/get-in-touch',
313
-	function( Request $request ) use ( $app, $ffFactory ) {
313
+	function(Request $request) use ($app, $ffFactory) {
314 314
 		$contactFormRequest = new GetInTouchRequest(
315
-			$request->get( 'firstname', '' ),
316
-			$request->get( 'lastname', '' ),
317
-			$request->get( 'email', '' ),
318
-			$request->get( 'subject', '' ),
319
-			$request->get( 'messageBody', '' )
315
+			$request->get('firstname', ''),
316
+			$request->get('lastname', ''),
317
+			$request->get('email', ''),
318
+			$request->get('subject', ''),
319
+			$request->get('messageBody', '')
320 320
 		);
321 321
 
322
-		$contactFormResponse = $ffFactory->newGetInTouchUseCase()->processContactRequest( $contactFormRequest );
323
-		if ( $contactFormResponse->isSuccessful() ) {
324
-			return $app->redirect( $app['url_generator']->generate( 'page', [ 'pageName' => 'Kontakt_Bestaetigung' ] ) );
322
+		$contactFormResponse = $ffFactory->newGetInTouchUseCase()->processContactRequest($contactFormRequest);
323
+		if ($contactFormResponse->isSuccessful()) {
324
+			return $app->redirect($app['url_generator']->generate('page', ['pageName' => 'Kontakt_Bestaetigung']));
325 325
 		}
326 326
 
327
-		return $ffFactory->newGetInTouchHtmlPresenter()->present( $contactFormResponse, $request->request->all() );
327
+		return $ffFactory->newGetInTouchHtmlPresenter()->present($contactFormResponse, $request->request->all());
328 328
 	}
329 329
 );
330 330
 
331 331
 $app->get(
332 332
 	'contact/get-in-touch',
333
-	function() use ( $app, $ffFactory ) {
334
-		return $ffFactory->getLayoutTemplate( 'contact_form.html.twig' )->render( [ ] );
333
+	function() use ($app, $ffFactory) {
334
+		return $ffFactory->getLayoutTemplate('contact_form.html.twig')->render([]);
335 335
 	}
336 336
 )->bind('contact');
337 337
 
338 338
 $app->post(
339 339
 	'donation/cancel',
340
-	function( Request $request ) use ( $app, $ffFactory ) {
340
+	function(Request $request) use ($app, $ffFactory) {
341 341
 		$cancellationRequest = new CancelDonationRequest(
342
-			(int)$request->request->get( 'sid', '' )
342
+			(int)$request->request->get('sid', '')
343 343
 		);
344 344
 
345
-		$responseModel = $ffFactory->newCancelDonationUseCase( $request->request->get( 'utoken', '' ) )
346
-			->cancelDonation( $cancellationRequest );
345
+		$responseModel = $ffFactory->newCancelDonationUseCase($request->request->get('utoken', ''))
346
+			->cancelDonation($cancellationRequest);
347 347
 
348
-		$httpResponse = new Response( $ffFactory->newCancelDonationHtmlPresenter()->present( $responseModel ) );
349
-		if ( $responseModel->cancellationSucceeded() ) {
350
-			$httpResponse->headers->clearCookie( 'donation_timestamp' );
348
+		$httpResponse = new Response($ffFactory->newCancelDonationHtmlPresenter()->present($responseModel));
349
+		if ($responseModel->cancellationSucceeded()) {
350
+			$httpResponse->headers->clearCookie('donation_timestamp');
351 351
 		}
352 352
 
353 353
 		return $httpResponse;
@@ -356,171 +356,171 @@  discard block
 block discarded – undo
356 356
 
357 357
 $app->post(
358 358
 	'donation/add',
359
-	function( Application $app, Request $request ) use ( $ffFactory ) {
360
-		return ( new AddDonationHandler( $ffFactory, $app ) )
361
-			->handle( $request );
359
+	function(Application $app, Request $request) use ($ffFactory) {
360
+		return (new AddDonationHandler($ffFactory, $app))
361
+			->handle($request);
362 362
 	}
363 363
 );
364 364
 
365 365
 // Show a donation form with pre-filled payment values, e.g. when coming from a banner
366
-$app->get( 'donation/new', function ( Request $request ) use ( $ffFactory ) {
366
+$app->get('donation/new', function(Request $request) use ($ffFactory) {
367 367
 	try {
368
-		$amount = Euro::newFromFloat( ( new AmountParser( 'en_EN' ) )->parseAsFloat(
369
-			$request->get( 'betrag_auswahl', $request->get( 'amountGiven', '' ) ) )
368
+		$amount = Euro::newFromFloat((new AmountParser('en_EN'))->parseAsFloat(
369
+			$request->get('betrag_auswahl', $request->get('amountGiven', '')) )
370 370
 		);
371
-	} catch ( \InvalidArgumentException $ex ) {
372
-		$amount = Euro::newFromCents( 0 );
371
+	} catch (\InvalidArgumentException $ex) {
372
+		$amount = Euro::newFromCents(0);
373 373
 	}
374
-	$validationResult = $ffFactory->newPaymentDataValidator()->validate( $amount, (string) $request->get( 'zahlweise', '' ) );
374
+	$validationResult = $ffFactory->newPaymentDataValidator()->validate($amount, (string)$request->get('zahlweise', ''));
375 375
 
376 376
 	$trackingInfo = new DonationTrackingInfo();
377
-	$trackingInfo->setTotalImpressionCount( intval( $request->get( 'impCount' ) ) );
378
-	$trackingInfo->setSingleBannerImpressionCount( intval( $request->get( 'bImpCount' ) ) );
377
+	$trackingInfo->setTotalImpressionCount(intval($request->get('impCount')));
378
+	$trackingInfo->setSingleBannerImpressionCount(intval($request->get('bImpCount')));
379 379
 
380 380
 	// TODO: don't we want to use newDonationFormViolationPresenter when !$validationResult->isSuccessful()?
381 381
 
382 382
 	return new Response(
383 383
 		$ffFactory->newDonationFormPresenter()->present(
384 384
 			$amount,
385
-			$request->get( 'zahlweise', '' ),
386
-			intval( $request->get( 'periode', 0 ) ),
385
+			$request->get('zahlweise', ''),
386
+			intval($request->get('periode', 0)),
387 387
 			$validationResult->isSuccessful(),
388 388
 			$trackingInfo,
389
-			$request->get( 'addressType', 'person' )
389
+			$request->get('addressType', 'person')
390 390
 		)
391 391
 	);
392
-} )->method( 'POST|GET' );
392
+} )->method('POST|GET');
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
 	'apply-for-membership',
403
-	function( Request $request ) use ( $ffFactory ) {
403
+	function(Request $request) use ($ffFactory) {
404 404
 		$params = [];
405 405
 
406
-		if ( $request->query->get('type' ) === 'sustaining' ) {
407
-			$params['showMembershipTypeOption'] = false ;
406
+		if ($request->query->get('type') === 'sustaining') {
407
+			$params['showMembershipTypeOption'] = false;
408 408
 		}
409 409
 
410
-		return $ffFactory->getMembershipApplicationFormTemplate()->render( $params );
410
+		return $ffFactory->getMembershipApplicationFormTemplate()->render($params);
411 411
 	}
412 412
 );
413 413
 
414 414
 $app->get(
415 415
 	'show-membership-confirmation',
416
-	function( Request $request ) use ( $ffFactory ) {
417
-		$confirmationRequest = new ShowMembershipAppConfirmationRequest( (int)$request->query->get( 'id', 0 ) );
416
+	function(Request $request) use ($ffFactory) {
417
+		$confirmationRequest = new ShowMembershipAppConfirmationRequest((int)$request->query->get('id', 0));
418 418
 
419 419
 		return $ffFactory->newMembershipApplicationConfirmationHtmlPresenter()->present(
420
-			$ffFactory->newMembershipApplicationConfirmationUseCase( $request->query->get( 'accessToken', '' ) )
421
-				->showConfirmation( $confirmationRequest )
420
+			$ffFactory->newMembershipApplicationConfirmationUseCase($request->query->get('accessToken', ''))
421
+				->showConfirmation($confirmationRequest)
422 422
 		);
423 423
 	}
424
-)->bind( 'show-membership-confirmation' );
424
+)->bind('show-membership-confirmation');
425 425
 
426 426
 $app->get(
427 427
 	'cancel-membership-application',
428
-	function( Request $request ) use ( $ffFactory ) {
428
+	function(Request $request) use ($ffFactory) {
429 429
 		$cancellationRequest = new CancellationRequest(
430
-			(int)$request->query->get( 'id', '' )
430
+			(int)$request->query->get('id', '')
431 431
 		);
432 432
 
433 433
 		return $ffFactory->newCancelMembershipApplicationHtmlPresenter()->present(
434
-			$ffFactory->newCancelMembershipApplicationUseCase( $request->query->get( 'updateToken', '' ) )
435
-				->cancelApplication( $cancellationRequest )
434
+			$ffFactory->newCancelMembershipApplicationUseCase($request->query->get('updateToken', ''))
435
+				->cancelApplication($cancellationRequest)
436 436
 		);
437 437
 	}
438 438
 );
439 439
 
440 440
 $app->match(
441 441
 	'show-donation-confirmation',
442
-	function( Application $app, Request $request ) use ( $ffFactory ) {
443
-		return ( new ShowDonationConfirmationHandler( $ffFactory ) )->handle(
442
+	function(Application $app, Request $request) use ($ffFactory) {
443
+		return (new ShowDonationConfirmationHandler($ffFactory))->handle(
444 444
 			$request,
445
-			$app['session']->get( 'piwikTracking', [] )
445
+			$app['session']->get('piwikTracking', [])
446 446
 		);
447 447
 	}
448
-)->bind( 'show-donation-confirmation' )
449
-->method( 'GET|POST' );
448
+)->bind('show-donation-confirmation')
449
+->method('GET|POST');
450 450
 
451 451
 $app->post(
452 452
 	'handle-paypal-payment-notification',
453
-	function ( Request $request ) use ( $ffFactory ) {
454
-		return ( new PayPalNotificationHandler( $ffFactory ) )->handle( $request );
453
+	function(Request $request) use ($ffFactory) {
454
+		return (new PayPalNotificationHandler($ffFactory))->handle($request);
455 455
 	}
456 456
 );
457 457
 
458 458
 $app->post(
459 459
 	'sofort-payment-notification',
460
-	function ( Request $request ) use ( $ffFactory ) {
461
-		return ( new SofortNotificationHandler( $ffFactory ) )->handle( $request );
460
+	function(Request $request) use ($ffFactory) {
461
+		return (new SofortNotificationHandler($ffFactory))->handle($request);
462 462
 	}
463 463
 );
464 464
 
465 465
 $app->get(
466 466
 	'handle-creditcard-payment-notification',
467
-	function ( Request $request ) use ( $ffFactory ) {
467
+	function(Request $request) use ($ffFactory) {
468 468
 		try {
469
-			$ffFactory->newCreditCardNotificationUseCase( $request->query->get( 'utoken', '' ) )
469
+			$ffFactory->newCreditCardNotificationUseCase($request->query->get('utoken', ''))
470 470
 				->handleNotification(
471
-					( new CreditCardPaymentNotificationRequest() )
472
-						->setTransactionId( $request->query->get( 'transactionId', '' ) )
473
-						->setDonationId( (int)$request->query->get( 'donation_id', '' ) )
474
-						->setAmount( Euro::newFromCents( (int)$request->query->get( 'amount' ) ) )
475
-						->setCustomerId( $request->query->get( 'customerId', '' ) )
476
-						->setSessionId( $request->query->get( 'sessionId', '' ) )
477
-						->setAuthId( $request->query->get(  'auth', '' ) )
478
-						->setTitle( $request->query->get( 'title', '' ) )
479
-						->setCountry( $request->query->get( 'country', '' ) )
480
-						->setCurrency( $request->query->get( 'currency', '' ) )
471
+					(new CreditCardPaymentNotificationRequest())
472
+						->setTransactionId($request->query->get('transactionId', ''))
473
+						->setDonationId((int)$request->query->get('donation_id', ''))
474
+						->setAmount(Euro::newFromCents((int)$request->query->get('amount')))
475
+						->setCustomerId($request->query->get('customerId', ''))
476
+						->setSessionId($request->query->get('sessionId', ''))
477
+						->setAuthId($request->query->get('auth', ''))
478
+						->setTitle($request->query->get('title', ''))
479
+						->setCountry($request->query->get('country', ''))
480
+						->setCurrency($request->query->get('currency', ''))
481 481
 				);
482 482
 
483 483
 			$response = CreditCardNotificationResponse::newSuccessResponse(
484
-				(int)$request->query->get( 'donation_id', '' ),
485
-				$request->query->get( 'token', '' )
484
+				(int)$request->query->get('donation_id', ''),
485
+				$request->query->get('token', '')
486 486
  			);
487
-		} catch ( CreditCardPaymentHandlerException $e ) {
488
-			$response = CreditCardNotificationResponse::newFailureResponse( $e->getMessage() );
487
+		} catch (CreditCardPaymentHandlerException $e) {
488
+			$response = CreditCardNotificationResponse::newFailureResponse($e->getMessage());
489 489
 		}
490 490
 
491
-		return new Response( $ffFactory->newCreditCardNotificationPresenter()->present( $response ) );
491
+		return new Response($ffFactory->newCreditCardNotificationPresenter()->present($response));
492 492
 	}
493 493
 );
494 494
 
495 495
 $app->get(
496 496
 	'donation-accepted',
497
-	function( Request $request ) use ( $app, $ffFactory ) {
497
+	function(Request $request) use ($app, $ffFactory) {
498 498
 
499
-		$eventHandler = $ffFactory->newDonationAcceptedEventHandler( $request->query->get( 'update_token', '' ) );
500
-		$result = $eventHandler->onDonationAccepted( (int)$request->query->get( 'donation_id', '' ) );
499
+		$eventHandler = $ffFactory->newDonationAcceptedEventHandler($request->query->get('update_token', ''));
500
+		$result = $eventHandler->onDonationAccepted((int)$request->query->get('donation_id', ''));
501 501
 
502 502
 		return $app->json(
503
-			$result === null ? [ 'status' => 'OK' ] : [ 'status' => 'ERR', 'message' => $result ]
503
+			$result === null ? ['status' => 'OK'] : ['status' => 'ERR', 'message' => $result]
504 504
 		);
505 505
 	}
506 506
 );
507 507
 
508 508
 $app->post(
509 509
 	'handle-paypal-membership-fee-payments',
510
-	function ( Request $request ) use ( $ffFactory ) {
511
-		return ( new PayPalNotificationHandlerForMembershipFee( $ffFactory ) )->handle( $request->request );
510
+	function(Request $request) use ($ffFactory) {
511
+		return (new PayPalNotificationHandlerForMembershipFee($ffFactory))->handle($request->request);
512 512
 	}
513 513
 );
514 514
 
515
-$app->get( '/', function ( Application $app, Request $request ) {
516
-	$app['session']->set( 'piwikTracking', array_filter(
515
+$app->get('/', function(Application $app, Request $request) {
516
+	$app['session']->set('piwikTracking', array_filter(
517 517
 			[
518
-				'paymentType' => $request->get( 'zahlweise', '' ),
519
-				'paymentAmount' => $request->get( 'betrag', '' ),
520
-				'paymentInterval' => $request->get( 'periode', '' )
518
+				'paymentType' => $request->get('zahlweise', ''),
519
+				'paymentAmount' => $request->get('betrag', ''),
520
+				'paymentInterval' => $request->get('periode', '')
521 521
 			],
522
-			function ( string $value ) {
523
-				return $value !== '' && strlen( $value ) < 20;
522
+			function(string $value) {
523
+				return $value !== '' && strlen($value) < 20;
524 524
 			} )
525 525
 	);
526 526
 
@@ -535,43 +535,43 @@  discard block
 block discarded – undo
535 535
 		),
536 536
 		HttpKernelInterface::SUB_REQUEST
537 537
 	);
538
-} )->bind( '/' );
538
+} )->bind('/');
539 539
 
540 540
 // TODO Figure out how to rewrite with Nginx
541 541
 // See https://serverfault.com/questions/805881/nginx-populate-request-uri-with-rewritten-url
542 542
 $app->post(
543 543
 	'/spenden/paypal_handler.php',
544
-	function ( Request $request ) use ( $ffFactory ) {
545
-		return ( new PayPalNotificationHandler( $ffFactory ) )->handle( $request );
544
+	function(Request $request) use ($ffFactory) {
545
+		return (new PayPalNotificationHandler($ffFactory))->handle($request);
546 546
 	}
547 547
 );
548 548
 
549 549
 // redirect display page requests from old URLs
550
-$app->get( '/spenden/{page}', function( Application $app, Request $request, string $page ) {
550
+$app->get('/spenden/{page}', function(Application $app, Request $request, string $page) {
551 551
 	// Poor man's rewrite until someone has figured out how to do this with Nginx without breaking REQUEST_URI
552 552
 	// See https://serverfault.com/questions/805881/nginx-populate-request-uri-with-rewritten-url
553
-	switch ( $page ) {
553
+	switch ($page) {
554 554
 		case 'Mitgliedschaft':
555
-			return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle( '/page/Membership_Application' );
555
+			return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle('/page/Membership_Application');
556 556
 		default:
557
-			return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle( '/page/' . $page );
557
+			return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle('/page/' . $page);
558 558
 	}
559
-} )->assert( 'page', '[a-zA-Z_\-\s\x7f-\xff]+' );
559
+} )->assert('page', '[a-zA-Z_\-\s\x7f-\xff]+');
560 560
 
561 561
 // redirect different formats of comment lists
562
-$app->get( '/spenden/{outputFormat}.php', function( Application $app, Request $request, string $outputFormat ) {
563
-	return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle(
564
-		'/list-comments.' . ( $outputFormat === 'list' ? 'html' : $outputFormat )
562
+$app->get('/spenden/{outputFormat}.php', function(Application $app, Request $request, string $outputFormat) {
563
+	return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle(
564
+		'/list-comments.' . ($outputFormat === 'list' ? 'html' : $outputFormat)
565 565
 	);
566
-} )->assert( 'outputFormat', 'list|rss|json' );
566
+} )->assert('outputFormat', 'list|rss|json');
567 567
 
568 568
 // redirect all other calls to default route
569
-$app->get( '/spenden{page}', function( Application $app, Request $request ) {
570
-	return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle( '/' );
571
-} )->assert( 'page', '/?([a-z]+\.php)?' );
569
+$app->get('/spenden{page}', function(Application $app, Request $request) {
570
+	return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle('/');
571
+} )->assert('page', '/?([a-z]+\.php)?');
572 572
 
573
-$app->get( '/purge-cache', function( Request $request ) use ( $ffFactory ) {
574
-	$response = $ffFactory->newAuthorizedCachePurger()->purgeCache( $request->query->get( 'secret', '' ) );
573
+$app->get('/purge-cache', function(Request $request) use ($ffFactory) {
574
+	$response = $ffFactory->newAuthorizedCachePurger()->purgeCache($request->query->get('secret', ''));
575 575
 
576 576
 	return new Response(
577 577
 		[
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 	);
583 583
 } );
584 584
 
585
-$app->get( 'status', function() {
585
+$app->get('status', function() {
586 586
 	return 'Status: OK (Online)';
587 587
 } );
588 588
 
Please login to merge, or discard this patch.
app/RouteHandlers/ShowDonationConfirmationHandler.php 1 patch
Spacing   +14 added lines, -14 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\App\RouteHandlers;
6 6
 
@@ -23,36 +23,36 @@  discard block
 block discarded – undo
23 23
 
24 24
 	private $ffFactory;
25 25
 
26
-	public function __construct( FunFunFactory $ffFactory ) {
26
+	public function __construct(FunFunFactory $ffFactory) {
27 27
 		$this->ffFactory = $ffFactory;
28 28
 	}
29 29
 
30
-	public function handle( Request $request, array $sessionTrackingData ): Response {
31
-		$useCase = $this->ffFactory->newShowDonationConfirmationUseCase( $request->get( 'accessToken', '' ) );
30
+	public function handle(Request $request, array $sessionTrackingData): Response {
31
+		$useCase = $this->ffFactory->newShowDonationConfirmationUseCase($request->get('accessToken', ''));
32 32
 
33
-		$responseModel = $useCase->showConfirmation( new ShowDonationConfirmationRequest(
34
-			(int)$request->get( 'id', '' )
35
-		) );
33
+		$responseModel = $useCase->showConfirmation(new ShowDonationConfirmationRequest(
34
+			(int)$request->get('id', '')
35
+		));
36 36
 
37
-		if ( !$responseModel->accessIsPermitted() ) {
38
-			throw new AccessDeniedException( 'access_denied_donation_confirmation' );
37
+		if (!$responseModel->accessIsPermitted()) {
38
+			throw new AccessDeniedException('access_denied_donation_confirmation');
39 39
 		}
40 40
 
41 41
 		$selectedConfirmationPage = $this->ffFactory->getDonationConfirmationPageSelector()->selectPage();
42 42
 		$httpResponse = new Response(
43
-			$this->ffFactory->newDonationConfirmationPresenter( $selectedConfirmationPage->getPageTitle() )->present(
43
+			$this->ffFactory->newDonationConfirmationPresenter($selectedConfirmationPage->getPageTitle())->present(
44 44
 				$responseModel->getDonation(),
45 45
 				$responseModel->getUpdateToken(),
46
-				$request->get( 'accessToken', '' ),
46
+				$request->get('accessToken', ''),
47 47
 				$selectedConfirmationPage,
48
-				PiwikVariableCollector::newForDonation( $sessionTrackingData, $responseModel->getDonation() )
48
+				PiwikVariableCollector::newForDonation($sessionTrackingData, $responseModel->getDonation())
49 49
 			)
50 50
 		);
51 51
 
52
-		if ( !$request->cookies->get( self::SUBMISSION_COOKIE_NAME ) ) {
52
+		if (!$request->cookies->get(self::SUBMISSION_COOKIE_NAME)) {
53 53
 			$cookie = $this->ffFactory->getCookieBuilder();
54 54
 			$httpResponse->headers->setCookie(
55
-				$cookie->newCookie( self::SUBMISSION_COOKIE_NAME, date( self::TIMESTAMP_FORMAT ) )
55
+				$cookie->newCookie(self::SUBMISSION_COOKIE_NAME, date(self::TIMESTAMP_FORMAT))
56 56
 			);
57 57
 		}
58 58
 		return $httpResponse;
Please login to merge, or discard this patch.