YamlFileLoader
extends FileLoader
in package
YamlFileLoader loads YAML files service definitions.
Tags
Table of Contents
Constants
- 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']
Properties
- $autoRegisterAliasesForSinglyImplementedInterfaces : mixed
- $container : mixed
- $env : mixed
- $instanceof : mixed
- $interfaces : mixed
- $isLoadingInstanceof : mixed
- $loading : mixed
- $locator : mixed
- $resolver : mixed
- $singlyImplemented : mixed
- $anonymousServicesCount : int
- $anonymousServicesSuffix : string
- $currentDir : string|null
- $yamlParser : mixed
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
- {@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() : bool
- {@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
- parseDefaults() : array<string|int, mixed>
- parseDefinition() : mixed
- 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
int
$anonymousServicesCount
$anonymousServicesSuffix
private
string
$anonymousServicesSuffix
$currentDir
private
string|null
$currentDir
= null
$yamlParser
private
mixed
$yamlParser
Methods
__construct()
public
__construct([string $env = null ]) : mixed
Parameters
- $env : string = null
getLocator()
Returns the file locator used by this loader.
public
getLocator() : FileLocatorInterface
Return values
FileLocatorInterfacegetResolver()
Gets the loader resolver.
public
getResolver() : LoaderResolverInterface
Return values
LoaderResolverInterfaceimport()
Imports a resource.
public
import(mixed $resource[, string $type = null ]) : mixed
Parameters
- $resource : mixed
- $type : string = null
load()
{@inheritdoc}
public
load(mixed $resource[, string $type = null ]) : mixed
Parameters
- $resource : mixed
- $type : string = null
registerAliasesForSinglyImplementedInterfaces()
public
registerAliasesForSinglyImplementedInterfaces() : 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
resolve()
Finds a loader able to load an imported resource.
public
resolve(mixed $resource[, string $type = null ]) : LoaderInterface
Parameters
- $resource : mixed
- $type : string = null
Tags
Return values
LoaderInterfacesetCurrentDir()
Sets the current directory.
public
setCurrentDir(string $dir) : mixed
Parameters
- $dir : string
setResolver()
Sets the loader resolver.
public
setResolver(LoaderResolverInterface $resolver) : mixed
Parameters
- $resolver : LoaderResolverInterface
supports()
{@inheritdoc}
public
supports(mixed $resource[, string $type = null ]) : bool
Parameters
- $resource : mixed
- $type : string = null
Return values
boolloadFile()
Loads a YAML file.
protected
loadFile(string $file) : array<string|int, mixed>|null
Parameters
- $file : string
Tags
Return values
array<string|int, mixed>|nullsetDefinition()
Registers a definition in the container with its instanceof-conditionals.
protected
setDefinition(string $id, Definition $definition) : mixed
Parameters
- $id : string
- $definition : Definition
checkDefinition()
private
checkDefinition(string $id, array<string|int, mixed> $definition, string $file) : mixed
Parameters
- $id : string
- $definition : array<string|int, mixed>
- $file : string
doImport()
private
doImport(mixed $resource[, string $type = null ][, bool $ignoreErrors = false ][, string $sourceResource = null ]) : mixed
Parameters
- $resource : mixed
- $type : string = null
- $ignoreErrors : bool = false
- $sourceResource : string = null
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
boolloadContent()
private
loadContent(array<string|int, mixed> $content, string $path) : mixed
Parameters
- $content : array<string|int, mixed>
- $path : string
loadFromExtensions()
private
loadFromExtensions(array<string|int, mixed> $content) : mixed
Parameters
- $content : array<string|int, mixed>
parseCallable()
private
parseCallable(mixed $callable, string $parameter, string $id, string $file) : string|array<string|int, mixed>|Reference
Parameters
- $callable : mixed
- $parameter : string
- $id : string
- $file : string
Tags
Return values
string|array<string|int, mixed>|ReferenceparseDefaults()
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()
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
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
parseImports()
private
parseImports(array<string|int, mixed> $content, string $file) : mixed
Parameters
- $content : array<string|int, mixed>
- $file : string
resolveServices()
private
resolveServices(mixed $value, string $file[, bool $isParameter = false ]) : mixed
Parameters
- $value : mixed
- $file : string
- $isParameter : bool = false
validate()
Validates a YAML file.
private
validate(mixed $content, string $file) : array<string|int, mixed>|null
Parameters
- $content : mixed
- $file : string