OptimizedPhpArrayDumper
class OptimizedPhpArrayDumper extends Dumper (View source)
OptimizedPhpArrayDumper dumps a service container as a serialized PHP array.
The format of this dumper is very similar to the internal structure of the ContainerBuilder, but based on PHP arrays and \stdClass objects instead of rich value objects for performance reasons.
By removing the abstraction and optimizing some cases like deep collections, fewer classes need to be loaded, fewer function calls need to be executed and fewer run time checks need to be made.
In addition to that, this container dumper treats private services as strictly private with their own private services storage, whereas in the Symfony service container builder and PHP dumper, shared private services can still be retrieved via get() from the container.
It is machine-optimized, for a human-readable version based on this one see \Drupal\Component\DependencyInjection\Dumper\PhpArrayDumper.
Properties
| protected bool | $serialize | Whether to serialize service definitions or not. |
|
| protected array | $aliases | A list of container aliases. |
Methods
{@inheritdoc}
Gets the service container definition as a PHP array.
Gets the aliases as a PHP array.
Gets parameters of the container as a PHP array.
Gets services of the container as a PHP array.
Prepares parameters for the PHP array dumping.
Escapes parameters.
Gets a service definition as PHP array.
Dumps method calls to a PHP array.
Dumps a collection to a PHP array.
Dumps callable to a PHP array.
Gets a private service definition in a suitable format.
Dumps the value to PHP array format.
Gets a service reference for a reference in a suitable PHP array format.
Gets a service reference for an ID in a suitable PHP array format.
Gets a parameter reference in a suitable PHP array format.
Whether this supports the machine-optimized format or not.
Details
dump(array $options = [])
{@inheritdoc}
array
getArray()
Gets the service container definition as a PHP array.
protected array
getAliases()
Gets the aliases as a PHP array.
protected array
getParameters()
Gets parameters of the container as a PHP array.
protected array
getServiceDefinitions()
Gets services of the container as a PHP array.
protected array
prepareParameters(array $parameters, bool $escape = TRUE)
Prepares parameters for the PHP array dumping.
protected array
escape(array $parameters)
Escapes parameters.
protected array
getServiceDefinition(Definition $definition)
Gets a service definition as PHP array.
protected array
dumpMethodCalls(array $calls)
Dumps method calls to a PHP array.
protected object|array
dumpCollection(mixed $collection, bool $resolve = FALSE)
Dumps a collection to a PHP array.
protected callable
dumpCallable(array|callable $callable)
Dumps callable to a PHP array.
protected object
getPrivateServiceCall(string $id, Definition $definition, bool $shared = FALSE)
Gets a private service definition in a suitable format.
protected mixed
dumpValue(mixed $value)
Dumps the value to PHP array format.
protected string|object
getReferenceCall(string $id, Reference $reference = NULL)
Gets a service reference for a reference in a suitable PHP array format.
The main difference is that this function treats references to private services differently and returns a private service reference instead of a normal reference.
protected string|object
getServiceCall(string $id, int $invalid_behavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
Gets a service reference for an ID in a suitable PHP array format.
protected string|object
getParameterCall(string $name)
Gets a parameter reference in a suitable PHP array format.
protected bool
supportsMachineFormat()
Whether this supports the machine-optimized format or not.