XmlFileLoader
extends FileLoader
in package
uses
HostTrait, LocalizedRouteTrait, PrefixTrait
XmlFileLoader loads XML routing files.
Tags
Table of Contents
Constants
- NAMESPACE_URI = 'http://symfony.com/schema/routing'
- SCHEME_PATH = '/schema/routing/routing-1.0.xsd'
Properties
Methods
- __construct() : mixed
- getLocator() : FileLocatorInterface
- Returns the file locator used by this loader.
- getResolver() : LoaderResolverInterface
- Gets the loader resolver.
- import() : mixed
- Imports a resource.
- load() : mixed
- Loads a resource.
- resolve() : LoaderInterface
- Finds a loader able to load an imported resource.
- setCurrentDir() : void
- Sets the current directory.
- setResolver() : void
- Sets the loader resolver.
- supports() : bool
- Returns whether this class supports the given resource.
- loadFile() : DOMDocument
- parseImport() : void
- Parses an import and adds the routes in the resource to the RouteCollection.
- parseNode() : void
- Parses a node from a loaded XML file.
- parseRoute() : void
- Parses a route and adds it to the RouteCollection.
- isElementValueNull() : bool
- parseConfigs() : array<string|int, mixed>
- Parses the config elements (default, requirement, option).
- parseDefaultNode() : array<string|int, mixed>|bool|float|int|string|null
- Recursively parses the value of a "default" element.
- parseDefaultsConfig() : array<string|int, mixed>|bool|float|int|string|null
- Parses the "default" elements.
- parseDeprecation() : array<string|int, mixed>
- Parses the deprecation elements.
Constants
NAMESPACE_URI
public
mixed
NAMESPACE_URI
= 'http://symfony.com/schema/routing'
SCHEME_PATH
public
mixed
SCHEME_PATH
= '/schema/routing/routing-1.0.xsd'
Properties
$env
protected
mixed
$env
$loading
protected
static mixed
$loading
= []
$locator
protected
mixed
$locator
$resolver
protected
mixed
$resolver
Methods
__construct()
public
__construct(FileLocatorInterface $locator[, string|null $env = null ]) : mixed
Parameters
- $locator : FileLocatorInterface
- $env : string|null = null
getLocator()
Returns the file locator used by this loader.
public
getLocator() : FileLocatorInterface
Return values
FileLocatorInterfacegetResolver()
Gets the loader resolver.
public
getResolver() : LoaderResolverInterface
Return values
LoaderResolverInterfaceimport()
Imports a resource.
public
import(mixed $resource[, string|null $type = null ][, bool $ignoreErrors = false ][, string|null $sourceResource = null ][, string|array<string|int, string>|null $exclude = null ]) : mixed
Parameters
- $resource : mixed
-
A Resource
- $type : string|null = null
-
The resource type or null if unknown
- $ignoreErrors : bool = false
-
Whether to ignore import errors or not
- $sourceResource : string|null = null
-
The original resource importing the new resource
- $exclude : string|array<string|int, string>|null = null
-
Glob patterns to exclude from the import
Tags
load()
Loads a resource.
public
load(mixed $file[, string|null $type = null ]) : mixed
Parameters
- $file : mixed
- $type : string|null = null
Tags
resolve()
Finds a loader able to load an imported resource.
public
resolve(mixed $resource[, string|null $type = null ]) : LoaderInterface
Parameters
- $resource : mixed
- $type : string|null = null
Tags
Return values
LoaderInterfacesetCurrentDir()
Sets the current directory.
public
setCurrentDir(string $dir) : void
Parameters
- $dir : string
setResolver()
Sets the loader resolver.
public
setResolver(LoaderResolverInterface $resolver) : void
Parameters
- $resolver : LoaderResolverInterface
supports()
Returns whether this class supports the given resource.
public
supports(mixed $resource[, string|null $type = null ]) : bool
Parameters
- $resource : mixed
-
A resource
- $type : string|null = null
Return values
boolloadFile()
protected
loadFile(string $file) : DOMDocument
Parameters
- $file : string
Tags
Return values
DOMDocumentparseImport()
Parses an import and adds the routes in the resource to the RouteCollection.
protected
parseImport(RouteCollection $collection, DOMElement $node, string $path, string $file) : void
Parameters
- $collection : RouteCollection
- $node : DOMElement
- $path : string
- $file : string
Tags
parseNode()
Parses a node from a loaded XML file.
protected
parseNode(RouteCollection $collection, DOMElement $node, string $path, string $file) : void
Parameters
- $collection : RouteCollection
- $node : DOMElement
- $path : string
- $file : string
Tags
parseRoute()
Parses a route and adds it to the RouteCollection.
protected
parseRoute(RouteCollection $collection, DOMElement $node, string $path) : void
Parameters
- $collection : RouteCollection
- $node : DOMElement
- $path : string
Tags
isElementValueNull()
private
isElementValueNull(DOMElement $element) : bool
Parameters
- $element : DOMElement
Return values
boolparseConfigs()
Parses the config elements (default, requirement, option).
private
parseConfigs(DOMElement $node, string $path) : array<string|int, mixed>
Parameters
- $node : DOMElement
- $path : string
Tags
Return values
array<string|int, mixed>parseDefaultNode()
Recursively parses the value of a "default" element.
private
parseDefaultNode(DOMElement $node, string $path) : array<string|int, mixed>|bool|float|int|string|null
Parameters
- $node : DOMElement
- $path : string
Tags
Return values
array<string|int, mixed>|bool|float|int|string|nullparseDefaultsConfig()
Parses the "default" elements.
private
parseDefaultsConfig(DOMElement $element, string $path) : array<string|int, mixed>|bool|float|int|string|null
Parameters
- $element : DOMElement
- $path : string
Return values
array<string|int, mixed>|bool|float|int|string|nullparseDeprecation()
Parses the deprecation elements.
private
parseDeprecation(DOMElement $node, string $path) : array<string|int, mixed>
Parameters
- $node : DOMElement
- $path : string