FileLoaderFactory.php 786 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. namespace Hyperf\Translation;
  12. use Hyperf\Contract\ConfigInterface;
  13. use Hyperf\Support\Filesystem\Filesystem;
  14. use Psr\Container\ContainerInterface;
  15. use function Hyperf\Support\make;
  16. class FileLoaderFactory
  17. {
  18. public function __invoke(ContainerInterface $container)
  19. {
  20. $config = $container->get(ConfigInterface::class);
  21. $files = $container->get(Filesystem::class);
  22. $path = $config->get('translation.path', BASE_PATH . '/storage/languages');
  23. return make(FileLoader::class, compact('files', 'path'));
  24. }
  25. }