Complex classes like FunFunFactory often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use FunFunFactory, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 176 | class FunFunFactory { |
||
| 177 | 160 | ||
| 178 | 160 | private $config; |
|
| 179 | 160 | ||
| 180 | 160 | /** |
|
| 181 | * @var Container |
||
| 182 | 160 | */ |
|
| 183 | 160 | private $pimple; |
|
| 184 | |||
| 185 | private $addDoctrineSubscribers = true; |
||
| 186 | 119 | ||
| 187 | /** |
||
| 188 | * @var Stopwatch|null |
||
| 189 | */ |
||
| 190 | 4 | private $profiler = null; |
|
| 191 | |||
| 192 | public function __construct( array $config ) { |
||
| 193 | $this->config = $config; |
||
| 194 | $this->pimple = $this->newPimple(); |
||
| 195 | } |
||
| 196 | |||
| 197 | private function newPimple(): Container { |
||
| 198 | 160 | $pimple = new Container(); |
|
| 199 | |||
| 200 | $pimple['logger'] = function() { |
||
| 201 | return new NullLogger(); |
||
| 202 | 90 | }; |
|
| 203 | 90 | ||
| 204 | 90 | $pimple['paypal_logger'] = function() { |
|
| 205 | 90 | return new NullLogger(); |
|
| 206 | 90 | }; |
|
| 207 | |||
| 208 | $pimple['sofort_logger'] = function() { |
||
| 209 | 90 | return new NullLogger(); |
|
| 210 | }; |
||
| 211 | |||
| 212 | $pimple['profiler_data_collector'] = function() { |
||
| 213 | 9 | return new ProfilerDataCollector(); |
|
| 214 | 9 | }; |
|
| 215 | 9 | ||
| 216 | $pimple['dbal_connection'] = function() { |
||
| 217 | return DriverManager::getConnection( $this->config['db'] ); |
||
| 218 | }; |
||
| 219 | |||
| 220 | 47 | $pimple['entity_manager'] = function() { |
|
| 221 | 47 | $entityManager = ( new StoreFactory( $this->getConnection(), $this->getVarPath() . '/doctrine_proxies' ) ) |
|
| 222 | 47 | ->getEntityManager(); |
|
| 223 | if ( $this->addDoctrineSubscribers ) { |
||
| 224 | $entityManager->getEventManager()->addEventSubscriber( $this->newDoctrineDonationPrePersistSubscriber() ); |
||
| 225 | $entityManager->getEventManager()->addEventSubscriber( $this->newDoctrineMembershipApplicationPrePersistSubscriber() ); |
||
| 226 | } |
||
| 227 | 14 | ||
| 228 | 14 | return $entityManager; |
|
| 229 | 14 | }; |
|
| 230 | |||
| 231 | $pimple['subscription_repository'] = function() { |
||
| 232 | return new LoggingSubscriptionRepository( |
||
| 233 | new DoctrineSubscriptionRepository( $this->getEntityManager() ), |
||
| 234 | 12 | $this->getLogger() |
|
| 235 | 12 | ); |
|
| 236 | 12 | }; |
|
| 237 | |||
| 238 | $pimple['donation_repository'] = function() { |
||
| 239 | 12 | return new LoggingDonationRepository( |
|
| 240 | new DoctrineDonationRepository( $this->getEntityManager() ), |
||
| 241 | $this->getLogger() |
||
| 242 | ); |
||
| 243 | 44 | }; |
|
| 244 | |||
| 245 | $pimple['membership_application_repository'] = function() { |
||
| 246 | return new LoggingApplicationRepository( |
||
| 247 | 7 | new DoctrineApplicationRepository( $this->getEntityManager() ), |
|
| 248 | 7 | $this->getLogger() |
|
| 249 | 7 | ); |
|
| 250 | 7 | }; |
|
| 251 | 7 | ||
| 252 | $pimple['comment_repository'] = function() { |
||
| 253 | $finder = new LoggingCommentFinder( |
||
| 254 | new DoctrineCommentFinder( $this->getEntityManager() ), |
||
| 255 | $this->getLogger() |
||
| 256 | 8 | ); |
|
| 257 | |||
| 258 | return $this->addProfilingDecorator( $finder, 'CommentFinder' ); |
||
| 259 | }; |
||
| 260 | 3 | ||
| 261 | $pimple['mail_validator'] = function() { |
||
| 262 | return new EmailValidator( new InternetDomainNameValidator() ); |
||
| 263 | }; |
||
| 264 | 56 | ||
| 265 | $pimple['subscription_validator'] = function() { |
||
| 266 | return new SubscriptionValidator( |
||
| 267 | $this->getEmailValidator(), |
||
| 268 | 102 | $this->newTextPolicyValidator( 'fields' ), |
|
| 269 | 102 | $this->newSubscriptionDuplicateValidator(), |
|
| 270 | 102 | $this->newHonorificValidator() |
|
| 271 | ); |
||
| 272 | }; |
||
| 273 | |||
| 274 | $pimple['template_name_validator'] = function() { |
||
| 275 | 102 | return new TemplateNameValidator( $this->getSkinTwig() ); |
|
| 276 | 102 | }; |
|
| 277 | |||
| 278 | 102 | $pimple['contact_validator'] = function() { |
|
| 279 | 102 | return new GetInTouchValidator( $this->getEmailValidator() ); |
|
| 280 | }; |
||
| 281 | 102 | ||
| 282 | 102 | $pimple['greeting_generator'] = function() { |
|
| 283 | 102 | return new GreetingGenerator(); |
|
| 284 | }; |
||
| 285 | |||
| 286 | $pimple['translator'] = function() { |
||
| 287 | 102 | $translationFactory = new TranslationFactory(); |
|
| 288 | $loaders = [ |
||
| 289 | 'json' => $translationFactory->newJsonLoader() |
||
| 290 | ]; |
||
| 291 | 114 | $locale = $this->config['locale']; |
|
| 292 | $messagesPath = $this->getI18nDirectory() . $this->config['translation']['message-dir']; |
||
| 293 | 114 | $translator = $translationFactory->create( $loaders, $locale ); |
|
| 294 | foreach ($this->config['translation']['files'] as $domain => $file) { |
||
| 295 | 114 | $translator->addResource( 'json', $messagesPath . '/' . $file, $locale, $domain ); |
|
| 296 | 114 | } |
|
| 297 | 114 | ||
| 298 | 114 | return $translator; |
|
| 299 | 114 | }; |
|
| 300 | |||
| 301 | // In the future, this could be locale-specific or filled from a DB table |
||
| 302 | $pimple['honorifics'] = function() { |
||
| 303 | 114 | return new Honorifics( [ |
|
| 304 | 114 | '' => 'Kein Titel', |
|
| 305 | 114 | 'Dr.' => 'Dr.', |
|
| 306 | 'Prof.' => 'Prof.', |
||
| 307 | 114 | 'Prof. Dr.' => 'Prof. Dr.' |
|
| 308 | ] ); |
||
| 309 | }; |
||
| 310 | 114 | ||
| 311 | 114 | $pimple['twig'] = function() { |
|
| 312 | 114 | $config = $this->config['twig']; |
|
| 313 | $config['loaders']['filesystem']['template-dir'] = 'skins/' . $this->getSkinSettings()->getSkin() . '/templates'; |
||
| 314 | 114 | ||
| 315 | $twigFactory = $this->newTwigFactory( $config ); |
||
| 316 | $configurator = $twigFactory->newTwigEnvironmentConfigurator(); |
||
| 317 | 114 | ||
| 318 | 114 | $loaders = array_filter( [ |
|
| 319 | 114 | $twigFactory->newFileSystemLoader(), |
|
| 320 | $twigFactory->newArrayLoader(), // This is just a fallback for testing |
||
| 321 | 114 | ] ); |
|
| 322 | $extensions = [ |
||
| 323 | $twigFactory->newTranslationExtension( $this->getTranslator() ), |
||
| 324 | 114 | new Twig_Extensions_Extension_Intl() |
|
| 325 | 114 | ]; |
|
| 326 | 114 | $filters = [ |
|
| 327 | $twigFactory->newFilePrefixFilter( |
||
| 328 | 114 | $this->getFilePrefixer() |
|
| 329 | ) |
||
| 330 | ]; |
||
| 331 | 114 | $functions = [ |
|
| 332 | new Twig_SimpleFunction( |
||
| 333 | 'web_content', |
||
| 334 | function( string $name, array $context = [] ): string { |
||
| 335 | return $this->getContentProvider()->getWeb( $name, $context ); |
||
| 336 | 78 | }, |
|
| 337 | 78 | [ 'is_safe' => [ 'html' ] ] |
|
| 338 | ), |
||
| 339 | ]; |
||
| 340 | |||
| 341 | return $configurator->getEnvironment( $this->pimple['skin_twig_environment'], $loaders, $extensions, $filters, $functions ); |
||
| 342 | }; |
||
| 343 | |||
| 344 | $pimple['mailer_twig'] = function() { |
||
| 345 | 109 | $twigFactory = $this->newTwigFactory( $this->config['mailer-twig'] ); |
|
| 346 | $configurator = $twigFactory->newTwigEnvironmentConfigurator(); |
||
| 347 | |||
| 348 | $loaders = array_filter( [ |
||
| 349 | 109 | $twigFactory->newFileSystemLoader(), |
|
| 350 | 109 | $twigFactory->newArrayLoader(), // This is just a fallback for testing |
|
| 351 | 109 | ] ); |
|
| 352 | 109 | $extensions = [ |
|
| 353 | 109 | $twigFactory->newTranslationExtension( $this->getTranslator() ), |
|
| 354 | 109 | new Twig_Extensions_Extension_Intl(), |
|
| 355 | 109 | ]; |
|
| 356 | $filters = []; |
||
| 357 | $functions = [ |
||
| 358 | new Twig_SimpleFunction( |
||
| 359 | 109 | 'mail_content', |
|
| 360 | 109 | function( string $name, array $context = [] ): string { |
|
| 361 | return $this->getContentProvider()->getMail( $name, $context ); |
||
| 362 | }, |
||
| 363 | 109 | [ 'is_safe' => [ 'all' ] ] |
|
| 364 | 109 | ), |
|
| 365 | new Twig_SimpleFunction( |
||
| 366 | 'url', |
||
| 367 | function( string $name, array $parameters = [] ): string { |
||
| 368 | 109 | return $this->getUrlGenerator()->generateUrl( $name, $parameters ); |
|
| 369 | } |
||
| 370 | ) |
||
| 371 | ]; |
||
| 372 | |||
| 373 | $twigEnvironment = new Twig_Environment(); |
||
| 374 | |||
| 375 | return $configurator->getEnvironment( $twigEnvironment, $loaders, $extensions, $filters, $functions ); |
||
| 376 | }; |
||
| 377 | |||
| 378 | $pimple['messenger_suborganization'] = function() { |
||
| 379 | return new Messenger( |
||
| 380 | new Swift_MailTransport(), |
||
|
|
|||
| 381 | $this->getSubOrganizationEmailAddress(), |
||
| 382 | $this->config['contact-info']['suborganization']['name'] |
||
| 383 | ); |
||
| 384 | }; |
||
| 385 | |||
| 386 | $pimple['messenger_organization'] = function() { |
||
| 387 | return new Messenger( |
||
| 388 | 6 | new Swift_MailTransport(), |
|
| 389 | $this->getOrganizationEmailAddress(), |
||
| 390 | $this->config['contact-info']['organization']['name'] |
||
| 391 | ); |
||
| 392 | }; |
||
| 393 | |||
| 394 | $pimple['confirmation-page-selector'] = function() { |
||
| 395 | return new DonationConfirmationPageSelector( $this->config['confirmation-pages'] ); |
||
| 396 | }; |
||
| 397 | |||
| 398 | $pimple['paypal-payment-notification-verifier'] = function() { |
||
| 399 | return new LoggingPaymentNotificationVerifier( |
||
| 400 | new PayPalPaymentNotificationVerifier( |
||
| 401 | new Client(), |
||
| 402 | $this->config['paypal-donation']['base-url'], |
||
| 403 | $this->config['paypal-donation']['account-address'] |
||
| 404 | ), |
||
| 405 | $this->getLogger() |
||
| 406 | ); |
||
| 407 | }; |
||
| 408 | |||
| 409 | $pimple['paypal-membership-fee-notification-verifier'] = function() { |
||
| 410 | return new LoggingPaymentNotificationVerifier( |
||
| 411 | new PayPalPaymentNotificationVerifier( |
||
| 412 | new Client(), |
||
| 413 | $this->config['paypal-membership']['base-url'], |
||
| 414 | 69 | $this->config['paypal-membership']['account-address'] |
|
| 415 | 69 | ), |
|
| 416 | 69 | $this->getLogger() |
|
| 417 | ); |
||
| 418 | }; |
||
| 419 | |||
| 420 | $pimple['credit-card-api-service'] = function() { |
||
| 421 | 112 | return new McpCreditCardService( |
|
| 422 | new TNvpServiceDispatcher( |
||
| 423 | 'IMcpCreditcardService_v1_5', |
||
| 424 | 'https://sipg.micropayment.de/public/creditcard/v1.5/nvp/' |
||
| 425 | 109 | ), |
|
| 426 | $this->config['creditcard']['access-key'], |
||
| 427 | $this->config['creditcard']['testmode'] |
||
| 428 | ); |
||
| 429 | }; |
||
| 430 | |||
| 431 | $pimple['donation_token_generator'] = function() { |
||
| 432 | 160 | return new RandomTokenGenerator( |
|
| 433 | $this->config['token-length'], |
||
| 434 | new \DateInterval( $this->config['token-validity-timestamp'] ) |
||
| 435 | 160 | ); |
|
| 436 | 160 | }; |
|
| 437 | |||
| 438 | $pimple['membership_token_generator'] = function() { |
||
| 439 | 90 | return new RandomMembershipTokenGenerator( |
|
| 440 | 90 | $this->config['token-length'], |
|
| 441 | new \DateInterval( $this->config['token-validity-timestamp'] ) |
||
| 442 | ); |
||
| 443 | 11 | }; |
|
| 444 | 11 | ||
| 445 | 11 | $pimple['page_cache'] = function() { |
|
| 446 | 11 | return new VoidCache(); |
|
| 447 | }; |
||
| 448 | |||
| 449 | $pimple['rendered_page_cache'] = function() { |
||
| 450 | 160 | return new VoidCache(); |
|
| 451 | 160 | }; |
|
| 452 | |||
| 453 | $pimple['page_view_tracker'] = function () { |
||
| 454 | 12 | return new PageViewTracker( $this->newServerSideTracker(), $this->config['piwik']['siteUrlBase'] ); |
|
| 455 | 12 | }; |
|
| 456 | |||
| 457 | $pimple['cachebusting_fileprefixer'] = function () { |
||
| 458 | 6 | return new FilePrefixer( $this->getFilePrefix() ); |
|
| 459 | 6 | }; |
|
| 460 | |||
| 461 | $pimple['content_page_selector'] = function () { |
||
| 462 | 2 | $json = (new SimpleFileFetcher())->fetchFile( $this->getI18nDirectory() . '/data/pages.json' ); |
|
| 463 | 2 | $config = json_decode( $json, true ) ?? []; |
|
| 464 | 2 | ||
| 465 | 2 | return new PageSelector( $config ); |
|
| 466 | }; |
||
| 467 | |||
| 468 | $pimple['content_provider'] = function () { |
||
| 469 | 4 | return new ContentProvider( [ |
|
| 470 | 4 | 'content_path' => $this->getI18nDirectory(), |
|
| 471 | 'cache' => $this->config['twig']['enable-cache'] ? $this->getCachePath() . '/content' : false, |
||
| 472 | 'globals' => [ |
||
| 473 | 12 | 'basepath' => $this->config['web-basepath'] |
|
| 474 | 12 | ] |
|
| 475 | ] ); |
||
| 476 | }; |
||
| 477 | 10 | ||
| 478 | 10 | $pimple['payment-delay-calculator'] = function() { |
|
| 479 | return new DefaultPaymentDelayCalculator( $this->getPaymentDelayInDays() ); |
||
| 480 | }; |
||
| 481 | 1 | ||
| 482 | 1 | $pimple['sofort-client'] = function () { |
|
| 483 | 1 | $config = $this->config['sofort']; |
|
| 484 | return new SofortClient( $config['config-key'] ); |
||
| 485 | 7 | }; |
|
| 486 | 7 | ||
| 487 | $pimple['cookie-builder'] = function (): CookieBuilder { |
||
| 488 | return new CookieBuilder( |
||
| 489 | 46 | $this->config['cookie']['expiration'], |
|
| 490 | 46 | $this->config['cookie']['path'], |
|
| 491 | $this->config['cookie']['domain'], |
||
| 492 | $this->config['cookie']['secure'], |
||
| 493 | 8 | $this->config['cookie']['httpOnly'], |
|
| 494 | 8 | $this->config['cookie']['raw'], |
|
| 495 | $this->config['cookie']['sameSite'] |
||
| 496 | ); |
||
| 497 | 1 | }; |
|
| 498 | 1 | ||
| 499 | $pimple['skin-settings'] = function (): SkinSettings { |
||
| 500 | $config = $this->config['skin']; |
||
| 501 | 3 | return new SkinSettings( $config['options'], $config['default'], $config['cookie-lifetime'] ); |
|
| 502 | 3 | }; |
|
| 503 | 3 | ||
| 504 | 3 | $pimple['payment-types-settings'] = function (): PaymentTypesSettings { |
|
| 505 | return new PaymentTypesSettings( $this->config['payment-types'] ); |
||
| 506 | }; |
||
| 507 | |||
| 508 | 3 | return $pimple; |
|
| 509 | 3 | } |
|
| 510 | |||
| 511 | public function getConnection(): Connection { |
||
| 512 | 1 | return $this->pimple['dbal_connection']; |
|
| 513 | 1 | } |
|
| 514 | |||
| 515 | public function getEntityManager(): EntityManager { |
||
| 516 | 160 | return $this->pimple['entity_manager']; |
|
| 517 | 160 | } |
|
| 518 | 160 | ||
| 519 | private function newDonationEventLogger(): DonationEventLogger { |
||
| 520 | 109 | return new BestEffortDonationEventLogger( |
|
| 521 | 109 | new DoctrineDonationEventLogger( $this->getEntityManager() ), |
|
| 522 | $this->getLogger() |
||
| 523 | ); |
||
| 524 | } |
||
| 525 | |||
| 526 | public function newInstaller(): Installer { |
||
| 527 | return ( new StoreFactory( $this->getConnection() ) )->newInstaller(); |
||
| 528 | } |
||
| 529 | |||
| 530 | public function newListCommentsUseCase(): ListCommentsUseCase { |
||
| 531 | 43 | return new ListCommentsUseCase( $this->getCommentFinder() ); |
|
| 532 | 43 | } |
|
| 533 | 43 | ||
| 534 | public function newCommentListJsonPresenter(): CommentListJsonPresenter { |
||
| 535 | 43 | return new CommentListJsonPresenter(); |
|
| 536 | } |
||
| 537 | |||
| 538 | public function newCommentListRssPresenter(): CommentListRssPresenter { |
||
| 539 | return new CommentListRssPresenter( new TwigTemplate( |
||
| 540 | $this->getSkinTwig(), |
||
| 541 | 'Comment_List.rss.twig' |
||
| 542 | ) ); |
||
| 543 | } |
||
| 544 | |||
| 545 | 30 | public function newCommentListHtmlPresenter(): CommentListHtmlPresenter { |
|
| 546 | 30 | return new CommentListHtmlPresenter( $this->getLayoutTemplate( 'Comment_List.html.twig', [ 'piwikGoals' => [ 1 ] ] ) ); |
|
| 547 | 30 | } |
|
| 548 | 30 | ||
| 549 | private function getCommentFinder(): CommentFinder { |
||
| 550 | 30 | return $this->pimple['comment_repository']; |
|
| 551 | 30 | } |
|
| 552 | |||
| 553 | public function getSubscriptionRepository(): SubscriptionRepository { |
||
| 554 | return $this->pimple['subscription_repository']; |
||
| 555 | } |
||
| 556 | |||
| 557 | 72 | public function setSubscriptionRepository( SubscriptionRepository $subscriptionRepository ): void { |
|
| 558 | $this->pimple['subscription_repository'] = $subscriptionRepository; |
||
| 559 | 72 | } |
|
| 560 | 72 | ||
| 561 | 72 | private function getSubscriptionValidator(): SubscriptionValidator { |
|
| 562 | 72 | return $this->pimple['subscription_validator']; |
|
| 563 | 72 | } |
|
| 564 | 72 | ||
| 565 | public function getEmailValidator(): EmailValidator { |
||
| 566 | return $this->pimple['mail_validator']; |
||
| 567 | } |
||
| 568 | 20 | ||
| 569 | 20 | public function getTemplateNameValidator(): TemplateNameValidator { |
|
| 570 | 20 | return $this->pimple['template_name_validator']; |
|
| 571 | 20 | } |
|
| 572 | |||
| 573 | public function newAddSubscriptionHtmlPresenter(): AddSubscriptionHtmlPresenter { |
||
| 574 | return new AddSubscriptionHtmlPresenter( $this->getLayoutTemplate( 'Subscription_Form.html.twig' ), $this->getTranslator() ); |
||
| 575 | 112 | } |
|
| 576 | 112 | ||
| 577 | public function newConfirmSubscriptionHtmlPresenter(): ConfirmSubscriptionHtmlPresenter { |
||
| 578 | return new ConfirmSubscriptionHtmlPresenter( |
||
| 579 | 10 | $this->getLayoutTemplate( 'Confirm_Subscription.twig' ), |
|
| 580 | 10 | $this->getTranslator() |
|
| 581 | 10 | ); |
|
| 582 | } |
||
| 583 | 102 | ||
| 584 | 102 | public function newAddSubscriptionJsonPresenter(): AddSubscriptionJsonPresenter { |
|
| 585 | return new AddSubscriptionJsonPresenter( $this->getTranslator() ); |
||
| 586 | } |
||
| 587 | 112 | ||
| 588 | 112 | public function newGetInTouchHtmlPresenter(): GetInTouchHtmlPresenter { |
|
| 589 | 112 | return new GetInTouchHtmlPresenter( $this->getLayoutTemplate( 'contact_form.html.twig' ), $this->getTranslator() ); |
|
| 590 | 112 | } |
|
| 591 | |||
| 592 | public function setSkinTwigEnvironment( Twig_Environment $twig ): void { |
||
| 593 | 112 | $this->pimple['skin_twig_environment'] = $twig; |
|
| 594 | } |
||
| 595 | |||
| 596 | 109 | public function getSkinTwig(): Twig_Environment { |
|
| 597 | 109 | return $this->pimple['twig']; |
|
| 598 | 109 | } |
|
| 599 | 109 | ||
| 600 | public function getMailerTwig(): Twig_Environment { |
||
| 601 | return $this->pimple['mailer_twig']; |
||
| 602 | 109 | } |
|
| 603 | |||
| 604 | /** |
||
| 605 | 112 | * Get a template, with the content for the layout areas filled in. |
|
| 606 | 112 | * |
|
| 607 | 112 | * @param string $templateName |
|
| 608 | 112 | * @param array $context Additional variables for the template |
|
| 609 | 112 | * @return TwigTemplate |
|
| 610 | 112 | */ |
|
| 611 | 112 | public function getLayoutTemplate( string $templateName, array $context = [] ): TwigTemplate { |
|
| 612 | return new TwigTemplate( |
||
| 613 | $this->getSkinTwig(), |
||
| 614 | $templateName, |
||
| 615 | 109 | array_merge( $this->getDefaultTwigVariables(), $context ) |
|
| 616 | 109 | ); |
|
| 617 | 109 | } |
|
| 618 | 109 | ||
| 619 | 109 | public function getMailerTemplate( string $templateName, array $context = [] ): TwigTemplate { |
|
| 620 | 109 | return new TwigTemplate( |
|
| 621 | 109 | $this->getMailerTwig(), |
|
| 622 | $templateName, |
||
| 623 | array_merge( $this->getDefaultTwigVariables(), $context ) |
||
| 624 | ); |
||
| 625 | 119 | } |
|
| 626 | 119 | ||
| 627 | /** |
||
| 628 | * Get a layouted template that includes another template |
||
| 629 | 6 | * |
|
| 630 | 6 | * @deprecated Change the template to use extend and block and call getLayoutTemplate instead. |
|
| 631 | * |
||
| 632 | * @param string $templateName Template to include |
||
| 633 | 127 | * @return TwigTemplate |
|
| 634 | 127 | */ |
|
| 635 | private function getIncludeTemplate( string $templateName, array $context = [] ): TwigTemplate { |
||
| 636 | return new TwigTemplate( |
||
| 637 | 109 | $this->getSkinTwig(), |
|
| 638 | 109 | 'Include_in_Layout.twig', |
|
| 639 | array_merge( |
||
| 640 | $this->getDefaultTwigVariables(), |
||
| 641 | [ 'main_template' => $templateName ], |
||
| 642 | $context |
||
| 643 | ) |
||
| 644 | ); |
||
| 645 | } |
||
| 646 | |||
| 647 | private function getDefaultTwigVariables(): array { |
||
| 648 | return [ |
||
| 649 | 7 | 'honorifics' => $this->getHonorifics()->getList(), |
|
| 650 | 7 | 'header_template' => $this->config['default-layout-templates']['header'], |
|
| 651 | 7 | 'footer_template' => $this->config['default-layout-templates']['footer'], |
|
| 652 | 7 | 'no_js_notice_template' => $this->config['default-layout-templates']['no-js-notice'], |
|
| 653 | 7 | 'piwik' => $this->config['piwik'], |
|
| 654 | 'locale' => $this->config['locale'], |
||
| 655 | ]; |
||
| 656 | } |
||
| 657 | 3 | ||
| 658 | 3 | private function newReferrerGeneralizer(): ReferrerGeneralizer { |
|
| 659 | 3 | return new ReferrerGeneralizer( |
|
| 660 | 3 | $this->config['referrer-generalization']['default'], |
|
| 661 | $this->config['referrer-generalization']['domain-map'] |
||
| 662 | ); |
||
| 663 | } |
||
| 664 | 7 | ||
| 665 | 7 | public function getLogger(): LoggerInterface { |
|
| 666 | 7 | return $this->pimple['logger']; |
|
| 667 | 7 | } |
|
| 668 | 7 | ||
| 669 | 7 | public function getPaypalLogger(): LoggerInterface { |
|
| 670 | return $this->pimple['paypal_logger']; |
||
| 671 | 7 | } |
|
| 672 | 7 | ||
| 673 | public function getSofortLogger(): LoggerInterface { |
||
| 674 | return $this->pimple['sofort_logger']; |
||
| 675 | 7 | } |
|
| 676 | |||
| 677 | private function getVarPath(): string { |
||
| 678 | return __DIR__ . '/../../var'; |
||
| 679 | 3 | } |
|
| 680 | 3 | ||
| 681 | 3 | public function getCachePath(): string { |
|
| 682 | 3 | return $this->getVarPath() . '/cache'; |
|
| 683 | 3 | } |
|
| 684 | 3 | ||
| 685 | 3 | public function getLoggingPath(): string { |
|
| 686 | return $this->getVarPath() . '/log'; |
||
| 687 | 3 | } |
|
| 688 | |||
| 689 | public function getTemplatePath(): string { |
||
| 690 | return __DIR__ . '/../../app/fundraising-frontend-content/templates'; |
||
| 691 | 59 | } |
|
| 692 | 59 | ||
| 693 | public function newAddSubscriptionUseCase(): AddSubscriptionUseCase { |
||
| 694 | return new AddSubscriptionUseCase( |
||
| 695 | 59 | $this->getSubscriptionRepository(), |
|
| 696 | $this->getSubscriptionValidator(), |
||
| 697 | $this->newAddSubscriptionMailer() |
||
| 698 | 59 | ); |
|
| 699 | } |
||
| 700 | 59 | ||
| 701 | public function newConfirmSubscriptionUseCase(): ConfirmSubscriptionUseCase { |
||
| 702 | return new ConfirmSubscriptionUseCase( |
||
| 703 | 56 | $this->getSubscriptionRepository(), |
|
| 704 | 56 | $this->newConfirmSubscriptionMailer() |
|
| 705 | ); |
||
| 706 | } |
||
| 707 | |||
| 708 | private function newAddSubscriptionMailer(): TemplateMailerInterface { |
||
| 709 | return $this->newTemplateMailer( |
||
| 710 | $this->getSuborganizationMessenger(), |
||
| 711 | new TwigTemplate( |
||
| 712 | $this->getMailerTwig(), |
||
| 713 | 'Subscription_Request.txt.twig', |
||
| 714 | [ |
||
| 715 | 'greeting_generator' => $this->getGreetingGenerator() |
||
| 716 | ] |
||
| 717 | ), |
||
| 718 | 'mail_subject_subscription' |
||
| 719 | 31 | ); |
|
| 720 | 31 | } |
|
| 721 | |||
| 722 | private function newConfirmSubscriptionMailer(): TemplateMailerInterface { |
||
| 723 | return $this->newTemplateMailer( |
||
| 724 | $this->getSuborganizationMessenger(), |
||
| 725 | new TwigTemplate( |
||
| 726 | $this->getMailerTwig(), |
||
| 727 | 'Subscription_Confirmation.txt.twig', |
||
| 728 | [ 'greeting_generator' => $this->getGreetingGenerator() ] |
||
| 729 | ), |
||
| 730 | 'mail_subject_subscription_confirmed' |
||
| 731 | 3 | ); |
|
| 732 | 3 | } |
|
| 733 | 3 | ||
| 734 | 3 | /** |
|
| 735 | 3 | * Create a new TemplateMailer instance |
|
| 736 | * |
||
| 737 | * So much decoration going on that explicitly hinting what we return (Robustness principle) would be confusing |
||
| 738 | * (you'd expect a TemplateBasedMailer, not a LoggingMailer), so we hint the interface instead. |
||
| 739 | 3 | */ |
|
| 740 | 3 | private function newTemplateMailer( Messenger $messenger, TwigTemplate $template, string $messageKey ): TemplateMailerInterface { |
|
| 741 | 3 | $mailer = new TemplateBasedMailer( |
|
| 742 | 3 | $messenger, |
|
| 743 | 3 | $template, |
|
| 744 | $this->getTranslator()->trans( $messageKey ) |
||
| 745 | ); |
||
| 746 | |||
| 747 | 3 | $mailer = new LoggingMailer( $mailer, $this->getLogger() ); |
|
| 748 | 3 | ||
| 749 | 3 | return $this->addProfilingDecorator( $mailer, 'Mailer' ); |
|
| 750 | 3 | } |
|
| 751 | 3 | ||
| 752 | public function getGreetingGenerator(): GreetingGenerator { |
||
| 753 | return $this->pimple['greeting_generator']; |
||
| 754 | } |
||
| 755 | 3 | ||
| 756 | 3 | public function newCheckIbanUseCase(): CheckIbanUseCase { |
|
| 757 | return new CheckIbanUseCase( $this->newBankDataConverter(), $this->newIbanValidator() ); |
||
| 758 | } |
||
| 759 | 7 | ||
| 760 | 7 | public function newGenerateIbanUseCase(): GenerateIbanUseCase { |
|
| 761 | 7 | return new GenerateIbanUseCase( $this->newBankDataConverter(), $this->newIbanValidator() ); |
|
| 762 | 7 | } |
|
| 763 | |||
| 764 | public function newIbanPresenter(): IbanPresenter { |
||
| 765 | return new IbanPresenter(); |
||
| 766 | 7 | } |
|
| 767 | 7 | ||
| 768 | 7 | public function newBankDataConverter(): BankDataConverter { |
|
| 769 | 7 | return new BankDataConverter( $this->config['bank-data-file'] ); |
|
| 770 | } |
||
| 771 | |||
| 772 | 7 | public function setSubscriptionValidator( SubscriptionValidator $subscriptionValidator ): void { |
|
| 773 | 7 | $this->pimple['subscription_validator'] = $subscriptionValidator; |
|
| 774 | } |
||
| 775 | |||
| 776 | 78 | public function newGetInTouchUseCase(): GetInTouchUseCase { |
|
| 777 | 78 | return new GetInTouchUseCase( |
|
| 778 | $this->getContactValidator(), |
||
| 779 | $this->newContactOperatorMailer(), |
||
| 780 | 1 | $this->newContactUserMailer() |
|
| 781 | 1 | ); |
|
| 782 | 1 | } |
|
| 783 | 1 | ||
| 784 | private function newContactUserMailer(): TemplateMailerInterface { |
||
| 785 | return $this->newTemplateMailer( |
||
| 786 | $this->getSuborganizationMessenger(), |
||
| 787 | 31 | new TwigTemplate( $this->getMailerTwig(), 'Contact_Confirm_to_User.txt.twig' ), |
|
| 788 | 31 | 'mail_subject_getintouch' |
|
| 789 | ); |
||
| 790 | } |
||
| 791 | 46 | ||
| 792 | 46 | private function newContactOperatorMailer(): OperatorMailer { |
|
| 793 | return new OperatorMailer( |
||
| 794 | $this->getSuborganizationMessenger(), |
||
| 795 | 160 | new TwigTemplate( $this->getMailerTwig(), 'Contact_Forward_to_Operator.txt.twig' ), |
|
| 796 | 160 | $this->getTranslator()->trans( 'mail_subject_getintouch_forward' ) |
|
| 797 | 160 | ); |
|
| 798 | } |
||
| 799 | 13 | ||
| 800 | 13 | private function getContactValidator(): GetInTouchValidator { |
|
| 801 | return $this->pimple['contact_validator']; |
||
| 802 | } |
||
| 803 | 160 | ||
| 804 | 160 | private function newSubscriptionDuplicateValidator(): SubscriptionDuplicateValidator { |
|
| 805 | 160 | return new SubscriptionDuplicateValidator( |
|
| 806 | $this->getSubscriptionRepository(), |
||
| 807 | 160 | $this->newSubscriptionDuplicateCutoffDate() |
|
| 808 | 160 | ); |
|
| 809 | 160 | } |
|
| 810 | 160 | ||
| 811 | private function newSubscriptionDuplicateCutoffDate(): \DateTime { |
||
| 812 | 160 | $cutoffDateTime = new \DateTime(); |
|
| 813 | 160 | $cutoffDateTime->sub( new \DateInterval( $this->config['subscription-interval'] ) ); |
|
| 814 | 160 | return $cutoffDateTime; |
|
| 815 | } |
||
| 816 | 160 | ||
| 817 | private function newHonorificValidator(): AllowedValuesValidator { |
||
| 818 | 160 | return new AllowedValuesValidator( $this->getHonorifics()->getKeys() ); |
|
| 819 | 160 | } |
|
| 820 | |||
| 821 | private function getHonorifics(): Honorifics { |
||
| 822 | 160 | return $this->pimple['honorifics']; |
|
| 823 | 160 | } |
|
| 824 | |||
| 825 | public function newAuthorizedCachePurger(): AuthorizedCachePurger { |
||
| 826 | 3 | return new AuthorizedCachePurger( |
|
| 827 | 3 | new AllOfTheCachePurger( $this->getSkinTwig(), $this->getPageCache(), $this->getRenderedPageCache() ), |
|
| 828 | $this->config['purging-secret'] |
||
| 829 | ); |
||
| 830 | 3 | } |
|
| 831 | 3 | ||
| 832 | private function newBankDataValidator(): BankDataValidator { |
||
| 833 | return new BankDataValidator( $this->newIbanValidator() ); |
||
| 834 | 116 | } |
|
| 835 | 116 | ||
| 836 | private function getSuborganizationMessenger(): Messenger { |
||
| 837 | return $this->pimple['messenger_suborganization']; |
||
| 838 | 2 | } |
|
| 839 | 2 | ||
| 840 | 2 | public function setSuborganizationMessenger( Messenger $messenger ): void { |
|
| 841 | $this->pimple['messenger_suborganization'] = $messenger; |
||
| 842 | 109 | } |
|
| 843 | 109 | ||
| 844 | private function getOrganizationMessenger(): Messenger { |
||
| 845 | return $this->pimple['messenger_organization']; |
||
| 846 | 41 | } |
|
| 847 | 41 | ||
| 848 | 41 | public function setOrganizationMessenger( Messenger $messenger ): void { |
|
| 849 | $this->pimple['messenger_organization'] = $messenger; |
||
| 850 | 41 | } |
|
| 851 | 41 | ||
| 852 | 41 | public function setNullMessenger(): void { |
|
| 853 | $this->setSuborganizationMessenger( new Messenger( |
||
| 854 | Swift_NullTransport::newInstance(), |
||
| 855 | $this->getSubOrganizationEmailAddress() |
||
| 856 | 3 | ) ); |
|
| 857 | 3 | $this->setOrganizationMessenger( new Messenger( |
|
| 858 | Swift_NullTransport::newInstance(), |
||
| 859 | $this->getOrganizationEmailAddress() |
||
| 860 | 5 | ) ); |
|
| 861 | 5 | } |
|
| 862 | 5 | ||
| 863 | 5 | public function getSubOrganizationEmailAddress(): EmailAddress { |
|
| 864 | 5 | return new EmailAddress( $this->config['contact-info']['suborganization']['email'] ); |
|
| 865 | 5 | } |
|
| 866 | |||
| 867 | public function getOrganizationEmailAddress(): EmailAddress { |
||
| 868 | return new EmailAddress( $this->config['contact-info']['organization']['email'] ); |
||
| 869 | 5 | } |
|
| 870 | 5 | ||
| 871 | 5 | public function newInternalErrorHtmlPresenter(): InternalErrorHtmlPresenter { |
|
| 872 | 5 | return new InternalErrorHtmlPresenter( $this->getLayoutTemplate( 'Error_Page.html.twig' ) ); |
|
| 873 | 5 | } |
|
| 874 | 5 | ||
| 875 | 5 | public function newAccessDeniedHtmlPresenter(): InternalErrorHtmlPresenter { |
|
| 876 | return new InternalErrorHtmlPresenter( $this->getLayoutTemplate( 'Access_Denied.twig' ) ); |
||
| 877 | 5 | } |
|
| 878 | |||
| 879 | public function getTranslator(): TranslatorInterface { |
||
| 880 | return $this->pimple['translator']; |
||
| 881 | 20 | } |
|
| 882 | 20 | ||
| 883 | 20 | public function setTranslator( TranslatorInterface $translator ): void { |
|
| 884 | 20 | $this->pimple['translator'] = $translator; |
|
| 885 | 20 | } |
|
| 886 | 20 | ||
| 887 | 20 | private function newTwigFactory( array $twigConfig ): TwigFactory { |
|
| 888 | 20 | return new TwigFactory( |
|
| 889 | 20 | array_merge_recursive( |
|
| 890 | $twigConfig, |
||
| 891 | [ 'web-basepath' => $this->config['web-basepath'] ] |
||
| 892 | ), |
||
| 893 | 20 | $this->getCachePath() . '/twig', |
|
| 894 | 20 | $this->config['locale'] |
|
| 895 | 20 | ); |
|
| 896 | 20 | } |
|
| 897 | |||
| 898 | private function newTextPolicyValidator( string $policyName ): TextPolicyValidator { |
||
| 899 | $fetcher = new ErrorLoggingFileFetcher( |
||
| 900 | 20 | new SimpleFileFetcher(), |
|
| 901 | 20 | $this->getLogger() |
|
| 902 | 20 | ); |
|
| 903 | 20 | $textPolicyConfig = $this->config['text-policies'][$policyName]; |
|
| 904 | 20 | return new TextPolicyValidator( |
|
| 905 | new WordListFileReader( |
||
| 906 | $fetcher, |
||
| 907 | $textPolicyConfig['badwords'] ? $this->getAbsolutePath( $textPolicyConfig['badwords'] ) : '' |
||
| 908 | 2 | ), |
|
| 909 | 2 | new WordListFileReader( |
|
| 910 | 2 | $fetcher, |
|
| 911 | 2 | $textPolicyConfig['whitewords'] ? $this->getAbsolutePath( $textPolicyConfig['whitewords'] ) : '' |
|
| 912 | 2 | ) |
|
| 913 | ); |
||
| 914 | } |
||
| 915 | |||
| 916 | 28 | private function newCommentPolicyValidator(): TextPolicyValidator { |
|
| 917 | 28 | return $this->newTextPolicyValidator( 'comment' ); |
|
| 918 | 28 | } |
|
| 919 | 28 | ||
| 920 | 28 | public function newCancelDonationUseCase( string $updateToken ): CancelDonationUseCase { |
|
| 921 | 28 | return new CancelDonationUseCase( |
|
| 922 | 28 | $this->getDonationRepository(), |
|
| 923 | $this->newCancelDonationMailer(), |
||
| 924 | 28 | $this->newDonationAuthorizer( $updateToken ), |
|
| 925 | 28 | $this->newDonationEventLogger() |
|
| 926 | ); |
||
| 927 | } |
||
| 928 | 28 | ||
| 929 | private function newCancelDonationMailer(): TemplateMailerInterface { |
||
| 930 | return $this->newTemplateMailer( |
||
| 931 | $this->getSuborganizationMessenger(), |
||
| 932 | new TwigTemplate( |
||
| 933 | 2 | $this->getMailerTwig(), |
|
| 934 | 2 | 'Donation_Cancellation_Confirmation.txt.twig', |
|
| 935 | [ 'greeting_generator' => $this->getGreetingGenerator() ] |
||
| 936 | ), |
||
| 937 | 2 | 'mail_subject_confirm_cancellation' |
|
| 938 | 2 | ); |
|
| 939 | } |
||
| 940 | |||
| 941 | 2 | public function newAddDonationUseCase(): AddDonationUseCase { |
|
| 942 | 2 | return new AddDonationUseCase( |
|
| 943 | $this->getDonationRepository(), |
||
| 944 | $this->newDonationValidator(), |
||
| 945 | 2 | $this->newDonationPolicyValidator(), |
|
| 946 | 2 | $this->newReferrerGeneralizer(), |
|
| 947 | $this->newDonationConfirmationMailer(), |
||
| 948 | $this->newBankTransferCodeGenerator(), |
||
| 949 | 3 | $this->newDonationTokenFetcher(), |
|
| 950 | 3 | new InitialDonationStatusPicker() |
|
| 951 | ); |
||
| 952 | } |
||
| 953 | 3 | ||
| 954 | 3 | private function newBankTransferCodeGenerator(): TransferCodeGenerator { |
|
| 955 | return new UniqueTransferCodeGenerator( |
||
| 956 | new SimpleTransferCodeGenerator(), |
||
| 957 | 47 | $this->getEntityManager() |
|
| 958 | 47 | ); |
|
| 959 | } |
||
| 960 | |||
| 961 | 36 | private function newDonationValidator(): AddDonationValidator { |
|
| 962 | 36 | return new AddDonationValidator( |
|
| 963 | $this->newPaymentDataValidator(), |
||
| 964 | $this->newBankDataValidator(), |
||
| 965 | 19 | $this->getEmailValidator() |
|
| 966 | 19 | ); |
|
| 967 | } |
||
| 968 | |||
| 969 | 2 | public function newValidateDonorUseCase(): ValidateDonorUseCase { |
|
| 970 | 2 | return new ValidateDonorUseCase( |
|
| 971 | $this->getEmailValidator() |
||
| 972 | ); |
||
| 973 | 3 | } |
|
| 974 | 3 | ||
| 975 | 3 | private function newDonationConfirmationMailer(): DonationConfirmationMailer { |
|
| 990 | 90 | ||
| 991 | 90 | public function newPayPalUrlGeneratorForDonations(): PayPalUrlGenerator { |
|
| 997 | |||
| 998 | public function newPayPalUrlGeneratorForMembershipApplications(): PayPalUrlGenerator { |
||
| 1004 | 3 | ||
| 1005 | private function getPayPalUrlConfigForDonations(): PayPalConfig { |
||
| 1008 | 5 | ||
| 1009 | 5 | private function getPayPalUrlConfigForMembershipApplications(): PayPalConfig { |
|
| 1012 | |||
| 1013 | public function newSofortUrlGeneratorForDonations(): SofortUrlGenerator { |
||
| 1026 | 11 | ||
| 1027 | 11 | public function setSofortClient( SofortClient $client ): void { |
|
| 1030 | 11 | ||
| 1031 | 11 | private function getSofortClient(): SofortClient { |
|
| 1034 | 11 | ||
| 1035 | private function newCreditCardUrlGenerator(): CreditCardUrlGenerator { |
||
| 1038 | 11 | ||
| 1039 | 11 | private function newCreditCardUrlConfig(): CreditCardConfig { |
|
| 1042 | 11 | ||
| 1043 | public function getDonationRepository(): DonationRepository { |
||
| 1046 | 11 | ||
| 1047 | 11 | public function newPaymentDataValidator(): PaymentDataValidator { |
|
| 1054 | 11 | ||
| 1055 | 11 | private function newAmountFormatter(): AmountFormatter { |
|
| 1058 | 2 | ||
| 1059 | 2 | public function newDecimalNumberFormatter(): NumberFormatter { |
|
| 1062 | 2 | ||
| 1063 | public function newAddCommentUseCase( string $updateToken ): AddCommentUseCase { |
||
| 1071 | |||
| 1072 | private function newDonationAuthorizer( string $updateToken = null, string $accessToken = null ): DonationAuthorizer { |
||
| 1079 | |||
| 1080 | 2 | public function getDonationTokenGenerator(): TokenGenerator { |
|
| 1083 | 2 | ||
| 1084 | 2 | public function getMembershipTokenGenerator(): MembershipTokenGenerator { |
|
| 1087 | |||
| 1088 | 2 | public function newDonationConfirmationPresenter( string $templateName = 'Donation_Confirmation.html.twig' ): DonationConfirmationHtmlPresenter { |
|
| 1099 | 13 | ||
| 1100 | 13 | public function newCreditCardPaymentUrlGenerator(): CreditCardPaymentUrlGenerator { |
|
| 1106 | |||
| 1107 | 7 | public function newCancelDonationHtmlPresenter(): CancelDonationHtmlPresenter { |
|
| 1112 | 10 | ||
| 1113 | public function newApplyForMembershipUseCase(): ApplyForMembershipUseCase { |
||
| 1125 | 15 | ||
| 1126 | 15 | private function newApplyForMembershipMailer(): TemplateMailerInterface { |
|
| 1137 | |||
| 1138 | 7 | private function newMembershipApplicationValidator(): MembershipApplicationValidator { |
|
| 1145 | |||
| 1146 | 2 | private function newMembershipApplicationTracker(): ApplicationTracker { |
|
| 1149 | 2 | ||
| 1150 | 2 | private function newMembershipApplicationPiwikTracker(): ApplicationPiwikTracker { |
|
| 1153 | 2 | ||
| 1154 | private function getPaymentDelayCalculator(): PaymentDelayCalculator { |
||
| 1157 | 2 | ||
| 1158 | 2 | public function getPaymentDelayInDays(): int { |
|
| 1161 | |||
| 1162 | public function setPaymentDelayCalculator( PaymentDelayCalculator $paymentDelayCalculator ): void { |
||
| 1165 | 1 | ||
| 1166 | private function newApplyForMembershipPolicyValidator(): ApplyForMembershipPolicyValidator { |
||
| 1172 | |||
| 1173 | public function newCancelMembershipApplicationUseCase( string $updateToken ): CancelMembershipApplicationUseCase { |
||
| 1180 | 2 | ||
| 1181 | private function newMembershipApplicationAuthorizer( |
||
| 1190 | |||
| 1191 | public function getMembershipApplicationRepository(): ApplicationRepository { |
||
| 1194 | 90 | ||
| 1195 | 90 | private function newCancelMembershipApplicationMailer(): TemplateMailerInterface { |
|
| 1206 | |||
| 1207 | public function newMembershipApplicationConfirmationUseCase( string $accessToken ): ShowMembershipApplicationConfirmationUseCase { |
||
| 1213 | |||
| 1214 | public function newShowDonationConfirmationUseCase( string $accessToken ): ShowDonationConfirmationUseCase { |
||
| 1221 | |||
| 1222 | public function setDonationConfirmationPageSelector( DonationConfirmationPageSelector $selector ): void { |
||
| 1225 | 12 | ||
| 1226 | public function getDonationConfirmationPageSelector(): DonationConfirmationPageSelector { |
||
| 1229 | 20 | ||
| 1230 | 20 | public function newDonationFormViolationPresenter(): DonationFormViolationPresenter { |
|
| 1233 | |||
| 1234 | public function newDonationFormPresenter(): DonationFormPresenter { |
||
| 1237 | |||
| 1238 | 20 | private function getDonationFormTemplate(): TwigTemplate { |
|
| 1245 | 2 | ||
| 1246 | 2 | public function getMembershipApplicationFormTemplate(): TwigTemplate { |
|
| 1251 | 2 | ||
| 1252 | public function newHandleSofortPaymentNotificationUseCase( string $updateToken ): SofortPaymentNotificationUseCase { |
||
| 1259 | 112 | ||
| 1260 | public function newHandlePayPalPaymentNotificationUseCase( string $updateToken ): HandlePayPalPaymentNotificationUseCase { |
||
| 1268 | |||
| 1269 | public function newMembershipApplicationSubscriptionSignupNotificationUseCase( string $updateToken ): HandleSubscriptionSignupNotificationUseCase { |
||
| 1277 | 118 | ||
| 1278 | 118 | public function newMembershipApplicationSubscriptionPaymentNotificationUseCase( string $updateToken ): HandleSubscriptionPaymentNotificationUseCase { |
|
| 1286 | |||
| 1287 | public function getPayPalPaymentNotificationVerifier(): PaymentNotificationVerifier { |
||
| 1290 | 2 | ||
| 1291 | 2 | public function setPayPalPaymentNotificationVerifier( PaymentNotificationVerifier $verifier ): void { |
|
| 1294 | |||
| 1295 | public function getPayPalMembershipFeeNotificationVerifier(): PaymentNotificationVerifier { |
||
| 1298 | 2 | ||
| 1299 | 2 | public function setPayPalMembershipFeeNotificationVerifier( PaymentNotificationVerifier $verifier ): void { |
|
| 1302 | |||
| 1303 | public function newCreditCardNotificationUseCase( string $updateToken ): CreditCardNotificationUseCase { |
||
| 1313 | |||
| 1314 | 109 | public function newCancelMembershipApplicationHtmlPresenter(): CancelMembershipApplicationHtmlPresenter { |
|
| 1319 | |||
| 1320 | public function newMembershipApplicationConfirmationHtmlPresenter(): MembershipApplicationConfirmationHtmlPresenter { |
||
| 1325 | 2 | ||
| 1326 | 2 | public function newMembershipFormViolationPresenter(): MembershipFormViolationPresenter { |
|
| 1331 | 11 | ||
| 1332 | public function setCreditCardService( CreditCardService $ccService ): void { |
||
| 1335 | 1 | ||
| 1336 | 1 | public function getCreditCardService(): CreditCardService { |
|
| 1339 | |||
| 1340 | 1 | public function newCreditCardNotificationPresenter(): CreditCardNotificationPresenter { |
|
| 1349 | |||
| 1350 | private function newDoctrineDonationPrePersistSubscriber(): DoctrineDonationPrePersistSubscriber { |
||
| 1356 | |||
| 1357 | private function newDoctrineMembershipApplicationPrePersistSubscriber(): DoctrineMembershipApplicationPrePersistSubscriber { |
||
| 1363 | |||
| 1364 | public function setDonationTokenGenerator( TokenGenerator $tokenGenerator ): void { |
||
| 1367 | |||
| 1368 | public function setMembershipTokenGenerator( MembershipTokenGenerator $tokenGenerator ): void { |
||
| 1371 | |||
| 1372 | public function disableDoctrineSubscribers(): void { |
||
| 1375 | |||
| 1376 | private function newDonationTokenFetcher(): DonationTokenFetcher { |
||
| 1381 | |||
| 1382 | private function newMembershipApplicationTokenFetcher(): ApplicationTokenFetcher { |
||
| 1387 | |||
| 1388 | private function newDonationPolicyValidator(): AddDonationPolicyValidator { |
||
| 1395 | |||
| 1396 | private function newDonationAmountPolicyValidator(): AmountPolicyValidator { |
||
| 1400 | |||
| 1401 | public function getDonationTimeframeLimit(): string { |
||
| 1404 | |||
| 1405 | public function newSystemMessageResponse( string $message ): string { |
||
| 1409 | |||
| 1410 | public function getMembershipApplicationTimeframeLimit(): string { |
||
| 1413 | |||
| 1414 | private function newAddCommentValidator(): AddCommentValidator { |
||
| 1417 | |||
| 1418 | private function getPageCache(): Cache { |
||
| 1421 | |||
| 1422 | private function getRenderedPageCache(): Cache { |
||
| 1425 | |||
| 1426 | public function enablePageCache(): void { |
||
| 1435 | |||
| 1436 | private function addProfilingDecorator( $objectToDecorate, string $profilingLabel ) { // @codingStandardsIgnoreLine |
||
| 1445 | |||
| 1446 | public function setProfiler( Stopwatch $profiler ): void { |
||
| 1449 | |||
| 1450 | public function setEmailValidator( EmailValidator $validator ): void { |
||
| 1453 | |||
| 1454 | public function setLogger( LoggerInterface $logger ): void { |
||
| 1457 | |||
| 1458 | public function setPaypalLogger( LoggerInterface $logger ): void { |
||
| 1461 | |||
| 1462 | public function setSofortLogger( LoggerInterface $logger ): void { |
||
| 1465 | |||
| 1466 | public function getProfilerDataCollector(): ProfilerDataCollector { |
||
| 1469 | |||
| 1470 | private function newIbanValidator(): KontoCheckIbanValidator { |
||
| 1473 | |||
| 1474 | public function setFilePrefixer( FilePrefixer $prefixer ): void { |
||
| 1477 | |||
| 1478 | private function getFilePrefixer(): FilePrefixer { |
||
| 1481 | |||
| 1482 | private function getFilePrefix(): string { |
||
| 1489 | |||
| 1490 | public function newDonationAcceptedEventHandler( string $updateToken ): DonationAcceptedEventHandler { |
||
| 1497 | |||
| 1498 | public function newPageNotFoundHtmlPresenter(): PageNotFoundPresenter { |
||
| 1501 | |||
| 1502 | public function setPageViewTracker( PageViewTracker $tracker ): void { |
||
| 1507 | |||
| 1508 | public function getPageViewTracker(): PageViewTracker { |
||
| 1511 | |||
| 1512 | public function newServerSideTracker(): ServerSideTracker { |
||
| 1519 | |||
| 1520 | public function getI18nDirectory(): string { |
||
| 1523 | |||
| 1524 | /** |
||
| 1525 | * If the pathname does not start with a slash, make the path absolute to root dir of application |
||
| 1526 | */ |
||
| 1527 | private function getAbsolutePath( string $path ): string { |
||
| 1533 | |||
| 1534 | public function setContentPagePageSelector( PageSelector $pageSelector ): void { |
||
| 1537 | |||
| 1538 | public function getContentPagePageSelector(): PageSelector { |
||
| 1541 | |||
| 1542 | public function setContentProvider( ContentProvider $contentProvider ): void { |
||
| 1545 | |||
| 1546 | private function getContentProvider(): ContentProvider { |
||
| 1549 | |||
| 1550 | public function newMailTemplateFilenameTraversable(): MailTemplateFilenameTraversable { |
||
| 1555 | |||
| 1556 | public function getUrlGenerator(): UrlGenerator { |
||
| 1559 | |||
| 1560 | public function setUrlGenerator( UrlGenerator $urlGenerator ): void { |
||
| 1563 | |||
| 1564 | public function getCookieBuilder(): CookieBuilder { |
||
| 1567 | |||
| 1568 | public function getSkinSettings(): SkinSettings { |
||
| 1571 | |||
| 1572 | public function getPaymentTypesSettings(): PaymentTypesSettings { |
||
| 1575 | |||
| 1576 | public function newDonationAmountConstraint(): ValidatorConstraint { |
||
| 1577 | return new RequiredConstraint( [ |
||
| 1578 | new TypeConstraint( [ 'type' => 'digit' ] ), |
||
| 1579 | new RangeConstraint( [ |
||
| 1580 | 'min' => $this->config['donation-minimum-amount'] * 100, |
||
| 1581 | 'max' => $this->config['donation-maximum-amount'] * 100 |
||
| 1582 | ] ) |
||
| 1583 | ] ); |
||
| 1584 | } |
||
| 1585 | } |
||
| 1586 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.