Documentation

YamlFileLoader extends FileLoader
in package
Uses HostTrait, LocalizedRouteTrait, PrefixTrait

YamlFileLoader loads Yaml routing files.

Tags
author

Fabien Potencier fabien@symfony.com

author

Tobias Schultze http://tobion.de

Table of Contents

AVAILABLE_KEYS  = ['resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition', 'controller', 'name_prefix', 'trailing_slash_on_root', 'locale', 'format', 'utf8', 'exclude', 'stateless']
$env  : mixed
$loading  : mixed
$locator  : mixed
$resolver  : mixed
$currentDir  : mixed
$yamlParser  : mixed
__construct()  : mixed
getLocator()  : FileLocatorInterface
Returns the file locator used by this loader.
getResolver()  : LoaderResolverInterface
Gets the loader resolver.
import()  : mixed
Imports a resource.
load()  : RouteCollection
Loads a Yaml file.
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}
parseImport()  : mixed
Parses an import and adds the routes in the resource to the RouteCollection.
parseRoute()  : mixed
Parses a route and adds it to the RouteCollection.
validate()  : mixed
Validates the route configuration.
doImport()  : mixed
validateAlias()  : void

Constants

AVAILABLE_KEYS

private mixed AVAILABLE_KEYS = ['resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition', 'controller', 'name_prefix', 'trailing_slash_on_root', 'locale', 'format', 'utf8', 'exclude', 'stateless']

Properties

$resolver

protected mixed $resolver

Methods

__construct()

public __construct([string|null $env = null ]) : mixed
Parameters
$env : string|null = null
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()

Loads a Yaml file.

public load(string $file[, string|null $type = null ]) : RouteCollection
Parameters
$file : string

A Yaml file path

$type : string|null = null

The resource type

Tags
throws
InvalidArgumentException

When a route can't be parsed because YAML is invalid

Return values
RouteCollection

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

parseImport()

Parses an import and adds the routes in the resource to the RouteCollection.

protected parseImport(RouteCollection $collection, array<string|int, mixed> $config, string $path, string $file) : mixed
Parameters
$collection : RouteCollection
$config : array<string|int, mixed>
$path : string
$file : string
Return values
mixed

parseRoute()

Parses a route and adds it to the RouteCollection.

protected parseRoute(RouteCollection $collection, string $name, array<string|int, mixed> $config, string $path) : mixed
Parameters
$collection : RouteCollection
$name : string
$config : array<string|int, mixed>
$path : string
Return values
mixed

validate()

Validates the route configuration.

protected validate(array<string|int, mixed> $config, string $name, string $path) : mixed
Parameters
$config : array<string|int, mixed>

A resource config

$name : string

The config key

$path : string

The loaded file path

Tags
throws
InvalidArgumentException

If one of the provided config keys is not supported, something is missing or the combination is nonsense

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

validateAlias()

private validateAlias(array<string|int, mixed> $config, string $name, string $path) : void
Parameters
$config : array<string|int, mixed>
$name : string
$path : string
Tags
throws
InvalidArgumentException

If one of the provided config keys is not supported, something is missing or the combination is nonsense

Return values
void

Search results