| 1 |
<?php |
| 2 |
/** |
| 3 |
* PSR-11 Compatible Container Interface |
| 4 |
* |
| 5 |
* @package Forge12\DoubleOptIn\Container |
| 6 |
* @since 4.0.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace Forge12\DoubleOptIn\Container; |
| 10 |
|
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; |
| 13 |
} |
| 14 |
|
| 15 |
/** |
| 16 |
* Interface ContainerInterface |
| 17 |
* |
| 18 |
* @api |
| 19 |
* |
| 20 |
* Describes the interface of a container that exposes methods to read its entries. |
| 21 |
* PSR-11 compatible. Passed to every addon's boot() method as the sole |
| 22 |
* argument. Addons resolve Core services through it. |
| 23 |
* |
| 24 |
* Covered by the Addon API semver policy as of Core API 4.3.0. |
| 25 |
*/ |
| 26 |
interface ContainerInterface { |
| 27 |
|
| 28 |
/** |
| 29 |
* Finds an entry of the container by its identifier and returns it. |
| 30 |
* |
| 31 |
* @param string $id Identifier of the entry to look for. |
| 32 |
* |
| 33 |
* @return mixed Entry. |
| 34 |
* @throws NotFoundException No entry was found for this identifier. |
| 35 |
*/ |
| 36 |
public function get( string $id ); |
| 37 |
|
| 38 |
/** |
| 39 |
* Returns true if the container can return an entry for the given identifier. |
| 40 |
* |
| 41 |
* @param string $id Identifier of the entry to look for. |
| 42 |
* |
| 43 |
* @return bool |
| 44 |
*/ |
| 45 |
public function has( string $id ): bool; |
| 46 |
} |
| 47 |
|