| @@ -3,10 +3,34 @@ | ||
| 3 | 3 | declare(strict_types=1); |
| 4 | 4 | |
| 5 | 5 | namespace Psr\Container; |
| 6 | 6 | |
| 7 | +/** | |
| 8 | + * Describes the interface of a container that exposes methods to read its entries. | |
| 9 | + */ | |
| 7 | 10 | interface ContainerInterface |
| 8 | 11 | { |
| 12 | + /** | |
| 13 | + * Finds an entry of the container by its identifier and returns it. | |
| 14 | + * | |
| 15 | + * @param string $id Identifier of the entry to look for. | |
| 16 | + * | |
| 17 | + * @throws NotFoundExceptionInterface No entry was found for **this** identifier. | |
| 18 | + * @throws ContainerExceptionInterface Error while retrieving the entry. | |
| 19 | + * | |
| 20 | + * @return mixed Entry. | |
| 21 | + */ | |
| 9 | 22 | public function get(string $id); |
| 10 | 23 | |
| 24 | + /** | |
| 25 | + * Returns true if the container can return an entry for the given identifier. | |
| 26 | + * Returns false otherwise. | |
| 27 | + * | |
| 28 | + * `has($id)` returning true does not mean that `get($id)` will not throw an exception. | |
| 29 | + * It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`. | |
| 30 | + * | |
| 31 | + * @param string $id Identifier of the entry to look for. | |
| 32 | + * | |
| 33 | + * @return bool | |
| 34 | + */ | |
| 11 | 35 | public function has(string $id); |
| 12 | 36 | } |