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