\Phile\CoreContainer

Implements a simple PSR-11 container

Summary

Methods
Properties
Constants
__construct()
setInstance()
getInstance()
has()
get()
set()
No public properties found
No constants found
typeCheck()
$config
$instance
$raw
$build
N/A
No private methods found
No private properties found
N/A

Properties

$config

$config :array

Type

array—Container configuration

$raw

$raw :array

Type

array—raw items

$build

$build :array

Type

array—evaluated items

Methods

__construct()

__construct(array  $config = array())

Constructor

Parameters

array $config

Container configuration

  • types array with =>

setInstance()

setInstance(\Phile\Core\Container  $instance): void

Sets instance for static usage

Parameters

\Phile\Core\Container $instance

getInstance()

getInstance(): self

Gets instance for static usage

Returns

self

has()

has(  $id)

{@inheritdoc}

Parameters

$id

get()

get(  $id)

{@inheritdoc}

Parameters

$id

set()

set(string  $id,mixed  $object): self

Set an object

Parameters

string $id

Identifier for the object to set

mixed $object

Object to set

Returns

self

typeCheck()

typeCheck(string  $id,mixed  $object): void

Check object-type matches required type for that ID

Parameters

string $id
mixed $object

Throws

\Phile\Exception\ContainerException