You are here

class PhpFileLoader in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/symfony/routing/Loader/PhpFileLoader.php \Symfony\Component\Routing\Loader\PhpFileLoader
  2. 8.0 vendor/symfony/translation/Loader/PhpFileLoader.php \Symfony\Component\Translation\Loader\PhpFileLoader
  3. 8.0 vendor/symfony/dependency-injection/Loader/PhpFileLoader.php \Symfony\Component\DependencyInjection\Loader\PhpFileLoader
Same name and namespace in other branches
  1. 8 vendor/symfony/translation/Loader/PhpFileLoader.php \Symfony\Component\Translation\Loader\PhpFileLoader

PhpFileLoader loads translations from PHP files returning an array of translations.

@author Fabien Potencier <fabien@symfony.com>

Hierarchy

Expanded class hierarchy of PhpFileLoader

1 file declares its use of PhpFileLoader
PhpFileLoaderTest.php in vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php
1 string reference to 'PhpFileLoader'
TranslatorTest::getTransFileTests in vendor/symfony/translation/Tests/TranslatorTest.php

File

vendor/symfony/translation/Loader/PhpFileLoader.php, line 23

Namespace

Symfony\Component\Translation\Loader
View source
class PhpFileLoader 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 = (require $resource);
    $catalogue = parent::load($messages, $locale, $domain);
    if (class_exists('Symfony\\Component\\Config\\Resource\\FileResource')) {
      $catalogue
        ->addResource(new FileResource($resource));
    }
    return $catalogue;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ArrayLoader::flatten private function Flattens an nested array of translations.
PhpFileLoader::load public function Loads a locale. Overrides ArrayLoader::load