InstanceofConfigurator

class InstanceofConfigurator extends AbstractServiceConfigurator

Traits

AutowireTrait
CallTrait
ConfiguratorTrait
LazyTrait
PropertyTrait
PublicTrait
ShareTrait
TagTrait

Constants

FACTORY

Methods

__call($method, $args) from AbstractConfigurator
static mixed processValue(mixed $value, bool $allowServices = false)

Checks that a value is valid, optionally replacing Definition and Reference configurators by their configure value.

from AbstractConfigurator
__construct(ServicesConfigurator $parent, Definition $definition, $id = null, array $defaultTags = array()) from AbstractServiceConfigurator
__destruct() from AbstractServiceConfigurator
ServiceConfigurator set(string $id, string|null $class = null)

Registers a service.

from AbstractServiceConfigurator
AliasConfigurator alias($id, $referencedId)

Creates an alias.

from AbstractServiceConfigurator
PrototypeConfigurator load(string $namespace, string $resource)

Registers a PSR-4 namespace using a glob pattern.

from AbstractServiceConfigurator
ServiceConfigurator get(string $id)

Gets an already defined service definition.

from AbstractServiceConfigurator
ServiceConfigurator __invoke(string $id, string|null $class = null)

Registers a service.

from AbstractServiceConfigurator
$this autowire(bool $autowired = true)

Enables/disables autowiring.

from AutowireTrait
$this call(string $method, array $arguments = array())

Adds a method to call after service initialization.

from CallTrait
$this configurator(string|array $configurator)

Sets a configurator to call after the service is fully initialized.

from ConfiguratorTrait
$this lazy(bool $lazy = true)

Sets the lazy flag of this service.

from LazyTrait
$this property(string $name, mixed $value)

Sets a specific property.

from PropertyTrait
$this share(bool $shared = true)

Sets if the service must be shared or not.

from ShareTrait
$this tag(string $name, array $attributes = array())

Adds a tag for this definition.

from TagTrait
InstanceofConfigurator instanceof(string $fqcn)

Details

__call($method, $args)

Parameters

$method
$args

static mixed processValue(mixed $value, bool $allowServices = false)

Checks that a value is valid, optionally replacing Definition and Reference configurators by their configure value.

Parameters

mixed $value
bool $allowServices whether Definition and Reference are allowed; by default, only scalars and arrays are

Return Value

mixed the value, optionaly cast to a Definition/Reference

__construct(ServicesConfigurator $parent, Definition $definition, $id = null, array $defaultTags = array())

Parameters

ServicesConfigurator $parent
Definition $definition
$id
array $defaultTags

__destruct()

final ServiceConfigurator set(string $id, string|null $class = null)

Registers a service.

Parameters

string $id
string|null $class

Return Value

ServiceConfigurator

final AliasConfigurator alias($id, $referencedId)

Creates an alias.

Parameters

$id
$referencedId

Return Value

AliasConfigurator

final PrototypeConfigurator load(string $namespace, string $resource)

Registers a PSR-4 namespace using a glob pattern.

Parameters

string $namespace
string $resource

Return Value

PrototypeConfigurator

final ServiceConfigurator get(string $id)

Gets an already defined service definition.

Parameters

string $id

Return Value

ServiceConfigurator

Exceptions

ServiceNotFoundException if the service definition does not exist

final ServiceConfigurator __invoke(string $id, string|null $class = null)

Registers a service.

Parameters

string $id
string|null $class

Return Value

ServiceConfigurator

final $this autowire(bool $autowired = true)

Enables/disables autowiring.

Parameters

bool $autowired

Return Value

$this

final $this call(string $method, array $arguments = array())

Adds a method to call after service initialization.

Parameters

string $method The method name to call
array $arguments An array of arguments to pass to the method call

Return Value

$this

Exceptions

InvalidArgumentException on empty $method param

final $this configurator(string|array $configurator)

Sets a configurator to call after the service is fully initialized.

Parameters

string|array $configurator A PHP callable reference

Return Value

$this

final $this lazy(bool $lazy = true)

Sets the lazy flag of this service.

Parameters

bool $lazy

Return Value

$this

final $this property(string $name, mixed $value)

Sets a specific property.

Parameters

string $name
mixed $value

Return Value

$this

final $this share(bool $shared = true)

Sets if the service must be shared or not.

Parameters

bool $shared Whether the service must be shared or not

Return Value

$this

final $this tag(string $name, array $attributes = array())

Adds a tag for this definition.

Parameters

string $name The tag name
array $attributes An array of attributes

Return Value

$this

InstanceofConfigurator instanceof(string $fqcn)

Parameters

string $fqcn

Return Value

InstanceofConfigurator