App

package Klein

 Methods

Magic "__call" method

__call(callable $method, array $args) : void

Allows the ability to arbitrarily call a property as a callable method Allow callbacks to be assigned as properties and called like normal methods

access public

Parameters

$method

callable

The callable method to execute

$args

array

The argument array to pass to our callback

Exceptions

\BadMethodCallException If a non-registered method is attempted to be called

Magic "__get" method

__get(string $name) : mixed

Allows the ability to arbitrarily request a service from this instance while treating it as an instance property

This checks the lazy service register and automatically calls the registered service method

access public

Parameters

$name

string

The name of the service

Exceptions

\Klein\Exceptions\UnknownServiceException If a non-registered service is attempted to fetched

Returns

mixed

Register a lazy service

register(string $name, callable $closure) : mixed
access public

Parameters

$name

string

The name of the service

$closure

callable

The callable function to execute when requesting our service

Exceptions

\Klein\Exceptions\DuplicateServiceException If an attempt is made to register two services with the same name

Returns

mixed

 Properties

 

$services : array
access protected