PHP Класс Essence\Di\Container

Inspired by Pimple (https://github.com/fabpot/Pimple). Pimple wasn't used because of the way composer works. If someone were working on a project using Pimple in a different version than Essence's, the installation would fail.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_properties array Container properties.

Открытые методы

Метод Описание
configure ( array $properties ) Merges the given properties with the current ones.
get ( string $property, mixed $default = null ) : mixed Returns the value of the given property.
set ( string $property, mixed $value ) Sets the value of the given property.
unique ( Closure $closure ) : Closure Returns a wrapper that memoizes the result of the given closure.

Описание методов

configure() публичный Метод

Merges the given properties with the current ones.
public configure ( array $properties )
$properties array Properties to merge.

get() публичный Метод

Returns the value of the given property.
public get ( string $property, mixed $default = null ) : mixed
$property string Property name.
$default mixed Default value to be returned in case the property doesn't exists.
Результат mixed The property value, or the result of the closure execution if property is a closure, or $default.

set() публичный Метод

Sets the value of the given property.
public set ( string $property, mixed $value )
$property string Property name.
$value mixed New value.

unique() публичный статический Метод

Returns a wrapper that memoizes the result of the given closure.
public static unique ( Closure $closure ) : Closure
$closure Closure Closure to wrap.
Результат Closure Wrapper.

Описание свойств

$_properties защищенное свойство

Container properties.
protected array $_properties
Результат array