XmlFileLoader
extends FileLoader
in package
XmlFileLoader loads XML routing files.
Tags
Table of Contents
- NAMESPACE_URI = 'http://symfony.com/schema/routing'
- SCHEME_PATH = '/schema/routing/routing-1.0.xsd'
- load() : RouteCollection
- Loads an XML file.
- supports() : mixed
- {@inheritdoc}
- loadFile() : DOMDocument
- Loads an XML file.
- parseImport() : mixed
- Parses an import and adds the routes in the resource to the RouteCollection.
- parseNode() : mixed
- Parses a node from a loaded XML file.
- parseRoute() : mixed
- Parses a route and adds it to the RouteCollection.
- isElementValueNull() : mixed
- parseConfigs() : array<string|int, mixed>
- Parses the config elements (default, requirement, option).
- parseDefaultNode() : array<string|int, mixed>|bool|float|int|string
- Recursively parses the value of a "default" element.
- parseDefaultsConfig() : array<string|int, mixed>|bool|float|int|string|null
- Parses the "default" 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'
Methods
load()
Loads an XML file.
public
load(string $file[, string|null $type = null ]) : RouteCollection
Parameters
- $file : string
-
An XML file path
- $type : string|null = null
-
The resource type
Tags
Return values
RouteCollection —A RouteCollection instance
supports()
{@inheritdoc}
public
supports(mixed $resource[, mixed $type = null ]) : mixed
Parameters
- $resource : mixed
- $type : mixed = null
Return values
mixed —loadFile()
Loads an XML file.
protected
loadFile(string $file) : DOMDocument
Parameters
- $file : string
-
An XML file path
Tags
Return values
DOMDocument —parseImport()
Parses an import and adds the routes in the resource to the RouteCollection.
protected
parseImport(RouteCollection $collection, DOMElement $node, string $path, string $file) : mixed
Parameters
- $collection : RouteCollection
-
RouteCollection instance
- $node : DOMElement
-
Element to parse that represents a Route
- $path : string
-
Full path of the XML file being processed
- $file : string
-
Loaded file name
Tags
Return values
mixed —parseNode()
Parses a node from a loaded XML file.
protected
parseNode(RouteCollection $collection, DOMElement $node, string $path, string $file) : mixed
Parameters
- $collection : RouteCollection
-
Collection to associate with the node
- $node : DOMElement
-
Element to parse
- $path : string
-
Full path of the XML file being processed
- $file : string
-
Loaded file name
Tags
Return values
mixed —parseRoute()
Parses a route and adds it to the RouteCollection.
protected
parseRoute(RouteCollection $collection, DOMElement $node, string $path) : mixed
Parameters
- $collection : RouteCollection
-
RouteCollection instance
- $node : DOMElement
-
Element to parse that represents a Route
- $path : string
-
Full path of the XML file being processed
Tags
Return values
mixed —isElementValueNull()
private
isElementValueNull(DOMElement $element) : mixed
Parameters
- $element : DOMElement
Return values
mixed —parseConfigs()
Parses the config elements (default, requirement, option).
private
parseConfigs(DOMElement $node, string $path) : array<string|int, mixed>
Parameters
- $node : DOMElement
-
Element to parse that contains the configs
- $path : string
-
Full path of the XML file being processed
Tags
Return values
array<string|int, mixed> —An array with the defaults as first item, requirements as second and options as third
parseDefaultNode()
Recursively parses the value of a "default" element.
private
parseDefaultNode(DOMElement $node, string $path) : array<string|int, mixed>|bool|float|int|string
Parameters
- $node : DOMElement
-
The node value
- $path : string
-
Full path of the XML file being processed
Tags
Return values
array<string|int, mixed>|bool|float|int|string —The parsed value
parseDefaultsConfig()
Parses the "default" elements.
private
parseDefaultsConfig(DOMElement $element, string $path) : array<string|int, mixed>|bool|float|int|string|null
Parameters
- $element : DOMElement
-
The "default" element to parse
- $path : string
-
Full path of the XML file being processed
Return values
array<string|int, mixed>|bool|float|int|string|null —The parsed value of the "default" element