PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/symfony/symfony/src/Symfony/Component/Intl/ResourceBundle/Reader/AbstractBundleReader.php

https://bitbucket.org/gruenwaldt/loquitur-web
PHP | 42 lines | 14 code | 6 blank | 22 comment | 0 complexity | 4f78a06021f31f7a2e4596a237a13a7c MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Intl\ResourceBundle\Reader;
  11. /**
  12. * Base class for {@link BundleReaderInterface} implementations.
  13. *
  14. * @author Bernhard Schussek <bschussek@gmail.com>
  15. */
  16. abstract class AbstractBundleReader implements BundleReaderInterface
  17. {
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public function getLocales($path)
  22. {
  23. $extension = '.' . $this->getFileExtension();
  24. $locales = glob($path . '/*' . $extension);
  25. // Remove file extension and sort
  26. array_walk($locales, function (&$locale) use ($extension) { $locale = basename($locale, $extension); });
  27. sort($locales);
  28. return $locales;
  29. }
  30. /**
  31. * Returns the extension of locale files in this bundle.
  32. *
  33. * @return string The file extension (without leading dot).
  34. */
  35. abstract protected function getFileExtension();
  36. }