Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
Psr\Container\ContainerInterface Interface Reference
Inheritance diagram for Psr\Container\ContainerInterface:
DI\Container DI\CompiledContainer

Public Member Functions

 get (string $id)
 Finds an entry of the container by its identifier and returns it.
 
 has (string $id)
 Returns true if the container can return an entry for the given identifier.
 

Member Function Documentation

◆ get()

Psr\Container\ContainerInterface::get ( string $id)

Finds an entry of the container by its identifier and returns it.

Parameters
string$idIdentifier of the entry to look for.
Exceptions
NotFoundExceptionInterfaceNo entry was found for this identifier.
ContainerExceptionInterfaceError while retrieving the entry.
Return values
mixedEntry.

Implemented in DI\CompiledContainer, and DI\Container.

◆ has()

Psr\Container\ContainerInterface::has ( string $id)

Returns true if the container can return an entry for the given identifier.

Returns false otherwise.

has($id) returning true does not mean that get($id) will not throw an exception. It does however mean that get($id) will not throw a NotFoundExceptionInterface.

Parameters
string$idIdentifier of the entry to look for.
Return values
bool

Implemented in DI\CompiledContainer, and DI\Container.


The documentation for this interface was generated from the following file: