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