Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
DI\FactoryInterface Interface Reference
Inheritance diagram for DI\FactoryInterface:
DI\Container DI\CompiledContainer

Public Member Functions

 make (string $name, array $parameters=[])
 Resolves an entry by its name.
 

Member Function Documentation

◆ make()

DI\FactoryInterface::make ( string $name,
array $parameters = [] )

Resolves an entry by its name.

If given a class name, it will return a new instance of that class.

Parameters
string$nameEntry name or a class name.
array$parametersOptional parameters to use to build the entry. Use this to force specific parameters to specific values. Parameters not defined in this array will be automatically resolved.
Exceptions
InvalidArgumentExceptionThe name parameter must be of type string.
DependencyExceptionError while resolving the entry.
NotFoundExceptionNo entry or class found for the given name.

Implemented in DI\Container.


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