Completed
Push — master ( 568a86...0cb4dd )
by Jeroen De
77:25 queued 77:18
created
src/Factories/FunFunFactory.php 1 patch
Spacing   +179 added lines, -179 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
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	private $profiler = null;
181 181
 
182
-	public function __construct( array $config ) {
182
+	public function __construct(array $config) {
183 183
 		$this->config = $config;
184 184
 		$this->pimple = $this->newPimple();
185 185
 	}
@@ -200,15 +200,15 @@  discard block
 block discarded – undo
200 200
 		};
201 201
 
202 202
 		$pimple['dbal_connection'] = function() {
203
-			return DriverManager::getConnection( $this->config['db'] );
203
+			return DriverManager::getConnection($this->config['db']);
204 204
 		};
205 205
 
206 206
 		$pimple['entity_manager'] = function() {
207
-			$entityManager = ( new StoreFactory( $this->getConnection(), $this->getVarPath() . '/doctrine_proxies' ) )
207
+			$entityManager = (new StoreFactory($this->getConnection(), $this->getVarPath() . '/doctrine_proxies'))
208 208
 				->getEntityManager();
209
-			if ( $this->addDoctrineSubscribers ) {
210
-				$entityManager->getEventManager()->addEventSubscriber( $this->newDoctrineDonationPrePersistSubscriber() );
211
-				$entityManager->getEventManager()->addEventSubscriber( $this->newDoctrineMembershipApplicationPrePersistSubscriber() );
209
+			if ($this->addDoctrineSubscribers) {
210
+				$entityManager->getEventManager()->addEventSubscriber($this->newDoctrineDonationPrePersistSubscriber());
211
+				$entityManager->getEventManager()->addEventSubscriber($this->newDoctrineMembershipApplicationPrePersistSubscriber());
212 212
 			}
213 213
 
214 214
 			return $entityManager;
@@ -216,53 +216,53 @@  discard block
 block discarded – undo
216 216
 
217 217
 		$pimple['subscription_repository'] = function() {
218 218
 			return new LoggingSubscriptionRepository(
219
-				new DoctrineSubscriptionRepository( $this->getEntityManager() ),
219
+				new DoctrineSubscriptionRepository($this->getEntityManager()),
220 220
 				$this->getLogger()
221 221
 			);
222 222
 		};
223 223
 
224 224
 		$pimple['donation_repository'] = function() {
225 225
 			return new LoggingDonationRepository(
226
-				new DoctrineDonationRepository( $this->getEntityManager() ),
226
+				new DoctrineDonationRepository($this->getEntityManager()),
227 227
 				$this->getLogger()
228 228
 			);
229 229
 		};
230 230
 
231 231
 		$pimple['membership_application_repository'] = function() {
232 232
 			return new LoggingApplicationRepository(
233
-				new DoctrineApplicationRepository( $this->getEntityManager() ),
233
+				new DoctrineApplicationRepository($this->getEntityManager()),
234 234
 				$this->getLogger()
235 235
 			);
236 236
 		};
237 237
 
238 238
 		$pimple['comment_repository'] = function() {
239 239
 			$finder = new LoggingCommentFinder(
240
-				new DoctrineCommentFinder( $this->getEntityManager() ),
240
+				new DoctrineCommentFinder($this->getEntityManager()),
241 241
 				$this->getLogger()
242 242
 			);
243 243
 
244
-			return $this->addProfilingDecorator( $finder, 'CommentFinder' );
244
+			return $this->addProfilingDecorator($finder, 'CommentFinder');
245 245
 		};
246 246
 
247 247
 		$pimple['mail_validator'] = function() {
248
-			return new EmailValidator( new InternetDomainNameValidator() );
248
+			return new EmailValidator(new InternetDomainNameValidator());
249 249
 		};
250 250
 
251 251
 		$pimple['subscription_validator'] = function() {
252 252
 			return new SubscriptionValidator(
253 253
 				$this->getEmailValidator(),
254
-				$this->newTextPolicyValidator( 'fields' ),
254
+				$this->newTextPolicyValidator('fields'),
255 255
 				$this->newSubscriptionDuplicateValidator(),
256 256
 				$this->newHonorificValidator()
257 257
 			);
258 258
 		};
259 259
 
260 260
 		$pimple['template_name_validator'] = function() {
261
-			return new TemplateNameValidator( $this->getTwig() );
261
+			return new TemplateNameValidator($this->getTwig());
262 262
 		};
263 263
 
264 264
 		$pimple['contact_validator'] = function() {
265
-			return new GetInTouchValidator( $this->getEmailValidator() );
265
+			return new GetInTouchValidator($this->getEmailValidator());
266 266
 		};
267 267
 
268 268
 		$pimple['greeting_generator'] = function() {
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 			];
277 277
 			$locale = $this->config['locale'];
278 278
 			$messagesPath = $this->getI18nDirectory() . $this->config['translation']['message-dir'];
279
-			$translator = $translationFactory->create( $loaders, $locale );
279
+			$translator = $translationFactory->create($loaders, $locale);
280 280
 			foreach ($this->config['translation']['files'] as $domain => $file) {
281
-				$translator->addResource( 'json', $messagesPath . '/' . $file, $locale, $domain );
281
+				$translator->addResource('json', $messagesPath . '/' . $file, $locale, $domain);
282 282
 			}
283 283
 
284 284
 			return $translator;
@@ -286,15 +286,15 @@  discard block
 block discarded – undo
286 286
 
287 287
 		// In the future, this could be locale-specific or filled from a DB table
288 288
 		$pimple['honorifics'] = function() {
289
-			return new Honorifics( [
289
+			return new Honorifics([
290 290
 				'' => 'Kein Titel',
291 291
 				'Dr.' => 'Dr.',
292 292
 				'Prof.' => 'Prof.',
293 293
 				'Prof. Dr.' => 'Prof. Dr.'
294
-			] );
294
+			]);
295 295
 		};
296 296
 
297
-		$pimple['twig_factory'] = function () {
297
+		$pimple['twig_factory'] = function() {
298 298
 			return new TwigFactory(
299 299
 				array_merge_recursive(
300 300
 					$this->config['twig'],
@@ -309,12 +309,12 @@  discard block
 block discarded – undo
309 309
 			$twigFactory = $this->getTwigFactory();
310 310
 			$configurator = $twigFactory->newTwigEnvironmentConfigurator();
311 311
 
312
-			$loaders = array_filter( [
312
+			$loaders = array_filter([
313 313
 				$twigFactory->newFileSystemLoader(),
314 314
 				$twigFactory->newArrayLoader(), // This is just a fallback for testing
315
-			] );
315
+			]);
316 316
 			$extensions = [
317
-				$twigFactory->newTranslationExtension( $this->getTranslator() ),
317
+				$twigFactory->newTranslationExtension($this->getTranslator()),
318 318
 				new Twig_Extensions_Extension_Intl()
319 319
 			];
320 320
 			$filters = [
@@ -325,21 +325,21 @@  discard block
 block discarded – undo
325 325
 			$functions = [
326 326
 				new Twig_SimpleFunction(
327 327
 					'web_content',
328
-					function( string $name, array $context = [] ) {
329
-						return $this->getContentProvider()->getWeb( $name, $context );
328
+					function(string $name, array $context = []) {
329
+						return $this->getContentProvider()->getWeb($name, $context);
330 330
 					},
331
-					[ 'is_safe' => [ 'html' ] ]
331
+					['is_safe' => ['html']]
332 332
 				),
333 333
 				new Twig_SimpleFunction(
334 334
 					'mail_content',
335
-					function( string $name, array $context = [] ) {
336
-						return $this->getContentProvider()->getMail( $name, $context );
335
+					function(string $name, array $context = []) {
336
+						return $this->getContentProvider()->getMail($name, $context);
337 337
 					},
338
-					[ 'is_safe' => [ 'all' ] ]
338
+					['is_safe' => ['all']]
339 339
 				)
340 340
 			];
341 341
 
342
-			return $configurator->getEnvironment( $this->pimple['twig_environment'], $loaders, $extensions, $filters, $functions );
342
+			return $configurator->getEnvironment($this->pimple['twig_environment'], $loaders, $extensions, $filters, $functions);
343 343
 		};
344 344
 
345 345
 		$pimple['messenger_suborganization'] = function() {
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 		};
360 360
 
361 361
 		$pimple['confirmation-page-selector'] = function() {
362
-			return new DonationConfirmationPageSelector( $this->config['confirmation-pages'] );
362
+			return new DonationConfirmationPageSelector($this->config['confirmation-pages']);
363 363
 		};
364 364
 
365 365
 		$pimple['paypal-payment-notification-verifier'] = function() {
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 		$pimple['token_generator'] = function() {
399 399
 			return new RandomTokenGenerator(
400 400
 				$this->config['token-length'],
401
-				new \DateInterval( $this->config['token-validity-timestamp'] )
401
+				new \DateInterval($this->config['token-validity-timestamp'])
402 402
 			);
403 403
 		};
404 404
 
@@ -410,38 +410,38 @@  discard block
 block discarded – undo
410 410
 			return new VoidCache();
411 411
 		};
412 412
 
413
-		$pimple['page_view_tracker'] = function () {
414
-			return new PageViewTracker( $this->newServerSideTracker(), $this->config['piwik']['siteUrlBase'] );
413
+		$pimple['page_view_tracker'] = function() {
414
+			return new PageViewTracker($this->newServerSideTracker(), $this->config['piwik']['siteUrlBase']);
415 415
 		};
416 416
 
417
-		$pimple['cachebusting_fileprefixer'] = function () {
418
-			return new FilePrefixer( $this->getFilePrefix() );
417
+		$pimple['cachebusting_fileprefixer'] = function() {
418
+			return new FilePrefixer($this->getFilePrefix());
419 419
 		};
420 420
 
421
-		$pimple['content_page_selector'] = function () {
422
-			$json = (new SimpleFileFetcher())->fetchFile( $this->getI18nDirectory() . '/data/pages.json' );
423
-			$config = json_decode( $json, true ) ?? [];
421
+		$pimple['content_page_selector'] = function() {
422
+			$json = (new SimpleFileFetcher())->fetchFile($this->getI18nDirectory() . '/data/pages.json');
423
+			$config = json_decode($json, true) ?? [];
424 424
 
425
-			return new PageSelector( $config );
425
+			return new PageSelector($config);
426 426
 		};
427 427
 
428
-		$pimple['content_provider'] = function () {
429
-			return new ContentProvider( [
428
+		$pimple['content_provider'] = function() {
429
+			return new ContentProvider([
430 430
 				'content_path' => $this->getI18nDirectory(),
431 431
 				'cache' => $this->config['twig']['enable-cache'] ? $this->getCachePath() . '/content' : false,
432 432
 				'globals' => [
433 433
 					'basepath' => $this->config['web-basepath']
434 434
 				]
435
-			] );
435
+			]);
436 436
 		};
437 437
 
438 438
 		$pimple['payment-delay-calculator'] = function() {
439
-			return new DefaultPaymentDelayCalculator( $this->getPayPalUrlConfigForMembershipApplications()->getDelayInDays() );
439
+			return new DefaultPaymentDelayCalculator($this->getPayPalUrlConfigForMembershipApplications()->getDelayInDays());
440 440
 		};
441 441
 
442
-		$pimple['sofort-client'] = function () {
442
+		$pimple['sofort-client'] = function() {
443 443
 			$config = $this->config['sofort'];
444
-			return new SofortClient( $config['config-key'] );
444
+			return new SofortClient($config['config-key']);
445 445
 		};
446 446
 
447 447
 		return $pimple;
@@ -457,17 +457,17 @@  discard block
 block discarded – undo
457 457
 
458 458
 	private function newDonationEventLogger(): DonationEventLogger {
459 459
 		return new BestEffortDonationEventLogger(
460
-			new DoctrineDonationEventLogger( $this->getEntityManager() ),
460
+			new DoctrineDonationEventLogger($this->getEntityManager()),
461 461
 			$this->getLogger()
462 462
 		);
463 463
 	}
464 464
 
465 465
 	public function newInstaller(): Installer {
466
-		return ( new StoreFactory( $this->getConnection() ) )->newInstaller();
466
+		return (new StoreFactory($this->getConnection()))->newInstaller();
467 467
 	}
468 468
 
469 469
 	public function newListCommentsUseCase(): ListCommentsUseCase {
470
-		return new ListCommentsUseCase( $this->getCommentFinder() );
470
+		return new ListCommentsUseCase($this->getCommentFinder());
471 471
 	}
472 472
 
473 473
 	public function newCommentListJsonPresenter(): CommentListJsonPresenter {
@@ -475,14 +475,14 @@  discard block
 block discarded – undo
475 475
 	}
476 476
 
477 477
 	public function newCommentListRssPresenter(): CommentListRssPresenter {
478
-		return new CommentListRssPresenter( new TwigTemplate(
478
+		return new CommentListRssPresenter(new TwigTemplate(
479 479
 			$this->getTwig(),
480 480
 			'Comment_List.rss.twig'
481
-		) );
481
+		));
482 482
 	}
483 483
 
484 484
 	public function newCommentListHtmlPresenter(): CommentListHtmlPresenter {
485
-		return new CommentListHtmlPresenter( $this->getLayoutTemplate( 'Comment_List.html.twig', [ 'piwikGoals' => [ 1 ] ] ) );
485
+		return new CommentListHtmlPresenter($this->getLayoutTemplate('Comment_List.html.twig', ['piwikGoals' => [1]]));
486 486
 	}
487 487
 
488 488
 	private function getCommentFinder(): CommentFinder {
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 		return $this->pimple['subscription_repository'];
494 494
 	}
495 495
 
496
-	public function setSubscriptionRepository( SubscriptionRepository $subscriptionRepository ) {
496
+	public function setSubscriptionRepository(SubscriptionRepository $subscriptionRepository) {
497 497
 		$this->pimple['subscription_repository'] = $subscriptionRepository;
498 498
 	}
499 499
 
@@ -510,25 +510,25 @@  discard block
 block discarded – undo
510 510
 	}
511 511
 
512 512
 	public function newAddSubscriptionHtmlPresenter(): AddSubscriptionHtmlPresenter {
513
-		return new AddSubscriptionHtmlPresenter( $this->getLayoutTemplate( 'Subscription_Form.html.twig' ), $this->getTranslator() );
513
+		return new AddSubscriptionHtmlPresenter($this->getLayoutTemplate('Subscription_Form.html.twig'), $this->getTranslator());
514 514
 	}
515 515
 
516 516
 	public function newConfirmSubscriptionHtmlPresenter(): ConfirmSubscriptionHtmlPresenter {
517 517
 		return new ConfirmSubscriptionHtmlPresenter(
518
-			$this->getLayoutTemplate( 'Confirm_Subscription.twig' ),
518
+			$this->getLayoutTemplate('Confirm_Subscription.twig'),
519 519
 			$this->getTranslator()
520 520
 		);
521 521
 	}
522 522
 
523 523
 	public function newAddSubscriptionJsonPresenter(): AddSubscriptionJsonPresenter {
524
-		return new AddSubscriptionJsonPresenter( $this->getTranslator() );
524
+		return new AddSubscriptionJsonPresenter($this->getTranslator());
525 525
 	}
526 526
 
527 527
 	public function newGetInTouchHtmlPresenter(): GetInTouchHtmlPresenter {
528
-		return new GetInTouchHtmlPresenter( $this->getLayoutTemplate( 'contact_form.html.twig' ), $this->getTranslator() );
528
+		return new GetInTouchHtmlPresenter($this->getLayoutTemplate('contact_form.html.twig'), $this->getTranslator());
529 529
 	}
530 530
 
531
-	public function setTwigEnvironment( Twig_Environment $twig ) {
531
+	public function setTwigEnvironment(Twig_Environment $twig) {
532 532
 		$this->pimple['twig_environment'] = $twig;
533 533
 	}
534 534
 
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
 	 * @param array $context Additional variables for the template
544 544
 	 * @return TwigTemplate
545 545
 	 */
546
-	public function getLayoutTemplate( string $templateName, array $context = [] ): TwigTemplate {
546
+	public function getLayoutTemplate(string $templateName, array $context = []): TwigTemplate {
547 547
 		 return new TwigTemplate(
548 548
 			$this->getTwig(),
549 549
 			$templateName,
550
-			array_merge( $this->getDefaultTwigVariables(), $context )
550
+			array_merge($this->getDefaultTwigVariables(), $context)
551 551
 		);
552 552
 	}
553 553
 
@@ -559,13 +559,13 @@  discard block
 block discarded – undo
559 559
 	 * @param string $templateName Template to include
560 560
 	 * @return TwigTemplate
561 561
 	 */
562
-	private function getIncludeTemplate( string $templateName, array $context = [] ): TwigTemplate {
562
+	private function getIncludeTemplate(string $templateName, array $context = []): TwigTemplate {
563 563
 		return new TwigTemplate(
564 564
 			$this->getTwig(),
565 565
 			'Include_in_Layout.twig',
566 566
 			array_merge(
567 567
 				$this->getDefaultTwigVariables(),
568
-				[ 'main_template' => $templateName ],
568
+				['main_template' => $templateName],
569 569
 				$context
570 570
 			)
571 571
 		);
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 			new TwigTemplate(
649 649
 					$this->getTwig(),
650 650
 					'Mail_Subscription_Confirmation.txt.twig',
651
-					[ 'greeting_generator' => $this->getGreetingGenerator() ]
651
+					['greeting_generator' => $this->getGreetingGenerator()]
652 652
 			),
653 653
 			'mail_subject_subscription_confirmed'
654 654
 		);
@@ -660,16 +660,16 @@  discard block
 block discarded – undo
660 660
 	 * So much decoration going on that explicitly hinting what we return (Robustness principle) would be confusing
661 661
 	 * (you'd expect a TemplateBasedMailer, not a LoggingMailer), so we hint the interface instead.
662 662
 	 */
663
-	private function newTemplateMailer( Messenger $messenger, TwigTemplate $template, string $messageKey ): TemplateMailerInterface {
663
+	private function newTemplateMailer(Messenger $messenger, TwigTemplate $template, string $messageKey): TemplateMailerInterface {
664 664
 		$mailer = new TemplateBasedMailer(
665 665
 			$messenger,
666 666
 			$template,
667
-			$this->getTranslator()->trans( $messageKey )
667
+			$this->getTranslator()->trans($messageKey)
668 668
 		);
669 669
 
670
-		$mailer = new LoggingMailer( $mailer, $this->getLogger() );
670
+		$mailer = new LoggingMailer($mailer, $this->getLogger());
671 671
 
672
-		return $this->addProfilingDecorator( $mailer, 'Mailer' );
672
+		return $this->addProfilingDecorator($mailer, 'Mailer');
673 673
 	}
674 674
 
675 675
 	public function getGreetingGenerator() {
@@ -677,11 +677,11 @@  discard block
 block discarded – undo
677 677
 	}
678 678
 
679 679
 	public function newCheckIbanUseCase(): CheckIbanUseCase {
680
-		return new CheckIbanUseCase( $this->newBankDataConverter(), $this->newIbanValidator() );
680
+		return new CheckIbanUseCase($this->newBankDataConverter(), $this->newIbanValidator());
681 681
 	}
682 682
 
683 683
 	public function newGenerateIbanUseCase(): GenerateIbanUseCase {
684
-		return new GenerateIbanUseCase( $this->newBankDataConverter(), $this->newIbanValidator() );
684
+		return new GenerateIbanUseCase($this->newBankDataConverter(), $this->newIbanValidator());
685 685
 	}
686 686
 
687 687
 	public function newIbanPresenter(): IbanPresenter {
@@ -689,10 +689,10 @@  discard block
 block discarded – undo
689 689
 	}
690 690
 
691 691
 	public function newBankDataConverter() {
692
-		return new BankDataConverter( $this->config['bank-data-file'] );
692
+		return new BankDataConverter($this->config['bank-data-file']);
693 693
 	}
694 694
 
695
-	public function setSubscriptionValidator( SubscriptionValidator $subscriptionValidator ) {
695
+	public function setSubscriptionValidator(SubscriptionValidator $subscriptionValidator) {
696 696
 		$this->pimple['subscription_validator'] = $subscriptionValidator;
697 697
 	}
698 698
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	private function newContactUserMailer(): TemplateMailerInterface {
708 708
 		return $this->newTemplateMailer(
709 709
 			$this->getSuborganizationMessenger(),
710
-			new TwigTemplate( $this->getTwig(), 'Mail_Contact_Confirm_to_User.txt.twig' ),
710
+			new TwigTemplate($this->getTwig(), 'Mail_Contact_Confirm_to_User.txt.twig'),
711 711
 			'mail_subject_getintouch'
712 712
 		);
713 713
 	}
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 	private function newContactOperatorMailer(): OperatorMailer {
716 716
 		return new OperatorMailer(
717 717
 			$this->getSuborganizationMessenger(),
718
-			new TwigTemplate( $this->getTwig(), 'Mail_Contact_Forward_to_Operator.txt.twig' ),
719
-			$this->getTranslator()->trans( 'mail_subject_getintouch_forward' )
718
+			new TwigTemplate($this->getTwig(), 'Mail_Contact_Forward_to_Operator.txt.twig'),
719
+			$this->getTranslator()->trans('mail_subject_getintouch_forward')
720 720
 		);
721 721
 	}
722 722
 
@@ -733,12 +733,12 @@  discard block
 block discarded – undo
733 733
 
734 734
 	private function newSubscriptionDuplicateCutoffDate(): \DateTime {
735 735
 		$cutoffDateTime = new \DateTime();
736
-		$cutoffDateTime->sub( new \DateInterval( $this->config['subscription-interval'] ) );
736
+		$cutoffDateTime->sub(new \DateInterval($this->config['subscription-interval']));
737 737
 		return $cutoffDateTime;
738 738
 	}
739 739
 
740 740
 	private function newHonorificValidator(): AllowedValuesValidator {
741
-		return new AllowedValuesValidator( $this->getHonorifics()->getKeys() );
741
+		return new AllowedValuesValidator($this->getHonorifics()->getKeys());
742 742
 	}
743 743
 
744 744
 	private function getHonorifics(): Honorifics {
@@ -747,20 +747,20 @@  discard block
 block discarded – undo
747 747
 
748 748
 	public function newAuthorizedCachePurger(): AuthorizedCachePurger {
749 749
 		return new AuthorizedCachePurger(
750
-			new AllOfTheCachePurger( $this->getTwig(), $this->getPageCache(), $this->getRenderedPageCache() ),
750
+			new AllOfTheCachePurger($this->getTwig(), $this->getPageCache(), $this->getRenderedPageCache()),
751 751
 			$this->config['purging-secret']
752 752
 		);
753 753
 	}
754 754
 
755 755
 	private function newBankDataValidator(): BankDataValidator {
756
-		return new BankDataValidator( $this->newIbanValidator() );
756
+		return new BankDataValidator($this->newIbanValidator());
757 757
 	}
758 758
 
759 759
 	private function getSuborganizationMessenger(): Messenger {
760 760
 		return $this->pimple['messenger_suborganization'];
761 761
 	}
762 762
 
763
-	public function setSuborganizationMessenger( Messenger $messenger ) {
763
+	public function setSuborganizationMessenger(Messenger $messenger) {
764 764
 		$this->pimple['messenger_suborganization'] = $messenger;
765 765
 	}
766 766
 
@@ -768,42 +768,42 @@  discard block
 block discarded – undo
768 768
 		return $this->pimple['messenger_organization'];
769 769
 	}
770 770
 
771
-	public function setOrganizationMessenger( Messenger $messenger ) {
771
+	public function setOrganizationMessenger(Messenger $messenger) {
772 772
 		$this->pimple['messenger_organization'] = $messenger;
773 773
 	}
774 774
 
775 775
 	public function setNullMessenger() {
776
-		$this->setSuborganizationMessenger( new Messenger(
776
+		$this->setSuborganizationMessenger(new Messenger(
777 777
 			Swift_NullTransport::newInstance(),
778 778
 			$this->getSubOrganizationEmailAddress()
779
-		) );
780
-		$this->setOrganizationMessenger( new Messenger(
779
+		));
780
+		$this->setOrganizationMessenger(new Messenger(
781 781
 			Swift_NullTransport::newInstance(),
782 782
 			$this->getOrganizationEmailAddress()
783
-		) );
783
+		));
784 784
 	}
785 785
 
786 786
 	public function getSubOrganizationEmailAddress(): EmailAddress {
787
-		return new EmailAddress( $this->config['contact-info']['suborganization']['email'] );
787
+		return new EmailAddress($this->config['contact-info']['suborganization']['email']);
788 788
 	}
789 789
 
790 790
 	public function getOrganizationEmailAddress() {
791
-		return new EmailAddress( $this->config['contact-info']['organization']['email'] );
791
+		return new EmailAddress($this->config['contact-info']['organization']['email']);
792 792
 	}
793 793
 
794 794
 	public function newInternalErrorHtmlPresenter(): InternalErrorHtmlPresenter {
795
-		return new InternalErrorHtmlPresenter( $this->getIncludeTemplate( 'Error_Page.html.twig' ) );
795
+		return new InternalErrorHtmlPresenter($this->getIncludeTemplate('Error_Page.html.twig'));
796 796
 	}
797 797
 
798 798
 	public function newAccessDeniedHtmlPresenter(): InternalErrorHtmlPresenter {
799
-		return new InternalErrorHtmlPresenter( $this->getLayoutTemplate( 'Access_Denied.twig' ) );
799
+		return new InternalErrorHtmlPresenter($this->getLayoutTemplate('Access_Denied.twig'));
800 800
 	}
801 801
 
802 802
 	public function getTranslator(): TranslatorInterface {
803 803
 		return $this->pimple['translator'];
804 804
 	}
805 805
 
806
-	public function setTranslator( TranslatorInterface $translator ) {
806
+	public function setTranslator(TranslatorInterface $translator) {
807 807
 		$this->pimple['translator'] = $translator;
808 808
 	}
809 809
 
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 		return $this->pimple['twig_factory'];
812 812
 	}
813 813
 
814
-	private function newTextPolicyValidator( string $policyName ): TextPolicyValidator {
814
+	private function newTextPolicyValidator(string $policyName): TextPolicyValidator {
815 815
 		$fetcher = new ErrorLoggingFileFetcher(
816 816
 			new SimpleFileFetcher(),
817 817
 			$this->getLogger()
@@ -820,24 +820,24 @@  discard block
 block discarded – undo
820 820
 		return new TextPolicyValidator(
821 821
 			new WordListFileReader(
822 822
 				$fetcher,
823
-				$textPolicyConfig['badwords'] ? $this->getAbsolutePath( $textPolicyConfig['badwords'] ) : ''
823
+				$textPolicyConfig['badwords'] ? $this->getAbsolutePath($textPolicyConfig['badwords']) : ''
824 824
 			),
825 825
 			new WordListFileReader(
826 826
 				$fetcher,
827
-				$textPolicyConfig['whitewords'] ? $this->getAbsolutePath( $textPolicyConfig['whitewords'] ) : ''
827
+				$textPolicyConfig['whitewords'] ? $this->getAbsolutePath($textPolicyConfig['whitewords']) : ''
828 828
 			)
829 829
 		);
830 830
 	}
831 831
 
832 832
 	private function newCommentPolicyValidator(): TextPolicyValidator {
833
-		return $this->newTextPolicyValidator( 'comment' );
833
+		return $this->newTextPolicyValidator('comment');
834 834
 	}
835 835
 
836
-	public function newCancelDonationUseCase( string $updateToken ): CancelDonationUseCase {
836
+	public function newCancelDonationUseCase(string $updateToken): CancelDonationUseCase {
837 837
 		return new CancelDonationUseCase(
838 838
 			$this->getDonationRepository(),
839 839
 			$this->newCancelDonationMailer(),
840
-			$this->newDonationAuthorizer( $updateToken ),
840
+			$this->newDonationAuthorizer($updateToken),
841 841
 			$this->newDonationEventLogger()
842 842
 		);
843 843
 	}
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 			new TwigTemplate(
849 849
 				$this->getTwig(),
850 850
 				'Mail_Donation_Cancellation_Confirmation.txt.twig',
851
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
851
+				['greeting_generator' => $this->getGreetingGenerator()]
852 852
 			),
853 853
 			'mail_subject_confirm_cancellation'
854 854
 		);
@@ -906,19 +906,19 @@  discard block
 block discarded – undo
906 906
 	}
907 907
 
908 908
 	public function newPayPalUrlGeneratorForDonations() {
909
-		return new PayPalUrlGenerator( $this->getPayPalUrlConfigForDonations() );
909
+		return new PayPalUrlGenerator($this->getPayPalUrlConfigForDonations());
910 910
 	}
911 911
 
912 912
 	public function newPayPalUrlGeneratorForMembershipApplications() {
913
-		return new PayPalUrlGenerator( $this->getPayPalUrlConfigForMembershipApplications() );
913
+		return new PayPalUrlGenerator($this->getPayPalUrlConfigForMembershipApplications());
914 914
 	}
915 915
 
916 916
 	private function getPayPalUrlConfigForDonations() {
917
-		return PayPalConfig::newFromConfig( $this->config['paypal-donation'] );
917
+		return PayPalConfig::newFromConfig($this->config['paypal-donation']);
918 918
 	}
919 919
 
920 920
 	private function getPayPalUrlConfigForMembershipApplications() {
921
-		return PayPalConfig::newFromConfig( $this->config['paypal-membership'] );
921
+		return PayPalConfig::newFromConfig($this->config['paypal-membership']);
922 922
 	}
923 923
 
924 924
 	public function newSofortUrlGeneratorForDonations(): SofortUrlGenerator {
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 
927 927
 		return new SofortUrlGenerator(
928 928
 			new SofortConfig(
929
-				$this->getTranslator()->trans( 'item_name_donation', [], 'messages' ),
929
+				$this->getTranslator()->trans('item_name_donation', [], 'messages'),
930 930
 				$config['return-url'],
931 931
 				$config['cancel-url']
932 932
 			),
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
 		);
935 935
 	}
936 936
 
937
-	public function setSofortClient( SofortClient $client ): void {
937
+	public function setSofortClient(SofortClient $client): void {
938 938
 		$this->pimple['sofort-client'] = $client;
939 939
 	}
940 940
 
@@ -943,11 +943,11 @@  discard block
 block discarded – undo
943 943
 	}
944 944
 
945 945
 	private function newCreditCardUrlGenerator(): CreditCardUrlGenerator {
946
-		return new CreditCardUrlGenerator( $this->newCreditCardUrlConfig() );
946
+		return new CreditCardUrlGenerator($this->newCreditCardUrlConfig());
947 947
 	}
948 948
 
949 949
 	private function newCreditCardUrlConfig(): CreditCardConfig {
950
-		return CreditCardConfig::newFromConfig( $this->config['creditcard'] );
950
+		return CreditCardConfig::newFromConfig($this->config['creditcard']);
951 951
 	}
952 952
 
953 953
 	public function getDonationRepository(): DonationRepository {
@@ -963,23 +963,23 @@  discard block
 block discarded – undo
963 963
 	}
964 964
 
965 965
 	private function newAmountFormatter(): AmountFormatter {
966
-		return new AmountFormatter( $this->config['locale'] );
966
+		return new AmountFormatter($this->config['locale']);
967 967
 	}
968 968
 
969 969
 	public function newDecimalNumberFormatter(): NumberFormatter {
970
-		return new NumberFormatter( $this->config['locale'], NumberFormatter::DECIMAL );
970
+		return new NumberFormatter($this->config['locale'], NumberFormatter::DECIMAL);
971 971
 	}
972 972
 
973
-	public function newAddCommentUseCase( string $updateToken ): AddCommentUseCase {
973
+	public function newAddCommentUseCase(string $updateToken): AddCommentUseCase {
974 974
 		return new AddCommentUseCase(
975 975
 			$this->getDonationRepository(),
976
-			$this->newDonationAuthorizer( $updateToken ),
976
+			$this->newDonationAuthorizer($updateToken),
977 977
 			$this->newCommentPolicyValidator(),
978 978
 			$this->newAddCommentValidator()
979 979
 		);
980 980
 	}
981 981
 
982
-	private function newDonationAuthorizer( string $updateToken = null, string $accessToken = null ): DonationAuthorizer {
982
+	private function newDonationAuthorizer(string $updateToken = null, string $accessToken = null): DonationAuthorizer {
983 983
 		return new DoctrineDonationAuthorizer(
984 984
 			$this->getEntityManager(),
985 985
 			$updateToken,
@@ -993,13 +993,13 @@  discard block
 block discarded – undo
993 993
 
994 994
 	public function newDonationConfirmationPresenter() {
995 995
 		return new DonationConfirmationHtmlPresenter(
996
-			$this->getIncludeTemplate( 'Donation_Confirmation.html.twig', [ 'piwikGoals' => [ 3 ] ] )
996
+			$this->getIncludeTemplate('Donation_Confirmation.html.twig', ['piwikGoals' => [3]])
997 997
 		);
998 998
 	}
999 999
 
1000 1000
 	public function newCreditCardPaymentHtmlPresenter() {
1001 1001
 		return new CreditCardPaymentHtmlPresenter(
1002
-			$this->getIncludeTemplate( 'Credit_Card_Payment_Iframe.html.twig' ),
1002
+			$this->getIncludeTemplate('Credit_Card_Payment_Iframe.html.twig'),
1003 1003
 			$this->getTranslator(),
1004 1004
 			$this->newCreditCardUrlGenerator()
1005 1005
 		);
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 
1008 1008
 	public function newCancelDonationHtmlPresenter() {
1009 1009
 		return new CancelDonationHtmlPresenter(
1010
-			$this->getIncludeTemplate( 'Donation_Cancellation_Confirmation.html.twig' )
1010
+			$this->getIncludeTemplate('Donation_Cancellation_Confirmation.html.twig')
1011 1011
 		);
1012 1012
 	}
1013 1013
 
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 			new TwigTemplate(
1031 1031
 				$this->getTwig(),
1032 1032
 				'Mail_Membership_Application_Confirmation.txt.twig',
1033
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
1033
+				['greeting_generator' => $this->getGreetingGenerator()]
1034 1034
 			),
1035 1035
 			'mail_subject_confirm_membership_application'
1036 1036
 		);
@@ -1045,31 +1045,31 @@  discard block
 block discarded – undo
1045 1045
 	}
1046 1046
 
1047 1047
 	private function newMembershipApplicationTracker(): ApplicationTracker {
1048
-		return new DoctrineApplicationTracker( $this->getEntityManager() );
1048
+		return new DoctrineApplicationTracker($this->getEntityManager());
1049 1049
 	}
1050 1050
 
1051 1051
 	private function newMembershipApplicationPiwikTracker(): ApplicationPiwikTracker {
1052
-		return new DoctrineApplicationPiwikTracker( $this->getEntityManager() );
1052
+		return new DoctrineApplicationPiwikTracker($this->getEntityManager());
1053 1053
 	}
1054 1054
 
1055 1055
 	private function getPaymentDelayCalculator() {
1056 1056
 		return $this->pimple['payment-delay-calculator'];
1057 1057
 	}
1058 1058
 
1059
-	public function setPaymentDelayCalculator( PaymentDelayCalculator $paymentDelayCalculator ) {
1059
+	public function setPaymentDelayCalculator(PaymentDelayCalculator $paymentDelayCalculator) {
1060 1060
 		$this->pimple['payment-delay-calculator'] = $paymentDelayCalculator;
1061 1061
 	}
1062 1062
 
1063 1063
 	private function newApplyForMembershipPolicyValidator(): ApplyForMembershipPolicyValidator {
1064 1064
 		return new ApplyForMembershipPolicyValidator(
1065
-			$this->newTextPolicyValidator( 'fields' ),
1065
+			$this->newTextPolicyValidator('fields'),
1066 1066
 			$this->config['email-address-blacklist']
1067 1067
 		);
1068 1068
 	}
1069 1069
 
1070
-	public function newCancelMembershipApplicationUseCase( string $updateToken ): CancelMembershipApplicationUseCase {
1070
+	public function newCancelMembershipApplicationUseCase(string $updateToken): CancelMembershipApplicationUseCase {
1071 1071
 		return new CancelMembershipApplicationUseCase(
1072
-			$this->newMembershipApplicationAuthorizer( $updateToken ),
1072
+			$this->newMembershipApplicationAuthorizer($updateToken),
1073 1073
 			$this->getMembershipApplicationRepository(),
1074 1074
 			$this->newCancelMembershipApplicationMailer()
1075 1075
 		);
@@ -1095,28 +1095,28 @@  discard block
 block discarded – undo
1095 1095
 			new TwigTemplate(
1096 1096
 				$this->getTwig(),
1097 1097
 				'Mail_Membership_Application_Cancellation_Confirmation.txt.twig',
1098
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
1098
+				['greeting_generator' => $this->getGreetingGenerator()]
1099 1099
 			),
1100 1100
 			'mail_subject_confirm_membership_application_cancellation'
1101 1101
 		);
1102 1102
 	}
1103 1103
 
1104
-	public function newMembershipApplicationConfirmationUseCase( string $accessToken ) {
1104
+	public function newMembershipApplicationConfirmationUseCase(string $accessToken) {
1105 1105
 		return new ShowMembershipApplicationConfirmationUseCase(
1106
-			$this->newMembershipApplicationAuthorizer( null, $accessToken ), $this->getMembershipApplicationRepository(),
1106
+			$this->newMembershipApplicationAuthorizer(null, $accessToken), $this->getMembershipApplicationRepository(),
1107 1107
 			$this->newMembershipApplicationTokenFetcher()
1108 1108
 		);
1109 1109
 	}
1110 1110
 
1111
-	public function newShowDonationConfirmationUseCase( string $accessToken ): ShowDonationConfirmationUseCase {
1111
+	public function newShowDonationConfirmationUseCase(string $accessToken): ShowDonationConfirmationUseCase {
1112 1112
 		return new ShowDonationConfirmationUseCase(
1113
-			$this->newDonationAuthorizer( null, $accessToken ),
1113
+			$this->newDonationAuthorizer(null, $accessToken),
1114 1114
 			$this->newDonationTokenFetcher(),
1115 1115
 			$this->getDonationRepository()
1116 1116
 		);
1117 1117
 	}
1118 1118
 
1119
-	public function setDonationConfirmationPageSelector( DonationConfirmationPageSelector $selector ) {
1119
+	public function setDonationConfirmationPageSelector(DonationConfirmationPageSelector $selector) {
1120 1120
 		$this->pimple['confirmation-page-selector'] = $selector;
1121 1121
 	}
1122 1122
 
@@ -1125,49 +1125,49 @@  discard block
 block discarded – undo
1125 1125
 	}
1126 1126
 
1127 1127
 	public function newDonationFormViolationPresenter() {
1128
-		return new DonationFormViolationPresenter( $this->getDonationFormTemplate(), $this->newAmountFormatter() );
1128
+		return new DonationFormViolationPresenter($this->getDonationFormTemplate(), $this->newAmountFormatter());
1129 1129
 	}
1130 1130
 
1131 1131
 	public function newDonationFormPresenter() {
1132
-		return new DonationFormPresenter( $this->getDonationFormTemplate(), $this->newAmountFormatter() );
1132
+		return new DonationFormPresenter($this->getDonationFormTemplate(), $this->newAmountFormatter());
1133 1133
 	}
1134 1134
 
1135 1135
 	private function getDonationFormTemplate(): TwigTemplate {
1136 1136
 		// TODO make the template name dependent on the 'form' value from the HTTP POST request
1137 1137
 		// (we need different form pages for A/B testing)
1138
-		return $this->getLayoutTemplate( 'Donation_Form.html.twig', [
1138
+		return $this->getLayoutTemplate('Donation_Form.html.twig', [
1139 1139
 			'paymentTypes' => $this->getEnabledDonationPaymentTypes()
1140
-		] );
1140
+		]);
1141 1141
 	}
1142 1142
 
1143 1143
 	private function getEnabledDonationPaymentTypes(): array {
1144
-		return array_keys( array_filter( $this->config['payment-types'], function ( $config ) {
1145
-			return ( $config['donation-enabled'] === true );
1146
-		} ) );
1144
+		return array_keys(array_filter($this->config['payment-types'], function($config) {
1145
+			return ($config['donation-enabled'] === true);
1146
+		} ));
1147 1147
 	}
1148 1148
 
1149
-	public function newHandlePayPalPaymentNotificationUseCase( string $updateToken ) {
1149
+	public function newHandlePayPalPaymentNotificationUseCase(string $updateToken) {
1150 1150
 		return new HandlePayPalPaymentNotificationUseCase(
1151 1151
 			$this->getDonationRepository(),
1152
-			$this->newDonationAuthorizer( $updateToken ),
1152
+			$this->newDonationAuthorizer($updateToken),
1153 1153
 			$this->newDonationConfirmationMailer(),
1154 1154
 			$this->newDonationEventLogger()
1155 1155
 		);
1156 1156
 	}
1157 1157
 
1158
-	public function newMembershipApplicationSubscriptionSignupNotificationUseCase( string $updateToken ) {
1158
+	public function newMembershipApplicationSubscriptionSignupNotificationUseCase(string $updateToken) {
1159 1159
 		return new HandleSubscriptionSignupNotificationUseCase(
1160 1160
 			$this->getMembershipApplicationRepository(),
1161
-			$this->newMembershipApplicationAuthorizer( $updateToken ),
1161
+			$this->newMembershipApplicationAuthorizer($updateToken),
1162 1162
 			$this->newApplyForMembershipMailer(),
1163 1163
 			$this->getLogger()
1164 1164
 		);
1165 1165
 	}
1166 1166
 
1167
-	public function newMembershipApplicationSubscriptionPaymentNotificationUseCase( string $updateToken ) {
1167
+	public function newMembershipApplicationSubscriptionPaymentNotificationUseCase(string $updateToken) {
1168 1168
 		return new HandleSubscriptionPaymentNotificationUseCase(
1169 1169
 			$this->getMembershipApplicationRepository(),
1170
-			$this->newMembershipApplicationAuthorizer( $updateToken ),
1170
+			$this->newMembershipApplicationAuthorizer($updateToken),
1171 1171
 			$this->newApplyForMembershipMailer(),
1172 1172
 			$this->getLogger()
1173 1173
 		);
@@ -1177,7 +1177,7 @@  discard block
 block discarded – undo
1177 1177
 		return $this->pimple['paypal-payment-notification-verifier'];
1178 1178
 	}
1179 1179
 
1180
-	public function setPayPalPaymentNotificationVerifier( PaymentNotificationVerifier $verifier ) {
1180
+	public function setPayPalPaymentNotificationVerifier(PaymentNotificationVerifier $verifier) {
1181 1181
 		$this->pimple['paypal-payment-notification-verifier'] = $verifier;
1182 1182
 	}
1183 1183
 
@@ -1185,14 +1185,14 @@  discard block
 block discarded – undo
1185 1185
 		return $this->pimple['paypal-membership-fee-notification-verifier'];
1186 1186
 	}
1187 1187
 
1188
-	public function setPayPalMembershipFeeNotificationVerifier( PaymentNotificationVerifier $verifier ) {
1188
+	public function setPayPalMembershipFeeNotificationVerifier(PaymentNotificationVerifier $verifier) {
1189 1189
 		$this->pimple['paypal-membership-fee-notification-verifier'] = $verifier;
1190 1190
 	}
1191 1191
 
1192
-	public function newCreditCardNotificationUseCase( string $updateToken ) {
1192
+	public function newCreditCardNotificationUseCase(string $updateToken) {
1193 1193
 		return new CreditCardNotificationUseCase(
1194 1194
 			$this->getDonationRepository(),
1195
-			$this->newDonationAuthorizer( $updateToken ),
1195
+			$this->newDonationAuthorizer($updateToken),
1196 1196
 			$this->getCreditCardService(),
1197 1197
 			$this->newDonationConfirmationMailer(),
1198 1198
 			$this->getLogger(),
@@ -1202,23 +1202,23 @@  discard block
 block discarded – undo
1202 1202
 
1203 1203
 	public function newCancelMembershipApplicationHtmlPresenter() {
1204 1204
 		return new CancelMembershipApplicationHtmlPresenter(
1205
-			$this->getIncludeTemplate( 'Membership_Application_Cancellation_Confirmation.html.twig' )
1205
+			$this->getIncludeTemplate('Membership_Application_Cancellation_Confirmation.html.twig')
1206 1206
 		);
1207 1207
 	}
1208 1208
 
1209 1209
 	public function newMembershipApplicationConfirmationHtmlPresenter() {
1210 1210
 		return new MembershipApplicationConfirmationHtmlPresenter(
1211
-			$this->getIncludeTemplate( 'Membership_Application_Confirmation.html.twig' )
1211
+			$this->getIncludeTemplate('Membership_Application_Confirmation.html.twig')
1212 1212
 		);
1213 1213
 	}
1214 1214
 
1215 1215
 	public function newMembershipFormViolationPresenter() {
1216 1216
 		return new MembershipFormViolationPresenter(
1217
-			$this->getLayoutTemplate( 'Membership_Application.html.twig' )
1217
+			$this->getLayoutTemplate('Membership_Application.html.twig')
1218 1218
 		);
1219 1219
 	}
1220 1220
 
1221
-	public function setCreditCardService( CreditCardService $ccService ) {
1221
+	public function setCreditCardService(CreditCardService $ccService) {
1222 1222
 		$this->pimple['credit-card-api-service'] = $ccService;
1223 1223
 	}
1224 1224
 
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 			new TwigTemplate(
1232 1232
 				$this->getTwig(),
1233 1233
 				'Credit_Card_Payment_Notification.txt.twig',
1234
-				[ 'returnUrl' => $this->config['creditcard']['return-url'] ]
1234
+				['returnUrl' => $this->config['creditcard']['return-url']]
1235 1235
 			)
1236 1236
 		);
1237 1237
 	}
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
 		);
1253 1253
 	}
1254 1254
 
1255
-	public function setTokenGenerator( TokenGenerator $tokenGenerator ) {
1255
+	public function setTokenGenerator(TokenGenerator $tokenGenerator) {
1256 1256
 		$this->pimple['token_generator'] = $tokenGenerator;
1257 1257
 	}
1258 1258
 
@@ -1275,23 +1275,23 @@  discard block
 block discarded – undo
1275 1275
 	private function newDonationPolicyValidator(): AddDonationPolicyValidator {
1276 1276
 		return new AddDonationPolicyValidator(
1277 1277
 			$this->newDonationAmountPolicyValidator(),
1278
-			$this->newTextPolicyValidator( 'fields' ),
1278
+			$this->newTextPolicyValidator('fields'),
1279 1279
 			$this->config['email-address-blacklist']
1280 1280
 		);
1281 1281
 	}
1282 1282
 
1283 1283
 	private function newDonationAmountPolicyValidator(): AmountPolicyValidator {
1284 1284
 		// in the future, this might come from the configuration
1285
-		return new AmountPolicyValidator( 1000, 1000 );
1285
+		return new AmountPolicyValidator(1000, 1000);
1286 1286
 	}
1287 1287
 
1288 1288
 	public function getDonationTimeframeLimit() {
1289 1289
 		return $this->config['donation-timeframe-limit'];
1290 1290
 	}
1291 1291
 
1292
-	public function newSystemMessageResponse( string $message ) {
1293
-		$test = $this->getIncludeTemplate( 'System_Message.html.twig' );
1294
-		return $test->render( [ 'message' => $message ] );
1292
+	public function newSystemMessageResponse(string $message) {
1293
+		$test = $this->getIncludeTemplate('System_Message.html.twig');
1294
+		return $test->render(['message' => $message]);
1295 1295
 	}
1296 1296
 
1297 1297
 	public function getMembershipApplicationTimeframeLimit() {
@@ -1312,37 +1312,37 @@  discard block
 block discarded – undo
1312 1312
 
1313 1313
 	public function enablePageCache() {
1314 1314
 		$this->pimple['page_cache'] = function() {
1315
-			return new FilesystemCache( $this->getCachePath() . '/pages/raw' );
1315
+			return new FilesystemCache($this->getCachePath() . '/pages/raw');
1316 1316
 		};
1317 1317
 
1318 1318
 		$this->pimple['rendered_page_cache'] = function() {
1319
-			return new FilesystemCache( $this->getCachePath() . '/pages/rendered' );
1319
+			return new FilesystemCache($this->getCachePath() . '/pages/rendered');
1320 1320
 		};
1321 1321
 	}
1322 1322
 
1323
-	private function addProfilingDecorator( $objectToDecorate, string $profilingLabel ) {
1324
-		if ( $this->profiler === null ) {
1323
+	private function addProfilingDecorator($objectToDecorate, string $profilingLabel) {
1324
+		if ($this->profiler === null) {
1325 1325
 			return $objectToDecorate;
1326 1326
 		}
1327 1327
 
1328
-		$builder = new ProfilingDecoratorBuilder( $this->profiler, $this->getProfilerDataCollector() );
1328
+		$builder = new ProfilingDecoratorBuilder($this->profiler, $this->getProfilerDataCollector());
1329 1329
 
1330
-		return $builder->decorate( $objectToDecorate, $profilingLabel );
1330
+		return $builder->decorate($objectToDecorate, $profilingLabel);
1331 1331
 	}
1332 1332
 
1333
-	public function setProfiler( Stopwatch $profiler ) {
1333
+	public function setProfiler(Stopwatch $profiler) {
1334 1334
 		$this->profiler = $profiler;
1335 1335
 	}
1336 1336
 
1337
-	public function setEmailValidator( EmailValidator $validator ) {
1337
+	public function setEmailValidator(EmailValidator $validator) {
1338 1338
 		$this->pimple['mail_validator'] = $validator;
1339 1339
 	}
1340 1340
 
1341
-	public function setLogger( LoggerInterface $logger ) {
1341
+	public function setLogger(LoggerInterface $logger) {
1342 1342
 		$this->pimple['logger'] = $logger;
1343 1343
 	}
1344 1344
 
1345
-	public function setPaypalLogger( LoggerInterface $logger ) {
1345
+	public function setPaypalLogger(LoggerInterface $logger) {
1346 1346
 		$this->pimple['paypal_logger'] = $logger;
1347 1347
 	}
1348 1348
 
@@ -1351,10 +1351,10 @@  discard block
 block discarded – undo
1351 1351
 	}
1352 1352
 
1353 1353
 	private function newIbanValidator(): IbanValidator {
1354
-		return new IbanValidator( $this->newBankDataConverter(), $this->config['banned-ibans'] );
1354
+		return new IbanValidator($this->newBankDataConverter(), $this->config['banned-ibans']);
1355 1355
 	}
1356 1356
 
1357
-	public function setFilePrefixer( FilePrefixer $prefixer ): void {
1357
+	public function setFilePrefixer(FilePrefixer $prefixer): void {
1358 1358
 		$this->pimple['cachebusting_fileprefixer'] = $prefixer;
1359 1359
 	}
1360 1360
 
@@ -1364,26 +1364,26 @@  discard block
 block discarded – undo
1364 1364
 
1365 1365
 	private function getFilePrefix(): string {
1366 1366
 		$prefixContentFile = $this->getVarPath() . '/file_prefix.txt';
1367
-		if ( !file_exists( $prefixContentFile ) ) {
1367
+		if (!file_exists($prefixContentFile)) {
1368 1368
 			return '';
1369 1369
 		}
1370
-		return $prefix = preg_replace( '/[^0-9a-f]/', '', file_get_contents( $prefixContentFile ) );
1370
+		return $prefix = preg_replace('/[^0-9a-f]/', '', file_get_contents($prefixContentFile));
1371 1371
 	}
1372 1372
 
1373
-	public function newDonationAcceptedEventHandler( string $updateToken ): DonationAcceptedEventHandler {
1373
+	public function newDonationAcceptedEventHandler(string $updateToken): DonationAcceptedEventHandler {
1374 1374
 		return new DonationAcceptedEventHandler(
1375
-			$this->newDonationAuthorizer( $updateToken ),
1375
+			$this->newDonationAuthorizer($updateToken),
1376 1376
 			$this->getDonationRepository(),
1377 1377
 			$this->newDonationConfirmationMailer()
1378 1378
 		);
1379 1379
 	}
1380 1380
 
1381 1381
 	public function newPageNotFoundHtmlPresenter(): PageNotFoundPresenter {
1382
-		return new PageNotFoundPresenter( $this->getLayoutTemplate( 'Page_not_found.html.twig' ) );
1382
+		return new PageNotFoundPresenter($this->getLayoutTemplate('Page_not_found.html.twig'));
1383 1383
 	}
1384 1384
 
1385
-	public function setPageViewTracker( PageViewTracker $tracker ) {
1386
-		$this->pimple['page_view_tracker'] = function () use ( $tracker )  {
1385
+	public function setPageViewTracker(PageViewTracker $tracker) {
1386
+		$this->pimple['page_view_tracker'] = function() use ($tracker)  {
1387 1387
 			return $tracker;
1388 1388
 		};
1389 1389
 	}
@@ -1396,25 +1396,25 @@  discard block
 block discarded – undo
1396 1396
 		// the "https:" prefix does NOT get any slashes because baseURL is stored in a protocol-agnostic way
1397 1397
 		// (e.g. "//tracking.wikimedia.de" )
1398 1398
 		return new PiwikServerSideTracker(
1399
-			new \PiwikTracker( $this->config['piwik']['siteId'], 'https:' . $this->config['piwik']['baseUrl'] )
1399
+			new \PiwikTracker($this->config['piwik']['siteId'], 'https:' . $this->config['piwik']['baseUrl'])
1400 1400
 		);
1401 1401
 	}
1402 1402
 
1403 1403
 	public function getI18nDirectory(): string {
1404
-		return $this->getAbsolutePath( $this->config['i18n-base-path'] ) . '/' . $this->config['locale'];
1404
+		return $this->getAbsolutePath($this->config['i18n-base-path']) . '/' . $this->config['locale'];
1405 1405
 	}
1406 1406
 
1407 1407
 	/**
1408 1408
 	 * If the pathname does not start with a slash, make the path absolute to root dir of application
1409 1409
 	 */
1410
-	private function getAbsolutePath( string $path ): string {
1411
-		if ( $path[0] === '/' ) {
1410
+	private function getAbsolutePath(string $path): string {
1411
+		if ($path[0] === '/') {
1412 1412
 			return $path;
1413 1413
 		}
1414 1414
 		return __DIR__ . '/../../' . $path;
1415 1415
 	}
1416 1416
 
1417
-	public function setContentPagePageSelector( PageSelector $pageSelector ): void {
1417
+	public function setContentPagePageSelector(PageSelector $pageSelector): void {
1418 1418
 		$this->pimple['content_page_selector'] = $pageSelector;
1419 1419
 	}
1420 1420
 
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 		return $this->pimple['content_page_selector'];
1423 1423
 	}
1424 1424
 
1425
-	public function setContentProvider( ContentProvider $contentProvider ): void {
1425
+	public function setContentProvider(ContentProvider $contentProvider): void {
1426 1426
 		$this->pimple['content_provider'] = $contentProvider;
1427 1427
 	}
1428 1428
 
Please login to merge, or discard this patch.
src/Presentation/Presenters/CreditCardPaymentHtmlPresenter.php 1 patch
Spacing   +8 added lines, -8 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
 
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
 	private $translator;
24 24
 	private $urlGenerator;
25 25
 
26
-	public function __construct( TwigTemplate $template, TranslatorInterface $translator,
27
-								CreditCardUrlGenerator $urlGenerator ) {
26
+	public function __construct(TwigTemplate $template, TranslatorInterface $translator,
27
+								CreditCardUrlGenerator $urlGenerator) {
28 28
 		$this->template = $template;
29 29
 		$this->translator = $translator;
30 30
 		$this->urlGenerator = $urlGenerator;
31 31
 	}
32 32
 
33
-	public function present( AddDonationResponse $response ): string {
34
-		return $this->template->render( $this->getArguments( $response ) );
33
+	public function present(AddDonationResponse $response): string {
34
+		return $this->template->render($this->getArguments($response));
35 35
 	}
36 36
 
37
-	private function getArguments( AddDonationResponse $response ) {
37
+	private function getArguments(AddDonationResponse $response) {
38 38
 		$personalInfo = $response->getDonation()->getDonor();
39 39
 		return [
40 40
 			'donation' => [
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 			'iframeUrl' => $this->urlGenerator->generateUrl(
45 45
 				$personalInfo ? $personalInfo->getName()->getFirstName() : '',
46 46
 				$personalInfo ? $personalInfo->getName()->getLastName() : '',
47
-				$this->translator->trans( 'paytext_cc', [], 'paymentIntervals' ) . ' ' .
48
-					$this->translator->trans( $response->getDonation()->getPaymentIntervalInMonths(), [], 'paymentIntervals' ),
47
+				$this->translator->trans('paytext_cc', [], 'paymentIntervals') . ' ' .
48
+					$this->translator->trans($response->getDonation()->getPaymentIntervalInMonths(), [], 'paymentIntervals'),
49 49
 				$response->getDonation()->getId(),
50 50
 				$response->getAccessToken(),
51 51
 				$response->getUpdateToken(),
Please login to merge, or discard this patch.
contexts/PaymentContext/src/Domain/PaymentUrlGenerator/CreditCard.php 1 patch
Spacing   +6 added lines, -6 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\PaymentContext\Domain\PaymentUrlGenerator;
6 6
 
@@ -14,12 +14,12 @@  discard block
 block discarded – undo
14 14
 
15 15
 	private $config;
16 16
 
17
-	public function __construct( CreditCardConfig $config ) {
17
+	public function __construct(CreditCardConfig $config) {
18 18
 		$this->config = $config;
19 19
 	}
20 20
 
21
-	public function generateUrl( string $firstName, string $lastName, string $payText, int $donationId,
22
-								 string $accessToken, string $updateToken, Euro $amount ) {
21
+	public function generateUrl(string $firstName, string $lastName, string $payText, int $donationId,
22
+								 string $accessToken, string $updateToken, Euro $amount) {
23 23
 		// TODO: implement sealed parameters (https://techdoc.micropayment.de/payment/payments/payments_en.html#id302721)
24 24
 		$baseUrl = $this->config->getBaseUrl();
25 25
 		$params = [
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 			'amount' => $amount->getEuroCents(),
36 36
 			'theme' => $this->config->getTheme()
37 37
 		];
38
-		if ( $this->config->isTestMode() ) {
38
+		if ($this->config->isTestMode()) {
39 39
 			$params['testmode'] = '1';
40 40
 		}
41 41
 
42
-		return $baseUrl . http_build_query( $params );
42
+		return $baseUrl . http_build_query($params);
43 43
 	}
44 44
 
45 45
 }
Please login to merge, or discard this patch.
contexts/PaymentContext/src/Domain/PaymentUrlGenerator/PayPalConfig.php 1 patch
Spacing   +10 added lines, -10 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\PaymentContext\Domain\PaymentUrlGenerator;
6 6
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	private $itemName;
27 27
 	private $delayInDays;
28 28
 
29
-	private function __construct( string $payPalAccountAddress, string $payPalBaseUrl, string $notifyUrl,
30
-								 string $returnUrl, string $cancelUrl, string $itemName, int $delayInDays ) {
29
+	private function __construct(string $payPalAccountAddress, string $payPalBaseUrl, string $notifyUrl,
30
+								 string $returnUrl, string $cancelUrl, string $itemName, int $delayInDays) {
31 31
 		$this->payPalAccountAddress = $payPalAccountAddress;
32 32
 		$this->payPalBaseUrl = $payPalBaseUrl;
33 33
 		$this->notifyUrl = $notifyUrl;
@@ -42,22 +42,22 @@  discard block
 block discarded – undo
42 42
 	 * @return PayPalConfig
43 43
 	 * @throws \RuntimeException
44 44
 	 */
45
-	public static function newFromConfig( array $config ): self {
46
-		return ( new self(
45
+	public static function newFromConfig(array $config): self {
46
+		return (new self(
47 47
 			$config[self::CONFIG_KEY_ACCOUNT_ADDRESS],
48 48
 			$config[self::CONFIG_KEY_BASE_URL],
49 49
 			$config[self::CONFIG_KEY_NOTIFY_URL],
50 50
 			$config[self::CONFIG_KEY_RETURN_URL],
51 51
 			$config[self::CONFIG_KEY_CANCEL_URL],
52 52
 			$config[self::CONFIG_KEY_ITEM_NAME],
53
-			isset( $config[self::CONFIG_KEY_DELAY_IN_DAYS] ) ? (int)$config[self::CONFIG_KEY_DELAY_IN_DAYS] : -1
54
-		) )->assertNoEmptyFields();
53
+			isset($config[self::CONFIG_KEY_DELAY_IN_DAYS]) ? (int)$config[self::CONFIG_KEY_DELAY_IN_DAYS] : -1
54
+		))->assertNoEmptyFields();
55 55
 	}
56 56
 
57 57
 	private function assertNoEmptyFields(): self {
58
-		foreach ( get_object_vars( $this ) as $fieldName => $fieldValue ) {
59
-			if ( empty( $fieldValue ) ) {
60
-				throw new \RuntimeException( "Configuration variable '$fieldName' can not be empty" );
58
+		foreach (get_object_vars($this) as $fieldName => $fieldValue) {
59
+			if (empty($fieldValue)) {
60
+				throw new \RuntimeException("Configuration variable '$fieldName' can not be empty");
61 61
 			}
62 62
 		}
63 63
 
Please login to merge, or discard this patch.
contexts/PaymentContext/src/Domain/PaymentUrlGenerator/Sofort.php 1 patch
Spacing   +13 added lines, -13 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\PaymentContext\Domain\PaymentUrlGenerator;
6 6
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	private $client;
27 27
 
28
-	public function __construct( SofortConfig $config, Client $client ) {
28
+	public function __construct(SofortConfig $config, Client $client) {
29 29
 		$this->config = $config;
30 30
 		$this->client = $client;
31 31
 	}
@@ -39,25 +39,25 @@  discard block
 block discarded – undo
39 39
 	 * @param string $accessToken A token to return to the payment process after completing the 3rd party process
40 40
 	 * @return string
41 41
 	 */
42
-	public function generateUrl( int $internalItemId, string $externalItemId, Euro $amount, string $accessToken ): string {
42
+	public function generateUrl(int $internalItemId, string $externalItemId, Euro $amount, string $accessToken): string {
43 43
 		$request = new Request();
44
-		$request->setAmount( $amount );
45
-		$request->setCurrencyCode( self::CURRENCY );
46
-		$request->setReasons( [ $this->config->getReasonText(), $externalItemId ] );
44
+		$request->setAmount($amount);
45
+		$request->setCurrencyCode(self::CURRENCY);
46
+		$request->setReasons([$this->config->getReasonText(), $externalItemId]);
47 47
 		$request->setSuccessUrl(
48
-			$this->config->getReturnUrl() . '?' . http_build_query( [
48
+			$this->config->getReturnUrl() . '?' . http_build_query([
49 49
 				'id' => $internalItemId,
50 50
 				'accessToken' => $accessToken
51
-			] )
51
+			])
52 52
 		);
53
-		$request->setAbortUrl( $this->config->getCancelUrl() );
53
+		$request->setAbortUrl($this->config->getCancelUrl());
54 54
 		// @todo To use in T167882
55
-		$request->setNotificationUrl( '' );
55
+		$request->setNotificationUrl('');
56 56
 
57 57
 		try {
58
-			$response = $this->client->get( $request );
59
-		} catch ( RuntimeException $exception ) {
60
-			throw new RuntimeException( 'Could not generate Sofort URL: ' . $exception->getMessage() );
58
+			$response = $this->client->get($request);
59
+		} catch (RuntimeException $exception) {
60
+			throw new RuntimeException('Could not generate Sofort URL: ' . $exception->getMessage());
61 61
 		}
62 62
 
63 63
 		return $response->getPaymentUrl();
Please login to merge, or discard this patch.
contexts/PaymentContext/src/Domain/PaymentUrlGenerator/SofortConfig.php 1 patch
Spacing   +2 added lines, -2 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\PaymentContext\Domain\PaymentUrlGenerator;
6 6
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	private $cancelUrl;
21 21
 
22
-	public function __construct( string $reasonText, string $returnUrl, string $cancelUrl ) {
22
+	public function __construct(string $reasonText, string $returnUrl, string $cancelUrl) {
23 23
 		$this->reasonText = $reasonText;
24 24
 		$this->returnUrl = $returnUrl;
25 25
 		$this->cancelUrl = $cancelUrl;
Please login to merge, or discard this patch.
contexts/PaymentContext/src/Domain/PaymentUrlGenerator/CreditCardConfig.php 1 patch
Spacing   +9 added lines, -9 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\PaymentContext\Domain\PaymentUrlGenerator;
6 6
 
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 	private $theme;
25 25
 	private $testMode;
26 26
 
27
-	private function __construct( string $baseUrl, string $projectId, string $backgroundColor, string $skin, string $theme,
28
-								  bool $testMode ) {
27
+	private function __construct(string $baseUrl, string $projectId, string $backgroundColor, string $skin, string $theme,
28
+								  bool $testMode) {
29 29
 		$this->baseUrl = $baseUrl;
30 30
 		$this->projectId = $projectId;
31 31
 		$this->backgroundColor = $backgroundColor;
@@ -39,21 +39,21 @@  discard block
 block discarded – undo
39 39
 	 * @return self
40 40
 	 * @throws \RuntimeException
41 41
 	 */
42
-	public static function newFromConfig( array $config ): self {
43
-		return ( new self(
42
+	public static function newFromConfig(array $config): self {
43
+		return (new self(
44 44
 			$config[self::CONFIG_KEY_BASE_URL],
45 45
 			$config[self::CONFIG_KEY_PROJECT_ID],
46 46
 			$config[self::CONFIG_KEY_BACKGROUND_COLOR],
47 47
 			$config[self::CONFIG_KEY_SKIN],
48 48
 			$config[self::CONFIG_KEY_THEME],
49 49
 			$config[self::CONFIG_KEY_TESTMODE]
50
-		) )->assertNoEmptyFields();
50
+		))->assertNoEmptyFields();
51 51
 	}
52 52
 
53 53
 	private function assertNoEmptyFields(): self {
54
-		foreach ( get_object_vars( $this ) as $fieldName => $fieldValue ) {
55
-			if ( !isset( $fieldValue ) || $fieldValue === '' ) {
56
-				throw new \RuntimeException( "Configuration variable '$fieldName' can not be empty" );
54
+		foreach (get_object_vars($this) as $fieldName => $fieldValue) {
55
+			if (!isset($fieldValue) || $fieldValue === '') {
56
+				throw new \RuntimeException("Configuration variable '$fieldName' can not be empty");
57 57
 			}
58 58
 		}
59 59
 
Please login to merge, or discard this patch.
contexts/PaymentContext/src/Domain/PaymentUrlGenerator/PayPal.php 1 patch
Spacing   +19 added lines, -19 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\PaymentContext\Domain\PaymentUrlGenerator;
6 6
 
@@ -20,23 +20,23 @@  discard block
 block discarded – undo
20 20
 
21 21
 	private $config;
22 22
 
23
-	public function __construct( PayPalConfig $config ) {
23
+	public function __construct(PayPalConfig $config) {
24 24
 		$this->config = $config;
25 25
 	}
26 26
 
27
-	public function generateUrl( int $itemId, Euro $amount, int $interval,
28
-								 string $updateToken, string $accessToken ): string {
27
+	public function generateUrl(int $itemId, Euro $amount, int $interval,
28
+								 string $updateToken, string $accessToken): string {
29 29
 
30 30
 		$params = array_merge(
31
-			$this->getIntervalDependentParameters( $amount, $interval ),
32
-			$this->getIntervalAgnosticParameters( $itemId, $updateToken, $accessToken ),
31
+			$this->getIntervalDependentParameters($amount, $interval),
32
+			$this->getIntervalAgnosticParameters($itemId, $updateToken, $accessToken),
33 33
 			$this->getPaymentDelayParameters()
34 34
 		);
35 35
 
36
-		return $this->config->getPayPalBaseUrl() . http_build_query( $params );
36
+		return $this->config->getPayPalBaseUrl() . http_build_query($params);
37 37
 	}
38 38
 
39
-	private function getIntervalAgnosticParameters( int $itemId, string $updateToken, string $accessToken ): array {
39
+	private function getIntervalAgnosticParameters(int $itemId, string $updateToken, string $accessToken): array {
40 40
 		return [
41 41
 			'business' => $this->config->getPayPalAccountAddress(),
42 42
 			'currency_code' => 'EUR',
@@ -46,33 +46,33 @@  discard block
 block discarded – undo
46 46
 			'notify_url' => $this->config->getNotifyUrl(),
47 47
 			'cancel_return' => $this->config->getCancelUrl(),
48 48
 			'return' => $this->config->getReturnUrl() . '?id=' . $itemId . '&accessToken=' . $accessToken,
49
-			'custom' => json_encode( [
49
+			'custom' => json_encode([
50 50
 				'sid' => $itemId,
51 51
 				'utoken' => $updateToken
52
-			] )
52
+			])
53 53
 		];
54 54
 	}
55 55
 
56 56
 	private function getPaymentDelayParameters() {
57
-		if ( $this->config->getDelayInDays() > 0 ) {
58
-			return $this->getDelayedSubscriptionParams( $this->config->getDelayInDays() );
57
+		if ($this->config->getDelayInDays() > 0) {
58
+			return $this->getDelayedSubscriptionParams($this->config->getDelayInDays());
59 59
 		}
60 60
 		return [];
61 61
 	}
62 62
 
63
-	private function getIntervalDependentParameters( Euro $amount, int $interval ): array {
64
-		if ( $interval > 0 ) {
65
-			return $this->getSubscriptionParams( $amount, $interval );
63
+	private function getIntervalDependentParameters(Euro $amount, int $interval): array {
64
+		if ($interval > 0) {
65
+			return $this->getSubscriptionParams($amount, $interval);
66 66
 		}
67 67
 
68
-		return $this->getSinglePaymentParams( $amount );
68
+		return $this->getSinglePaymentParams($amount);
69 69
 	}
70 70
 
71 71
 	/**
72 72
 	 * This method returns a set of parameters needed for recurring payments.
73 73
 	 * @link https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/wp_standard_overview/
74 74
 	 */
75
-	private function getSubscriptionParams( Euro $amount, int $interval ): array {
75
+	private function getSubscriptionParams(Euro $amount, int $interval): array {
76 76
 		return [
77 77
 			'cmd' => '_xclick-subscriptions',
78 78
 			'no_shipping' => '1',
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * trial periods supported by PayPal.
91 91
 	 * @link https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/wp_standard_overview/
92 92
 	 */
93
-	private function getDelayedSubscriptionParams( int $delayInDays ): array {
93
+	private function getDelayedSubscriptionParams(int $delayInDays): array {
94 94
 		return [
95 95
 			'a1' => 0,
96 96
 			'p1' => $delayInDays,
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * This method returns a set of parameters needed for one time payments.
103 103
 	 * @link https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/wp_standard_overview/
104 104
 	 */
105
-	private function getSinglePaymentParams( Euro $amount ): array {
105
+	private function getSinglePaymentParams(Euro $amount): array {
106 106
 		return [
107 107
 			'cmd' => '_donations',
108 108
 			'amount' => $amount->getEuroString()
Please login to merge, or discard this patch.
contexts/PaymentContext/src/DataAccess/Sofort/Transfer/Response.php 1 patch
Spacing   +3 added lines, -3 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\PaymentContext\DataAccess\Sofort\Transfer;
6 6
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 		return $this->transactionId;
20 20
 	}
21 21
 
22
-	public function setTransactionId( string $transactionId ): void {
22
+	public function setTransactionId(string $transactionId): void {
23 23
 		$this->transactionId = $transactionId;
24 24
 	}
25 25
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		return $this->paymentUrl;
28 28
 	}
29 29
 
30
-	public function setPaymentUrl( string $paymentUrl ): void {
30
+	public function setPaymentUrl(string $paymentUrl): void {
31 31
 		$this->paymentUrl = $paymentUrl;
32 32
 	}
33 33
 }
Please login to merge, or discard this patch.