Container Class

Aurora\Container Namespace

Interfaces

  • I ContainerInterface

Properties

services

Services array

protected $services = []: array

providers

Providers array

protected $providers = []: array

booted

Booted providers array

protected $booted = []: array

instances

Instances array

protected $instances = []: array

Methods

get

Get service instance

Parameters

  • string $name — Service name

Return Value

  • mixed

Signature

public function get(string $name)

set

Override a service instance

Parameters

  • string $name — Service name
  • object $instance — Service instance

Return Value

  • $this

Signature

public function set(string $name, object $instance)

has

Check if a service is known

Parameters

  • string $name — Service name

Return Value

  • bool

Signature

public function has(string $name): bool

make

Create a new instance regardless of the shared flag

Parameters

  • string $name — Service name
  • array $arguments — Constructor arguments

Return Value

  • mixed

Signature

public function make(string $name, array $arguments = [])

add

Register a new service

Parameters

  • string $name — Service name
  • mixed $instance — Service instance, factory or class name (for aliased services)

Return Value

  • \Service

Signature

public function add(string $name, mixed $instance): Aurora\Container\Service

provider

Add a new service provider

Parameters

  • Aurora\Container\ProviderInterface $provider — Service provider

Return Value

  • $this

Signature

public function provider(Aurora\Container\ProviderInterface $provider)

bootstrap

Bootstrap service providers

Parameters

  • Aurora\Settings\SettingsInterface $settings

Signature

public function bootstrap(Aurora\Settings\SettingsInterface $settings)

shared

Register a new service as Shared

Parameters

  • string $name — Service name
  • mixed $instance — Service instance, factory or class name (for aliased services)

Return Value

  • \Service

Signature

public function shared(string $name, mixed $instance): Aurora\Container\Service

create

Create a service instance

Parameters

  • string $name — Service name

Return Value

  • object

Signature

protected function create(string $name): object

instance

Get an instance of the given class

Parameters

  • string $class — Class name
  • array $arguments — Constructor arguments
  • bool $override — Whether to override constructor parameters or not

Return Value

  • object

Signature

protected function instance(string $class, array $arguments = [], bool $override): object

resolve

Resolve dependencies from parameters

Parameters

  • array $parameters — Array of parameters
  • array $arguments — Array of arguments
  • bool $override — Whether to override constructor parameters or not

Return Value

  • array

Signature

protected function resolve(array $parameters, array $arguments, bool $override): array

decorate

Run initialization method calls

Parameters

  • object $instance — Service instance
  • array $methods — Array of method calls

Return Value

  • $this

Signature

protected function decorate(object $instance, array $methods)

Go to top