Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
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: