/var/www/html_us/wp-content/plugins/wp-smtp/src/Mail/Container.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php

namespace SolidWP\Mail;

use 
SolidWP\Mail\lucatume\DI52\Container as DI52Container;
use 
SolidWP\Mail\StellarWP\ContainerContract\ContainerInterface;

if ( ! 
defined'ABSPATH' ) ) {
    exit;
}

/**
 * A local container implementation.
 *
 * @since 2.0.0
 *
 * @package SolidWP\Mail
 *
 * @method mixed getVar(string $key, mixed|null $default = null)
 * @method void setVar(string $key, mixed $value)
 * @method void register(string $serviceProviderClass, string ...$alias)
 * @method self when(string $class)
 * @method self needs(string $id)
 * @method void give(mixed $implementation)
 * @method void callback(string|object $id, string $method)
 */
class Container implements ContainerInterface {

    
/**
     * @since 0.1.0
     *
     * @var DI52Container
     */
    
protected DI52Container $container;

    
/**
     * Container constructor.
     *
     * @since 0.1.0
     *
     * @param DI52Container $container The container to use.
     */
    
public function __constructDI52Container $container null ) {
        
$this->container $container ?: new DI52Container();
    }

    
/**
     * {@inheritdoc}
     */
    
public function bindstring $id$implementation null, array $after_build_methods null ) {
        
$this->container->bind$id$implementation$after_build_methods );
    }

    
/**
     * {@inheritdoc}
     */
    
public function getstring $id ) {
        return 
$this->container->get$id );
    }

    
/**
     * @since 0.1.0
     *
     * @return DI52Container
     */
    
public function get_container() {
        return 
$this->container;
    }

    
/**
     * {@inheritdoc}
     */
    
public function hasstring $id ) {
        return 
$this->container->has$id );
    }

    
/**
     * {@inheritdoc}
     */
    
public function singletonstring $id$implementation null, array $after_build_methods null ) {
        
$this->container->singleton$id$implementation$after_build_methods );
    }

    
/**
     * Defer all other calls to the container object.
     *
     * @since 0.1.0
     *
     * @param string $name The name of the method to call.
     * @param array  $args The arguments to pass to the method.
     */
    
public function __call$name$args ) {
        return 
$this->container->{$name}( ...$args );
    }
}