PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
give / vendor / vendor-prefixed / stellarwp / container-contract / examples / di52 / Container.php

Container.php in GiveWP – Donation Plugin and Fundraising Platform 4.18.0, at vendor/vendor-prefixed/stellarwp/container-contract/examples/di52/Container.php

69 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Your\Namespace;
4
5 use Give\Vendors\StellarWP\ContainerContract\ContainerInterface;
6
7 // If you are including lucatume\DI52 using Strauss (recommended), then:
8 use Your\Namespace\lucatume\DI52\Container as DI52Container;
9
10 // If you are including lucatume\DI52 directly, then you'd want to do:
11 // use lucatume\DI52\Container as DI52Container;
12
13 class Container implements ContainerInterface {
14 /**
15 * @var DI52Container
16 */
17 protected $container;
18
19 /**
20 * Container constructor.
21 *
22 * @param object $container The container to use.
23 */
24 public function __construct( $container = null ) {
25 $this->container = $container ?: new DI52Container();
26 }
27
28 /**
29 * @inheritDoc
30 */
31 public function bind( string $id, $implementation = null, array $afterBuildMethods = null ) {
32 $this->container->bind( $id, $implementation, $afterBuildMethods );
33 }
34
35 /**
36 * @inheritDoc
37 */
38 public function get( string $id ) {
39 return $this->container->get( $id );
40 }
41
42 /**
43 * @return DI52Container
44 */
45 public function get_container() {
46 return $this->container;
47 }
48
49 /**
50 * @inheritDoc
51 */
52 public function has( string $id ) {
53 return $this->container->has( $id );
54 }
55
56 /**
57 * @inheritDoc
58 */
59 public function singleton( string $id, $implementation = null, array $afterBuildMethods = null ) {
60 $this->container->singleton( $id, $implementation, $afterBuildMethods );
61 }
62
63 /**
64 * Defer all other calls to the container object.
65 */
66 public function __call( $name, $args ) {
67 return $this->container->{$name}( ...$args );
68 }
69 }