YamlFileLoader
class YamlFileLoader extends FileLoader
YamlFileLoader загружает файлы маршрутов Yaml.
Свойства
| protected | $resolver | from Loader | |
| static protected | $loading | from FileLoader | |
| protected | $locator | from FileLoader |
Методы
| LoaderResolverInterface | getResolver() Возвращает решатель загрузчиков. | from Loader |
| setResolver(LoaderResolverInterface $resolver) Устанавливает решатель загрузчиков. | from Loader | |
| mixed | import(mixed $resource, string|null $type = null, bool $ignoreErrors = false, string|null $sourceResource = null) Импортирует ресурс. | from FileLoader |
| $this|LoaderInterface | resolve(mixed $resource, string|null $type = null) Находит загрузчик, способный загрузить импортированный ресурс. | from Loader |
| __construct(FileLocatorInterface $locator) | from FileLoader | |
| setCurrentDir(string $dir) Устанавливает текущую директорию. | from FileLoader | |
| FileLocatorInterface | getLocator() Возвращает локатор файлов, используемый этим загрузчиком. | from FileLoader |
| glob(string $pattern, bool $recursive, $resource = null, bool $ignoreErrors = false) | from FileLoader | |
| load(string $file, string|null $type = null) Загружает файл Yaml. | ||
| bool | supports(mixed $resource, string|null $type = null) Возвращает, поддерживает ли этот класс данный ресурс. | |
| parseRoute(RouteCollection $collection, string $name, array $config, string $path) Парсит маршрут и добавляет его в RouteCollection. | ||
| parseImport(RouteCollection $collection, array $config, string $path, string $file) Парсит импорт и добавляет маршруты из ресурса в RouteCollection. | ||
| validate(array $config, string $name, string $path) Проверяет конфигурацию маршрута. |
Подробное описание
LoaderResolverInterface getResolver()
Получает решатель загрузчика.
Значение возврата
| LoaderResolverInterface | Экземпляр LoaderResolverInterface |
setResolver(LoaderResolverInterface $resolver)
Устанавливает решатель загрузчика.
Параметры
| LoaderResolverInterface | $resolver |
mixed import(mixed $resource, string|null $type = null, bool $ignoreErrors = false, string|null $sourceResource = null)
Импортирует ресурс.
Параметры
| mixed | $resource | Ресурс |
| string|null | $type | Тип ресурса или null, если неизвестен |
| bool | $ignoreErrors | Игнорировать ошибки импорта или нет |
| string|null | $sourceResource | Исходный ресурс, импортирующий новый ресурс |
Значение возврата
| mixed |
Исключения
| FileLoaderLoadException | |
| FileLoaderImportCircularReferenceException | |
| FileLocatorFileNotFoundException |
$this|LoaderInterface resolve(mixed $resource, string|null $type = null)
Находит загрузчик, способный загрузить импортированный ресурс.
Параметры
| mixed | $resource | Ресурс |
| string|null | $type | Тип ресурса или null, если неизвестен |
Значение возврата
| $this|LoaderInterface |
Исключения
| FileLoaderLoadException | Если загрузчик не найден |
__construct(FileLocatorInterface $locator)
Параметры
| FileLocatorInterface | $locator |
setCurrentDir(string $dir)
Устанавливает текущую директорию.
Параметры
| string | $dir |
FileLocatorInterface getLocator()
Возвращает используемый локатор файлов.
Значение возврата
| FileLocatorInterface |
protected glob(string $pattern, bool $recursive, $resource = null, bool $ignoreErrors = false)
Параметры
| string | $pattern | |
| bool | $recursive | |
| $resource | ||
| bool | $ignoreErrors |
load(string $file, string|null $type = null)
Загружает YAML-файл.
Параметры
| string | $file | Путь к YAML-файлу |
| string|null | $type | Тип ресурса или null, если неизвестен |
Исключения
| InvalidArgumentException | При некорректном YAML |
bool supports(mixed $resource, string|null $type = null)
Возвращает, поддерживает ли этот класс данный ресурс.
Параметры
| mixed | $resource | Ресурс |
| string|null | $type | Тип ресурса или null, если неизвестен |
Значение возврата
| bool | True, если класс поддерживает ресурс, иначе false |
protected parseRoute(RouteCollection $collection, string $name, array $config, string $path)
Разбирает маршрут и добавляет его в RouteCollection.
Параметры
| RouteCollection | $collection | Экземпляр RouteCollection |
| string | $name | Имя маршрута |
| array | $config | Определение маршрута |
| string | $path | Полный путь к YAML-файлу |
protected parseImport(RouteCollection $collection, array $config, string $path, string $file)
Разбирает импорт и добавляет маршруты из ресурса в RouteCollection.
Параметры
| RouteCollection | $collection | Экземпляр RouteCollection |
| array | $config | Определение маршрута |
| string | $path | Полный путь к YAML-файлу |
| string | $file | Имя загруженного файла |
protected validate(array $config, string $name, string $path)
Проверяет конфигурацию маршрута.
Параметры
| array | $config | Конфигурация ресурса |
| string | $name | Ключ конфигурации |
| string | $path | Путь загруженного файла |
Исключения
| InvalidArgumentException | Если один из предоставленных ключей конфигурации не поддерживается, что-то отсутствует или комбинация не имеет смысла |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Routing/Loader/YamlFileLoader.html