PhpDumper dumps a service container as a PHP class.

public Symfony\Component\DependencyInjection\Dumper\PhpDumper::FIRST_CHARS = 'abcdefghijklmnopqrstuvwxyz'

Characters that might appear in the generated variable name as first character.

public Symfony\Component\DependencyInjection\Dumper\PhpDumper::NON_FIRST_CHARS = 'abcdefghijklmnopqrstuvwxyz0123456789_'

Characters that might appear in the generated variable name as any but the first character.

public __construct(Symfony\Component\DependencyInjection\ContainerBuilder $container)
public dump(array $options = []) : array|string

Dumps the service container as a PHP class.

Available options:

  • class: The class name
  • base_class: The base class name
  • namespace: The class namespace
  • as_files: To split the container in several files
  • return string|array A PHP class representing the service container or an array of PHP files if the "as_files" option is set
  • throws \EnvParameterException When an env var exists but has not been dumped
public setProxyDumper(Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface $proxyDumper)

Sets the dumper to be used when dumping proxies in the generated container.

  • return void
protected Symfony\Component\DependencyInjection\Dumper\Dumper::$container = NULL
private bool $addGetService = false
private bool $asFiles
private string $baseClass
private array $circularReferences = []
private string $class
private ?SplObjectStorage $definitionVariables = NULL
  • var \SplObjectStorage<\Definition,\Variable>|null
private string $docStar
private array $dynamicParameters = []
private array $exportedVariables = []
private Symfony\Component\DependencyInjection\ExpressionLanguage $expressionLanguage
private bool $hasProxyDumper = true
private string $hotPathTag
private ?SplObjectStorage $inlinedDefinitions = NULL
private array $inlinedRequires = []
private bool $inlineFactories
private bool $inlineRequires
private array $locatedIds = []
private string $namespace
private array $preload = []
private array $preloadTags
private Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface $proxyDumper
private ?array $referenceVariables = NULL
private array $reservedVariables = ['instance', 'class', 'this', 'container']
private ?array $serviceCalls = NULL
private array $serviceIdToMethodNameMap
private string $serviceLocatorTag
private array $singleUsePrivateIds = []
private int $targetDirMaxMatches
private ?string $targetDirRegex = NULL
private array $usedMethodNames
private int $variableCount
private addAliases() : string
private addCircularReferences(string $sourceId, array $currentPath, bool $byConstructor) : void
private addDefaultParametersMethod() : string
private addDeprecatedAliases() : string
private addDeprecatedParameters() : string
private addFileMap() : string
private addInlineReference(string $id, Symfony\Component\DependencyInjection\Definition $definition, string $targetId, bool $forConstructor) : string
private addInlineRequires(bool $hasProxyClasses) : string
private addInlineService(string $id, Symfony\Component\DependencyInjection\Definition $definition, ?Symfony\Component\DependencyInjection\Definition $inlineDef = NULL, bool $forConstructor = true) : string
private addInlineVariables(string $id, Symfony\Component\DependencyInjection\Definition $definition, array $arguments, bool $forConstructor) : string
private addMethodMap() : string
private addNewInstance(Symfony\Component\DependencyInjection\Definition $definition, string $return = '', ?string $id = NULL, bool $asGhostObject = false) : string
private addRemovedIds() : string
private addService(string $id, Symfony\Component\DependencyInjection\Definition $definition) : array
private addServiceConfigurator(Symfony\Component\DependencyInjection\Definition $definition, string $variableName = 'instance') : string
private addServiceInclude(string $cId, Symfony\Component\DependencyInjection\Definition $definition, bool $isProxyCandidate) : string
private addServiceInstance(string $id, Symfony\Component\DependencyInjection\Definition $definition, bool $isSimpleInstance) : string
  • throws \InvalidArgumentException
  • throws \RuntimeException
private addServiceMethodCalls(Symfony\Component\DependencyInjection\Definition $definition, string $variableName, ?string $sharedNonLazyId) : string
private addServiceProperties(Symfony\Component\DependencyInjection\Definition $definition, string $variableName = 'instance') : string
private addServices(?array $services = NULL) : string
private addSyntheticIds() : string
private analyzeReferences() : void
private collectCircularReferences(string $sourceId, array $edges, array $checkedNodes, array $loops = [], array $path = [], bool $byConstructor = true) : void
private collectLineage(string $class, array $lineage) : void
private doExport(?mixed $value, bool $resolveEnv = false) : ?mixed
private dumpLiteralClass(string $class) : string

Dumps a string to a literal (aka PHP Code) class value.

  • throws \RuntimeException
private dumpParameter(string $name) : string
private dumpValue(?mixed $value, bool $interpolate = true) : string
  • throws \RuntimeException
private endClass() : string
private export(?mixed $value) : ?mixed
private exportParameters(array $parameters, string $path = '', int $indent = 12, bool $hasEnum = false) : string
  • throws \InvalidArgumentException
private generateMethodName(string $id) : string
  • throws \InvalidArgumentException
private generateProxyClasses() : array
private generateServiceFiles(array $services) : iterable
private getAutoloadFile() : ?string
private getClasses(Symfony\Component\DependencyInjection\Definition $definition, string $id) : array
private getDefinitionsFromArguments(array $arguments, ?SplObjectStorage $definitions = NULL, array $calls = [], ?bool $byConstructor = NULL) : SplObjectStorage
private getExpressionLanguage() : Symfony\Component\DependencyInjection\ExpressionLanguage
private getNextVariableName() : string
private getProxyDumper() : Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface

Retrieves the currently set proxy dumper or instantiates one.

private getServiceCall(string $id, ?Symfony\Component\DependencyInjection\Reference $reference = NULL) : string
private getServiceConditionals(?mixed $value) : string
private initializeMethodNamesMap(string $class) : void

Initializes the method names map to avoid conflicts with the Container methods.

private isHotPath(Symfony\Component\DependencyInjection\Definition $definition) : bool
private isProxyCandidate(Symfony\Component\DependencyInjection\Definition $definition, ?bool $asGhostObject, string $id) : ?Symfony\Component\DependencyInjection\Definition
private isSingleUsePrivateNode(Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphNode $node) : bool
private isTrivialInstance(Symfony\Component\DependencyInjection\Definition $definition) : bool
private startClass(string $class, string $baseClass, bool $hasProxyClasses) : string
private wrapServiceConditionals(?mixed $value, string $code) : string
© 2023 Bruce Wells
Search Namespaces \ Classes