YamlFileLoader
extends FileLoader
in package
YamlFileLoader loads YAML files service definitions.
Tags
Table of Contents
- ANONYMOUS_ID_REGEXP = '/^\.\d+_[^~]*+~[._a-zA-Z\d]{7}$/'
- DEFAULTS_KEYWORDS = ['public' => 'public', 'tags' => 'tags', 'autowire' => 'autowire', 'autoconfigure' => 'autoconfigure', 'bind' => 'bind']
- INSTANCEOF_KEYWORDS = ['shared' => 'shared', 'lazy' => 'lazy', 'public' => 'public', 'properties' => 'properties', 'configurator' => 'configurator', 'calls' => 'calls', 'tags' => 'tags', 'autowire' => 'autowire', 'bind' => 'bind']
- PROTOTYPE_KEYWORDS = ['resource' => 'resource', 'namespace' => 'namespace', 'exclude' => 'exclude', 'parent' => 'parent', 'shared' => 'shared', 'lazy' => 'lazy', 'public' => 'public', 'abstract' => 'abstract', 'deprecated' => 'deprecated', 'factory' => 'factory', 'arguments' => 'arguments', 'properties' => 'properties', 'configurator' => 'configurator', 'calls' => 'calls', 'tags' => 'tags', 'autowire' => 'autowire', 'autoconfigure' => 'autoconfigure', 'bind' => 'bind']
- SERVICE_KEYWORDS = ['alias' => 'alias', 'parent' => 'parent', 'class' => 'class', 'shared' => 'shared', 'synthetic' => 'synthetic', 'lazy' => 'lazy', 'public' => 'public', 'abstract' => 'abstract', 'deprecated' => 'deprecated', 'factory' => 'factory', 'file' => 'file', 'arguments' => 'arguments', 'properties' => 'properties', 'configurator' => 'configurator', 'calls' => 'calls', 'tags' => 'tags', 'decorates' => 'decorates', 'decoration_inner_name' => 'decoration_inner_name', 'decoration_priority' => 'decoration_priority', 'decoration_on_invalid' => 'decoration_on_invalid', 'autowire' => 'autowire', 'autoconfigure' => 'autoconfigure', 'bind' => 'bind']
- $autoRegisterAliasesForSinglyImplementedInterfaces : mixed
- $container : mixed
- $env : mixed
- $instanceof : mixed
- $interfaces : mixed
- $isLoadingInstanceof : mixed
- $loading : mixed
- $locator : mixed
- $resolver : mixed
- $singlyImplemented : mixed
- $anonymousServicesCount : mixed
- $anonymousServicesSuffix : 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() : mixed
- {@inheritdoc}
- registerAliasesForSinglyImplementedInterfaces() : mixed
- registerClasses() : mixed
- Registers a set of classes as services using PSR-4 for discovery.
- 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}
- loadFile() : array<string|int, mixed>|null
- Loads a YAML file.
- setDefinition() : mixed
- Registers a definition in the container with its instanceof-conditionals.
- checkDefinition() : mixed
- doImport() : mixed
- findClasses() : array<string|int, mixed>
- isUsingShortSyntax() : bool
- loadContent() : mixed
- loadFromExtensions() : mixed
- parseCallable() : string|array<string|int, mixed>|Reference
- Parses a callable.
- parseDefaults() : array<string|int, mixed>
- parseDefinition() : mixed
- Parses a definition.
- parseDefinitions() : mixed
- parseImports() : mixed
- resolveServices() : mixed
- validate() : array<string|int, mixed>|null
- Validates a YAML file.
Constants
ANONYMOUS_ID_REGEXP
public
mixed
ANONYMOUS_ID_REGEXP
= '/^\.\d+_[^~]*+~[._a-zA-Z\d]{7}$/'
DEFAULTS_KEYWORDS
private
mixed
DEFAULTS_KEYWORDS
= ['public' => 'public', 'tags' => 'tags', 'autowire' => 'autowire', 'autoconfigure' => 'autoconfigure', 'bind' => 'bind']
INSTANCEOF_KEYWORDS
private
mixed
INSTANCEOF_KEYWORDS
= ['shared' => 'shared', 'lazy' => 'lazy', 'public' => 'public', 'properties' => 'properties', 'configurator' => 'configurator', 'calls' => 'calls', 'tags' => 'tags', 'autowire' => 'autowire', 'bind' => 'bind']
PROTOTYPE_KEYWORDS
private
mixed
PROTOTYPE_KEYWORDS
= ['resource' => 'resource', 'namespace' => 'namespace', 'exclude' => 'exclude', 'parent' => 'parent', 'shared' => 'shared', 'lazy' => 'lazy', 'public' => 'public', 'abstract' => 'abstract', 'deprecated' => 'deprecated', 'factory' => 'factory', 'arguments' => 'arguments', 'properties' => 'properties', 'configurator' => 'configurator', 'calls' => 'calls', 'tags' => 'tags', 'autowire' => 'autowire', 'autoconfigure' => 'autoconfigure', 'bind' => 'bind']
SERVICE_KEYWORDS
private
mixed
SERVICE_KEYWORDS
= ['alias' => 'alias', 'parent' => 'parent', 'class' => 'class', 'shared' => 'shared', 'synthetic' => 'synthetic', 'lazy' => 'lazy', 'public' => 'public', 'abstract' => 'abstract', 'deprecated' => 'deprecated', 'factory' => 'factory', 'file' => 'file', 'arguments' => 'arguments', 'properties' => 'properties', 'configurator' => 'configurator', 'calls' => 'calls', 'tags' => 'tags', 'decorates' => 'decorates', 'decoration_inner_name' => 'decoration_inner_name', 'decoration_priority' => 'decoration_priority', 'decoration_on_invalid' => 'decoration_on_invalid', 'autowire' => 'autowire', 'autoconfigure' => 'autoconfigure', 'bind' => 'bind']
Properties
$autoRegisterAliasesForSinglyImplementedInterfaces
protected
mixed
$autoRegisterAliasesForSinglyImplementedInterfaces
= false
$container
protected
mixed
$container
$env
protected
mixed
$env
$instanceof
protected
mixed
$instanceof
= []
$interfaces
protected
mixed
$interfaces
= []
$isLoadingInstanceof
protected
mixed
$isLoadingInstanceof
= false
$loading
protected
static mixed
$loading
= []
$locator
protected
mixed
$locator
$resolver
protected
mixed
$resolver
$singlyImplemented
protected
mixed
$singlyImplemented
= []
$anonymousServicesCount
private
mixed
$anonymousServicesCount
$anonymousServicesSuffix
private
mixed
$anonymousServicesSuffix
$currentDir
private
mixed
$currentDir
$yamlParser
private
mixed
$yamlParser
Methods
__construct()
public
__construct([string|null $env = null ]) : mixed
Parameters
- $env : string|null = null
Return values
mixed —getLocator()
Returns the file locator used by this loader.
public
getLocator() : FileLocatorInterface
Return values
FileLocatorInterface —getResolver()
Gets the loader resolver.
public
getResolver() : LoaderResolverInterface
Return values
LoaderResolverInterface —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()
{@inheritdoc}
public
load(mixed $resource[, string|null $type = null ]) : mixed
Parameters
- $resource : mixed
- $type : string|null = null
Return values
mixed —registerAliasesForSinglyImplementedInterfaces()
public
registerAliasesForSinglyImplementedInterfaces() : mixed
Return values
mixed —registerClasses()
Registers a set of classes as services using PSR-4 for discovery.
public
registerClasses(Definition $prototype, string $namespace, string $resource[, string|array<string|int, string>|null $exclude = null ]) : mixed
Parameters
- $prototype : Definition
-
A definition to use as template
- $namespace : string
-
The namespace prefix of classes in the scanned directory
- $resource : string
-
The directory to look for classes, glob-patterns allowed
- $exclude : string|array<string|int, string>|null = null
-
A globbed path of files to exclude or an array of globbed paths of files to exclude
Return values
mixed —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
Return values
LoaderInterface —setCurrentDir()
Sets the current directory.
public
setCurrentDir(string $dir) : mixed
Parameters
- $dir : string
Return values
mixed —setResolver()
Sets the loader resolver.
public
setResolver(LoaderResolverInterface $resolver) : mixed
Parameters
- $resolver : LoaderResolverInterface
Return values
mixed —supports()
{@inheritdoc}
public
supports(mixed $resource[, string|null $type = null ]) : mixed
Parameters
- $resource : mixed
- $type : string|null = null
Return values
mixed —loadFile()
Loads a YAML file.
protected
loadFile(string $file) : array<string|int, mixed>|null
Parameters
- $file : string
Tags
Return values
array<string|int, mixed>|null —setDefinition()
Registers a definition in the container with its instanceof-conditionals.
protected
setDefinition(string $id, Definition $definition) : mixed
Parameters
- $id : string
- $definition : Definition
Return values
mixed —checkDefinition()
private
checkDefinition(string $id, array<string|int, mixed> $definition, string $file) : mixed
Parameters
- $id : string
- $definition : array<string|int, mixed>
- $file : string
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 —findClasses()
private
findClasses(string $namespace, string $pattern, array<string|int, mixed> $excludePatterns, RegisterAutoconfigureAttributesPass|null $autoconfigureAttributes) : array<string|int, mixed>
Parameters
- $namespace : string
- $pattern : string
- $excludePatterns : array<string|int, mixed>
- $autoconfigureAttributes : RegisterAutoconfigureAttributesPass|null
Return values
array<string|int, mixed> —isUsingShortSyntax()
private
isUsingShortSyntax(array<string|int, mixed> $service) : bool
Parameters
- $service : array<string|int, mixed>
Return values
bool —loadContent()
private
loadContent(array<string|int, mixed> $content, string $path) : mixed
Parameters
- $content : array<string|int, mixed>
- $path : string
Return values
mixed —loadFromExtensions()
private
loadFromExtensions(array<string|int, mixed> $content) : mixed
Parameters
- $content : array<string|int, mixed>
Return values
mixed —parseCallable()
Parses a callable.
private
parseCallable(string|array<string|int, mixed> $callable, string $parameter, string $id, string $file) : string|array<string|int, mixed>|Reference
Parameters
- $callable : string|array<string|int, mixed>
-
A callable reference
- $parameter : string
- $id : string
- $file : string
Tags
Return values
string|array<string|int, mixed>|Reference —parseDefaults()
private
parseDefaults(array<string|int, mixed> &$content, string $file) : array<string|int, mixed>
Parameters
- $content : array<string|int, mixed>
- $file : string
Tags
Return values
array<string|int, mixed> —parseDefinition()
Parses a definition.
private
parseDefinition(string $id, array<string|int, mixed>|string|null $service, string $file, array<string|int, mixed> $defaults[, bool $return = false ][, bool $trackBindings = true ]) : mixed
Parameters
- $id : string
- $service : array<string|int, mixed>|string|null
- $file : string
- $defaults : array<string|int, mixed>
- $return : bool = false
- $trackBindings : bool = true
Tags
Return values
mixed —parseDefinitions()
private
parseDefinitions(array<string|int, mixed> $content, string $file[, bool $trackBindings = true ]) : mixed
Parameters
- $content : array<string|int, mixed>
- $file : string
- $trackBindings : bool = true
Return values
mixed —parseImports()
private
parseImports(array<string|int, mixed> $content, string $file) : mixed
Parameters
- $content : array<string|int, mixed>
- $file : string
Return values
mixed —resolveServices()
private
resolveServices(mixed $value, string $file[, bool $isParameter = false ]) : mixed
Parameters
- $value : mixed
- $file : string
- $isParameter : bool = false
Return values
mixed —validate()
Validates a YAML file.
private
validate(mixed $content, string $file) : array<string|int, mixed>|null
Parameters
- $content : mixed
- $file : string