StructuredBundleReaderInterface.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. * Reads individual entries of a resource file.
  13. *
  14. * @author Bernhard Schussek <bschussek@gmail.com>
  15. */
  16. interface StructuredBundleReaderInterface extends BundleReaderInterface
  17. {
  18. /**
  19. * Reads an entry from a resource bundle.
  20. *
  21. * An entry can be selected from the resource bundle by passing the path
  22. * to that entry in the bundle. For example, if the bundle is structured
  23. * like this:
  24. *
  25. * TopLevel
  26. * NestedLevel
  27. * Entry: Value
  28. *
  29. * Then the value can be read by calling:
  30. *
  31. * $reader->readEntry('...', 'en', array('TopLevel', 'NestedLevel', 'Entry'));
  32. *
  33. * @param string $path The path to the resource bundle.
  34. * @param string $locale The locale to read.
  35. * @param string[] $indices The indices to read from the bundle.
  36. * @param Boolean $fallback Whether to merge the value with the value from
  37. * the fallback locale (e.g. "en" for "en_GB").
  38. * Only applicable if the result is multivalued
  39. * (i.e. array or \ArrayAccess) or cannot be found
  40. * in the requested locale.
  41. *
  42. * @return mixed Returns an array or {@link \ArrayAccess} instance for
  43. * complex data, a scalar value for simple data and NULL
  44. * if the given path could not be accessed.
  45. */
  46. public function readEntry($path, $locale, array $indices, $fallback = true);
  47. }