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

Constants

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

$env  : mixed
$loading  : mixed
$locator  : mixed
$resolver  : mixed
$yamlParser  : Parser

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.
parseImport()  : void
Parses an import and adds the routes in the resource to the RouteCollection.
parseRoute()  : void
Parses a route and adds it to the RouteCollection.
validate()  : void
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

import()

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
throws
LoaderLoadException
throws
FileLoaderImportCircularReferenceException
throws
FileLocatorFileNotFoundException

load()

Loads a resource.

public load(mixed $file[, string|null $type = null ]) : mixed
Parameters
$file : mixed
$type : string|null = null
Tags
throws
InvalidArgumentException

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

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
throws
LoaderLoadException

If no loader is found

Return values
LoaderInterface

setCurrentDir()

Sets the current directory.

public setCurrentDir(string $dir) : void
Parameters
$dir : string

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
bool

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) : void
Parameters
$collection : RouteCollection
$config : array<string|int, mixed>
$path : string
$file : string

parseRoute()

Parses a route and adds it to the RouteCollection.

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

validate()

protected validate(mixed $config, string $name, string $path) : void
Parameters
$config : 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

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


        
On this page

Search results