]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/AbstractBundle.php
gitignore vendor
[github/wallabag/wallabag.git] / vendor / symfony / intl / Symfony / Component / Intl / ResourceBundle / AbstractBundle.php
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Intl\ResourceBundle;
13
14 use Symfony\Component\Intl\Intl;
15 use Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface;
16
17 /**
18 * Base class for {@link ResourceBundleInterface} implementations.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22 abstract class AbstractBundle implements ResourceBundleInterface
23 {
24 /**
25 * @var string
26 */
27 private $path;
28
29 /**
30 * @var StructuredBundleReaderInterface
31 */
32 private $reader;
33
34 /**
35 * Creates a bundle at the given path using the given reader for reading
36 * bundle entries.
37 *
38 * @param string $path The path to the bundle.
39 * @param StructuredBundleReaderInterface $reader The reader for reading
40 * the bundle.
41 */
42 public function __construct($path, StructuredBundleReaderInterface $reader)
43 {
44 $this->path = $path;
45 $this->reader = $reader;
46 }
47
48 /**
49 * {@inheritdoc}
50 */
51 public function getLocales()
52 {
53 return $this->reader->getLocales($this->path);
54 }
55
56 /**
57 * Proxy method for {@link StructuredBundleReaderInterface#read}.
58 */
59 protected function read($locale)
60 {
61 return $this->reader->read($this->path, $locale);
62 }
63
64 /**
65 * Proxy method for {@link StructuredBundleReaderInterface#readEntry}.
66 */
67 protected function readEntry($locale, array $indices, $mergeFallback = false)
68 {
69 return $this->reader->readEntry($this->path, $locale, $indices, $mergeFallback);
70 }
71 }