375. Class

375.1. Zend\Di\ServiceLocator

Simple service locator implementation capable of using closures to generate instances

375.1.1. Methods

375.1.1.1. set

set()

{@inheritDoc}

375.1.1.2. get

get()

Retrieve a registered service

Tests first if a value is registered for the service, and, if so, returns it.

If the value returned is a non-object callback or closure, the return value is retrieved, stored, and returned. Parameters passed to the method are passed to the callback, but only on the first retrieval.

If the service requested matches a method in the method map, the return value of that method is returned. Parameters are passed to the matching method.

Parameters:
  • string
  • array
Return type:

mixed

Project Versions

Table Of Contents

Previous topic

374. Function

Next topic

376. Function

This Page