Documentation

YamlFileLoader extends FileLoader
in package

YamlFileLoader loads Yaml routing files.

Tags
author

Fabien Potencier fabien@symfony.com

author

Tobias Schultze http://tobion.de

Table of Contents

$availableKeys  : mixed
$yamlParser  : mixed
load()  : RouteCollection
Loads a Yaml file.
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.

Properties

$availableKeys

private static mixed $availableKeys = ['resource', 'type', 'prefix', 'path', 'host', 'schemes', 'methods', 'defaults', 'requirements', 'options', 'condition', 'controller']

Methods

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

A RouteCollection instance

supports()

{@inheritdoc}

public supports(mixed $resource[, mixed $type = null ]) : mixed
Parameters
$resource : mixed
$type : mixed = 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

A RouteCollection instance

$config : array<string|int, mixed>

Route definition

$path : string

Full path of the YAML file being processed

$file : string

Loaded file name

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

A RouteCollection instance

$name : string

Route name

$config : array<string|int, mixed>

Route definition

$path : string

Full path of the YAML file being processed

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

Search results