Documentation

XmlFileLoader extends FileLoader
in package

XmlFileLoader loads XML files service definitions.

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

ANONYMOUS_ID_REGEXP  = '/^\.\d+_[^~]*+~[._a-zA-Z\d]{7}$/'
NS  = 'http://symfony.com/schema/dic/services'
$autoRegisterAliasesForSinglyImplementedInterfaces  : mixed
$container  : mixed
$env  : mixed
$instanceof  : mixed
$interfaces  : mixed
$isLoadingInstanceof  : mixed
$loading  : mixed
$locator  : mixed
$resolver  : mixed
$singlyImplemented  : mixed
$currentDir  : mixed
__construct()  : mixed
convertDomElementToArray()  : mixed
Converts a \DOMElement object to a PHP array.
getLocator()  : FileLocatorInterface
Returns the file locator used by this loader.
getResolver()  : LoaderResolverInterface
Gets the loader resolver.
import()  : mixed
Imports a resource.
load()  : mixed
{@inheritdoc}
registerAliasesForSinglyImplementedInterfaces()  : mixed
registerClasses()  : mixed
Registers a set of classes as services using PSR-4 for discovery.
resolve()  : LoaderInterface
Finds a loader able to load an imported resource.
setCurrentDir()  : mixed
Sets the current directory.
setResolver()  : mixed
Sets the loader resolver.
supports()  : mixed
{@inheritdoc}
validateSchema()  : bool
Validates a documents XML schema.
setDefinition()  : mixed
Registers a definition in the container with its instanceof-conditionals.
doImport()  : mixed
findClasses()  : array<string|int, mixed>
getArgumentsAsPhp()  : array<string|int, mixed>
getChildren()  : array<string|int, DOMElement>
Get child elements by name.
getServiceDefaults()  : Definition
loadFromExtensions()  : mixed
Loads from an extension.
loadXml()  : void
parseDefinition()  : Definition|null
Parses an individual Definition.
parseDefinitions()  : mixed
parseFileToDOM()  : DOMDocument
Parses an XML file to a \DOMDocument.
parseImports()  : mixed
parseParameters()  : mixed
processAnonymousServices()  : mixed
Processes anonymous services.
shouldEnableEntityLoader()  : bool
validateAlias()  : mixed
validateExtensions()  : mixed
Validates an extension.

Constants

ANONYMOUS_ID_REGEXP

public mixed ANONYMOUS_ID_REGEXP = '/^\.\d+_[^~]*+~[._a-zA-Z\d]{7}$/'

NS

public mixed NS = 'http://symfony.com/schema/dic/services'

Properties

$autoRegisterAliasesForSinglyImplementedInterfaces

protected mixed $autoRegisterAliasesForSinglyImplementedInterfaces = false

$isLoadingInstanceof

protected mixed $isLoadingInstanceof = false

$resolver

protected mixed $resolver

$singlyImplemented

protected mixed $singlyImplemented = []

Methods

__construct()

public __construct([string|null $env = null ]) : mixed
Parameters
$env : string|null = null
Return values
mixed

convertDomElementToArray()

Converts a \DOMElement object to a PHP array.

public static convertDomElementToArray(DOMElement $element) : mixed

The following rules applies during the conversion:

  • Each tag is converted to a key value or an array if there is more than one "value"

  • The content of a tag is set under a "value" key (bar) if the tag also has some nested tags

  • The attributes are converted to keys ()

  • The nested-tags are converted to keys (bar)

Parameters
$element : DOMElement

A \DOMElement instance

Return values
mixed

import()

Imports a resource.

public import(mixed $resource[, string|null $type = null ]) : mixed
Parameters
$resource : mixed

A resource

$type : string|null = null

The resource type or null if unknown

Return values
mixed

load()

{@inheritdoc}

public load(mixed $resource[, string|null $type = null ]) : mixed
Parameters
$resource : mixed
$type : string|null = null
Return values
mixed

registerAliasesForSinglyImplementedInterfaces()

public registerAliasesForSinglyImplementedInterfaces() : mixed
Return values
mixed

registerClasses()

Registers a set of classes as services using PSR-4 for discovery.

public registerClasses(Definition $prototype, string $namespace, string $resource[, string|array<string|int, string>|null $exclude = null ]) : mixed
Parameters
$prototype : Definition

A definition to use as template

$namespace : string

The namespace prefix of classes in the scanned directory

$resource : string

The directory to look for classes, glob-patterns allowed

$exclude : string|array<string|int, string>|null = null

A globbed path of files to exclude or an array of globbed paths of files to exclude

Return values
mixed

resolve()

Finds a loader able to load an imported resource.

public resolve(mixed $resource[, string|null $type = null ]) : LoaderInterface
Parameters
$resource : mixed

A resource

$type : string|null = null

The resource type or null if unknown

Tags
throws
LoaderLoadException

If no loader is found

Return values
LoaderInterface

setCurrentDir()

Sets the current directory.

public setCurrentDir(string $dir) : mixed
Parameters
$dir : string
Return values
mixed

supports()

{@inheritdoc}

public supports(mixed $resource[, string|null $type = null ]) : mixed
Parameters
$resource : mixed
$type : string|null = null
Return values
mixed

validateSchema()

Validates a documents XML schema.

public validateSchema(DOMDocument $dom) : bool
Parameters
$dom : DOMDocument
Tags
throws
RuntimeException

When extension references a non-existent XSD file

Return values
bool

setDefinition()

Registers a definition in the container with its instanceof-conditionals.

protected setDefinition(string $id, Definition $definition) : mixed
Parameters
$id : string
$definition : Definition
Return values
mixed

doImport()

private doImport(mixed $resource[, string|null $type = null ][, bool $ignoreErrors = false ][, string|null $sourceResource = null ]) : mixed
Parameters
$resource : mixed
$type : string|null = null
$ignoreErrors : bool = false
$sourceResource : string|null = null
Return values
mixed

findClasses()

private findClasses(string $namespace, string $pattern, array<string|int, mixed> $excludePatterns, RegisterAutoconfigureAttributesPass|null $autoconfigureAttributes) : array<string|int, mixed>
Parameters
$namespace : string
$pattern : string
$excludePatterns : array<string|int, mixed>
$autoconfigureAttributes : RegisterAutoconfigureAttributesPass|null
Return values
array<string|int, mixed>

getArgumentsAsPhp()

private getArgumentsAsPhp(DOMElement $node, string $name, string $file[, bool $isChildDefinition = false ]) : array<string|int, mixed>
Parameters
$node : DOMElement
$name : string
$file : string
$isChildDefinition : bool = false
Return values
array<string|int, mixed>

getChildren()

Get child elements by name.

private getChildren(DOMNode $node, string $name) : array<string|int, DOMElement>
Parameters
$node : DOMNode
$name : string
Return values
array<string|int, DOMElement>

getServiceDefaults()

private getServiceDefaults(DOMDocument $xml, string $file[, DOMNode|null $root = null ]) : Definition
Parameters
$xml : DOMDocument
$file : string
$root : DOMNode|null = null
Return values
Definition

loadFromExtensions()

Loads from an extension.

private loadFromExtensions(DOMDocument $xml) : mixed
Parameters
$xml : DOMDocument
Return values
mixed

loadXml()

private loadXml(DOMDocument $xml, string $path[, DOMNode|null $root = null ]) : void
Parameters
$xml : DOMDocument
$path : string
$root : DOMNode|null = null
Return values
void

parseDefinitions()

private parseDefinitions(DOMDocument $xml, string $file, Definition $defaults[, DOMNode|null $root = null ]) : mixed
Parameters
$xml : DOMDocument
$file : string
$defaults : Definition
$root : DOMNode|null = null
Return values
mixed

parseFileToDOM()

Parses an XML file to a \DOMDocument.

private parseFileToDOM(string $file) : DOMDocument
Parameters
$file : string
Tags
throws
InvalidArgumentException

When loading of XML file returns error

Return values
DOMDocument

parseImports()

private parseImports(DOMDocument $xml, string $file[, DOMNode|null $root = null ]) : mixed
Parameters
$xml : DOMDocument
$file : string
$root : DOMNode|null = null
Return values
mixed

parseParameters()

private parseParameters(DOMDocument $xml, string $file[, DOMNode|null $root = null ]) : mixed
Parameters
$xml : DOMDocument
$file : string
$root : DOMNode|null = null
Return values
mixed

processAnonymousServices()

Processes anonymous services.

private processAnonymousServices(DOMDocument $xml, string $file[, DOMNode|null $root = null ]) : mixed
Parameters
$xml : DOMDocument
$file : string
$root : DOMNode|null = null
Return values
mixed

shouldEnableEntityLoader()

private shouldEnableEntityLoader() : bool
Return values
bool

validateAlias()

private validateAlias(DOMElement $alias, string $file) : mixed
Parameters
$alias : DOMElement
$file : string
Return values
mixed

validateExtensions()

Validates an extension.

private validateExtensions(DOMDocument $dom, string $file) : mixed
Parameters
$dom : DOMDocument
$file : string
Tags
throws
InvalidArgumentException

When no extension is found corresponding to a tag

Return values
mixed

Search results