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
public setProxyDumper(Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface $proxyDumper)

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

protected Symfony\Component\DependencyInjection\Dumper\Dumper::$container
private bool $addGetService
private bool $asFiles
private string $baseClass
private array $circularReferences
private string $class
private SplObjectStorage $definitionVariables
private string $docStar
private array $exportedVariables
private Symfony\Component\DependencyInjection\ExpressionLanguage $expressionLanguage
private bool $hasProxyDumper
private string $hotPathTag
private SplObjectStorage $inlinedDefinitions
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
private array $reservedVariables
private array $serviceCalls
private array $serviceIdToMethodNameMap
private string $serviceLocatorTag
private array $singleUsePrivateIds
private int $targetDirMaxMatches
private string $targetDirRegex
private array $usedMethodNames
private int $variableCount
private addAliases() : string
private addCircularReferences(string $sourceId, array $currentPath, bool $byConstructor)
private addDefaultParametersMethod() : string
private addDeprecatedAliases() : 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
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()
private collectCircularReferences(string $sourceId, array $edges, array $checkedNodes, array $loops = [], array $path = [], bool $byConstructor = true) : void
private collectLineage(string $class, array $lineage)
private doExport(?mixed $value, bool $resolveEnv = false) : ?mixed
private dumpLiteralClass(string $class) : string

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

private dumpParameter(string $name) : string
private dumpValue(?mixed $value, bool $interpolate = true) : string
private endClass() : string
private export(?mixed $value) : ?mixed
private exportParameters(array $parameters, string $path = '', int $indent = 12, bool $hasEnum = false) : string
private generateMethodName(string $id) : string
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)

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