PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.8.0
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.8.0
5.8.0 5.8.1 5.7.0 5.6.2 5.6.3 5.6.1 5.6.0 5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 All 41 releases
double-opt-in / src / Providers / SetupServiceProvider.php

SetupServiceProvider.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 5.8.0, at src/Providers/SetupServiceProvider.php

81 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Setup Wizard Service Provider
4 *
5 * @package Forge12\DoubleOptIn\Providers
6 * @since 5.7.0
7 */
8
9 declare( strict_types=1 );
10
11 namespace Forge12\DoubleOptIn\Providers;
12
13 use Forge12\DoubleOptIn\Container\BootableProviderInterface;
14 use Forge12\DoubleOptIn\Container\Container;
15 use Forge12\DoubleOptIn\FormSettings\FormSettingsService;
16 use Forge12\DoubleOptIn\Setup\FormDefaults;
17 use Forge12\DoubleOptIn\Setup\FormPluginDetector;
18 use Forge12\DoubleOptIn\Setup\SetupMailComposer;
19 use Forge12\DoubleOptIn\Setup\SetupRedirect;
20 use Forge12\DoubleOptIn\Setup\SetupRestController;
21 use Forge12\DoubleOptIn\Setup\SetupService;
22 use Forge12\DoubleOptIn\Setup\SetupState;
23
24 if ( ! defined( 'ABSPATH' ) ) {
25 exit;
26 }
27
28 /**
29 * Registers the setup wizard: state, REST routes, activation redirect and
30 * the sender defaults it stores.
31 */
32 class SetupServiceProvider implements BootableProviderInterface {
33
34 /**
35 * {@inheritdoc}
36 */
37 public function register( Container $container ): void {
38 $container->singleton(
39 SetupState::class,
40 static function () {
41 return new SetupState();
42 }
43 );
44 $container->singleton(
45 FormPluginDetector::class,
46 static function () {
47 return new FormPluginDetector();
48 }
49 );
50 $container->singleton(
51 SetupService::class,
52 static function ( Container $c ) {
53 return new SetupService(
54 $c->get( SetupState::class ),
55 $c->get( FormSettingsService::class ),
56 $c->get( FormPluginDetector::class ),
57 new SetupMailComposer()
58 );
59 }
60 );
61 $container->singleton(
62 SetupRestController::class,
63 static function ( Container $c ) {
64 return new SetupRestController(
65 $c->get( SetupService::class ),
66 $c->get( SetupState::class )
67 );
68 }
69 );
70 }
71
72 /**
73 * {@inheritdoc}
74 */
75 public function boot( Container $container ): void {
76 $container->get( SetupRestController::class )->init();
77 SetupRedirect::register();
78 FormDefaults::register();
79 }
80 }
81