PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.8.14
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.8.14
7.8.14 7.8.14.1 7.8.13 7.8.13.1 trunk 3.0 3.1 3.1.1 3.1.2 3.1.3 3.1.4 4.3.2 4.4.4 4.4.5 4.4.5.1 4.4.5.4 4.6 4.6.1.1 4.6.1.4 4.7.0.2 4.7.0.3 4.7.0.7 4.7.0.9 4.7.1.0 4.7.1.1 4.8.0.0 5.0.0 5.0.1 5.0.1.1 5.0.1.2 5.1 5.1.1 5.1.2 5.1.3 5.1.3.1 5.1.3.2 5.1.4 5.1.5 6.0 6.0.1 6.0.2 6.0.3 6.0.4.2 6.0.5 6.0.6.1 6.0.7 6.0.8.1 6.0.9 7.0.0.1 7.0.2 7.0.3 7.0.4 7.1.0 7.1.1 7.2.0 7.2.1 7.3.0 7.3.1 7.3.3 7.3.5 7.3.6 7.3.7 7.4.0 7.4.1 7.4.11 7.4.13 7.4.13.1 7.4.2 7.4.3 7.4.4 7.4.5 7.4.5.1 7.4.5.2 7.4.6 7.4.7 7.5.0 7.6.0 7.6.1 7.6.3 7.6.4 7.6.6 7.7.0 7.7.1 7.8.0 7.8.1 7.8.10 7.8.10.1 7.8.10.2 7.8.11 7.8.12 7.8.12.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.8.9.1 7.8.9.2 7.8.9.3
wordpress-popup / lib / plugins-cross-sell-page / core / class-container.php
wordpress-popup / lib / plugins-cross-sell-page / core Last commit date
class-container.php 1 year ago class-loader.php 1 year ago class-rest-api.php 1 year ago class-utilities.php 5 months ago plugins-list.php 5 months ago
class-container.php
64 lines
1 <?php
2 /**
3 * The Container class used for DI.
4 *
5 * @link https://wpmudev.com/
6 * @since 1.0.0
7 *
8 * @author WPMUDEV (https://wpmudev.com)
9 * @package WPMUDEV/Plugin_Cross_Sell
10 *
11 * @copyright (c) 2025, Incsub (http://incsub.com)
12 */
13
14 namespace WPMUDEV\Modules\Plugin_Cross_Sell;
15
16 /**
17 * Dependency Injection Container class.
18 *
19 * @since 1.0.0
20 */
21 class Container {
22 /**
23 * Services list.
24 *
25 * @var array
26 */
27 private $services = array();
28
29 /**
30 * Pushes a service into the container.
31 *
32 * @param string $key Service key.
33 * @param mixed $value Service.
34 * @return void
35 */
36 public function set( string $key, $value ): void {
37 $this->services[ $key ] = $value;
38 }
39
40 /**
41 * Fetches a service from the container.
42 *
43 * @param string $key Service key.
44 * @throws \InvalidArgumentException If service not found.
45 */
46 public function get( string $key ) {
47 if ( ! isset( $this->services[ $key ] ) ) {
48 throw new \InvalidArgumentException( esc_html( "Service '{$key}' not found in container." ) );
49 }
50
51 return $this->services[ $key ];
52 }
53
54 /**
55 * Checks if a service is registered.
56 *
57 * @param string $key Service key.
58 * @return bool
59 */
60 public function has( string $key ): bool {
61 return isset( $this->services[ $key ] );
62 }
63 }
64