abstract class FileLoader in Plug 7
Same name in this branch
- 7 lib/Symfony/translation/Loader/FileLoader.php \Symfony\Component\Translation\Loader\FileLoader
- 7 lib/Symfony/validator/Symfony/Component/Validator/Mapping/Loader/FileLoader.php \Symfony\Component\Validator\Mapping\Loader\FileLoader
@author Abdellatif Ait boudad <a.aitboudad@gmail.com>
Hierarchy
- class \Symfony\Component\Translation\Loader\ArrayLoader implements LoaderInterface
- class \Symfony\Component\Translation\Loader\FileLoader
Expanded class hierarchy of FileLoader
File
- lib/
Symfony/ translation/ Loader/ FileLoader.php, line 21
Namespace
Symfony\Component\Translation\LoaderView source
abstract class FileLoader extends ArrayLoader {
/**
* {@inheritdoc}
*/
public function load($resource, $locale, $domain = 'messages') {
if (!stream_is_local($resource)) {
throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource));
}
if (!file_exists($resource)) {
throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource));
}
$messages = $this
->loadResource($resource);
// empty resource
if (null === $messages) {
$messages = array();
}
// not an array
if (!is_array($messages)) {
throw new InvalidResourceException(sprintf('Unable to load file "%s".', $resource));
}
$catalogue = parent::load($messages, $locale, $domain);
if (class_exists('Symfony\\Component\\Config\\Resource\\FileResource')) {
$catalogue
->addResource(new FileResource($resource));
}
return $catalogue;
}
/*
* @param string $resource
*
* @return array
*
* @throws InvalidResourceException If stream content has an invalid format.
*/
protected abstract function loadResource($resource);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ArrayLoader:: |
private | function | Flattens an nested array of translations. | |
FileLoader:: |
public | function |
@api Overrides ArrayLoader:: |
|
FileLoader:: |
abstract protected | function | 7 |