Class Phalcon\Service\Locatorr

implements Phalcon\Service\LocatorInterface

Source on GitHub



array $services = [];

array $mapper = [];


public function __construct( array $mapper = [] ): void

Key value pairs with name as the key and a callable as the value for the service object

public function __call( string $name, array $parameters ): mixed

Services being called via magic methods

public function get( string $name ): object

Get a service. If it is not in the mapper array, create a new object, set it and then return it.

public function has( string $name ): bool

Checks if a service exists in the map array

public function set( string $name, callable $service ): void

Set a new service to the mapper array