class Application (View source)

The core WP Emerge component representing an application.

Traits

Add methods to classes at runtime.
Load service providers.
Holds an IoC container.

Methods

boolean
hasAlias(string $alias)

Get whether an alias is registered.

array|null
getAlias(string $alias)

Get a registered alias.

void
setAlias(array $alias)

Register an alias.

void
alias(string $alias, string|Closure $target, string $method = '')

Register an alias.

mixed
__call(string $method, array $parameters)

Call alias if registered.

mixed|null
resolve(string $key)

Resolve a dependency from the IoC container.

Container
container()

Get the IoC container instance.

void
setContainer(Container $container)

Set the IoC container instance.

static Application
make()

Make a new application instance.

__construct(Container $container, boolean $render_config_exceptions = true)

Constructor.

boolean
isBootstrapped()

Get whether the application has been bootstrapped.

void
bootstrap(array $config = [], boolean $run = true)

Bootstrap the application.

void
renderConfigExceptions(Closure $action)

Catch any configuration exceptions and short-circuit to an error page.

Details

boolean hasAlias(string $alias)

Get whether an alias is registered.

Parameters

string $alias

Return Value

boolean

array|null getAlias(string $alias)

Get a registered alias.

Parameters

string $alias

Return Value

array|null

void setAlias(array $alias)

Register an alias.

Useful when passed the return value of getAlias() to restore a previously registered alias, for example.

Parameters

array $alias mixed> $alias

Return Value

void

void alias(string $alias, string|Closure $target, string $method = '')

Register an alias.

Identical to setAlias but with a more user-friendly interface.

Parameters

string $alias
string|Closure $target
string $method

Return Value

void

mixed __call(string $method, array $parameters)

Call alias if registered.

Parameters

string $method
array $parameters

Return Value

mixed

mixed|null resolve(string $key)

Resolve a dependency from the IoC container.

Parameters

string $key

Return Value

mixed|null

Container container()

Get the IoC container instance.

Return Value

Container

void setContainer(Container $container)

Set the IoC container instance.

Parameters

Container $container

Return Value

void

static Application make()

Make a new application instance.

Return Value

Application

__construct(Container $container, boolean $render_config_exceptions = true)

Constructor.

Parameters

Container $container
boolean $render_config_exceptions

boolean isBootstrapped()

Get whether the application has been bootstrapped.

Return Value

boolean

void bootstrap(array $config = [], boolean $run = true)

Bootstrap the application.

Parameters

array $config
boolean $run

Return Value

void

void renderConfigExceptions(Closure $action)

Catch any configuration exceptions and short-circuit to an error page.

Parameters

Closure $action

Return Value

void