PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.5.0
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.5.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 3.0.60 3.0.61 3.0.62 3.0.70 3.0.71 3.0.72 3.1.0 All 34 releases
double-opt-in / src / Providers / RepositoryServiceProvider.php

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

65 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Repository Service Provider
4 *
5 * @package Forge12\DoubleOptIn\Providers
6 * @since 4.0.0
7 */
8
9 namespace Forge12\DoubleOptIn\Providers;
10
11 use Forge12\DoubleOptIn\Container\Container;
12 use Forge12\DoubleOptIn\Container\ServiceProviderInterface;
13 use Forge12\DoubleOptIn\Repository\OptInRepository;
14 use Forge12\DoubleOptIn\Repository\OptInRepositoryInterface;
15 use Forge12\DoubleOptIn\Service\OptInLinkGenerator;
16 use Forge12\DoubleOptIn\Service\OptInValidator;
17 use Forge12\Shared\LoggerInterface;
18
19 if ( ! defined( 'ABSPATH' ) ) {
20 exit;
21 }
22
23 /**
24 * Class RepositoryServiceProvider
25 *
26 * Registers repository and service bindings.
27 */
28 class RepositoryServiceProvider implements ServiceProviderInterface {
29
30 /**
31 * {@inheritdoc}
32 */
33 public function register( Container $container ): void {
34 // OptIn Repository
35 $container->singleton(
36 OptInRepositoryInterface::class,
37 function ( Container $c ) {
38 global $wpdb;
39 return new OptInRepository(
40 $wpdb,
41 $c->get( LoggerInterface::class )
42 );
43 }
44 );
45
46 // OptIn Link Generator
47 $container->singleton(
48 OptInLinkGenerator::class,
49 function () {
50 return new OptInLinkGenerator();
51 }
52 );
53
54 // OptIn Validator
55 $container->singleton(
56 OptInValidator::class,
57 function ( Container $c ) {
58 return new OptInValidator(
59 $c->get( LoggerInterface::class )
60 );
61 }
62 );
63 }
64 }
65