aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-04 17:50:34 +0200
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-04 17:50:34 +0200
commit46b77928f746a4231d064774b5b67fd892c7ce86 (patch)
treee3ea690b3f0def1744ddae758923cf92171ef985 /vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle
parent68abd9c71b1d2f7bb2e9d21819584d1d15005b25 (diff)
downloadwallabag-46b77928f746a4231d064774b5b67fd892c7ce86.tar.gz
wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.tar.zst
wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.zip
rm vendor
Diffstat (limited to 'vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle')
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/AbstractBundle.php71
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler/BundleCompiler.php71
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler/BundleCompilerInterface.php29
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php94
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/CurrencyBundleInterface.php74
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php115
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LanguageBundleInterface.php64
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php52
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LocaleBundleInterface.php41
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/AbstractBundleReader.php42
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/BinaryBundleReader.php51
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/BufferedBundleReader.php62
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/BundleReaderInterface.php40
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/PhpBundleReader.php61
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/StructuredBundleReader.php113
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/StructuredBundleReaderInterface.php50
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/RegionBundle.php52
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/RegionBundleInterface.php41
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/ResourceBundleInterface.php27
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/BundleTransformer.php96
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/CompilationContext.php97
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/CompilationContextInterface.php56
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/CurrencyBundleTransformationRule.php94
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/LanguageBundleTransformationRule.php71
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/LocaleBundleTransformationRule.php251
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/RegionBundleTransformationRule.php70
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/TransformationRuleInterface.php70
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/StubbingContext.php80
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/StubbingContextInterface.php46
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/ArrayAccessibleResourceBundle.php79
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/RecursiveArrayAccess.php33
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/RingBuffer.php88
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer/BundleWriterInterface.php29
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer/PhpBundleWriter.php50
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer/TextBundleWriter.php202
35 files changed, 0 insertions, 2562 deletions
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/AbstractBundle.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/AbstractBundle.php
deleted file mode 100644
index d1d523c4..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/AbstractBundle.php
+++ /dev/null
@@ -1,71 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle;
13
14use Symfony\Component\Intl\Intl;
15use Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface;
16
17/**
18 * Base class for {@link ResourceBundleInterface} implementations.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22abstract 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}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler/BundleCompiler.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler/BundleCompiler.php
deleted file mode 100644
index 174aa179..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler/BundleCompiler.php
+++ /dev/null
@@ -1,71 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Compiler;
13
14use Symfony\Component\Intl\Exception\RuntimeException;
15
16/**
17 * Compiles .txt resource bundles to binary .res files.
18 *
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21class BundleCompiler implements BundleCompilerInterface
22{
23 /**
24 * @var string The path to the "genrb" executable.
25 */
26 private $genrb;
27
28 /**
29 * Creates a new compiler based on the "genrb" executable.
30 *
31 * @param string $genrb Optional. The path to the "genrb" executable.
32 * @param string $envVars Optional. Environment variables to be loaded when
33 * running "genrb".
34 *
35 * @throws RuntimeException If the "genrb" cannot be found.
36 */
37 public function __construct($genrb = 'genrb', $envVars = '')
38 {
39 exec('which ' . $genrb, $output, $status);
40
41 if (0 !== $status) {
42 throw new RuntimeException(sprintf(
43 'The command "%s" is not installed',
44 $genrb
45 ));
46 }
47
48 $this->genrb = ($envVars ? $envVars . ' ' : '') . $genrb;
49 }
50
51 /**
52 * {@inheritdoc}
53 */
54 public function compile($sourcePath, $targetDir)
55 {
56 if (is_dir($sourcePath)) {
57 $sourcePath .= '/*.txt';
58 }
59
60 exec($this->genrb.' --quiet -e UTF-8 -d '.$targetDir.' '.$sourcePath, $output, $status);
61
62 if ($status !== 0) {
63 throw new RuntimeException(sprintf(
64 'genrb failed with status %d while compiling %s to %s.',
65 $status,
66 $sourcePath,
67 $targetDir
68 ));
69 }
70 }
71}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler/BundleCompilerInterface.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler/BundleCompilerInterface.php
deleted file mode 100644
index 6184ea3e..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler/BundleCompilerInterface.php
+++ /dev/null
@@ -1,29 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Compiler;
13
14/**
15 * Compiles a resource bundle.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface BundleCompilerInterface
20{
21 /**
22 * Compiles a resource bundle at the given source to the given target
23 * directory.
24 *
25 * @param string $sourcePath
26 * @param string $targetDir
27 */
28 public function compile($sourcePath, $targetDir);
29}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php
deleted file mode 100644
index 6f2a0ed3..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/CurrencyBundle.php
+++ /dev/null
@@ -1,94 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle;
13
14/**
15 * Default implementation of {@link CurrencyBundleInterface}.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class CurrencyBundle extends AbstractBundle implements CurrencyBundleInterface
20{
21 const INDEX_NAME = 0;
22
23 const INDEX_SYMBOL = 1;
24
25 const INDEX_FRACTION_DIGITS = 2;
26
27 const INDEX_ROUNDING_INCREMENT = 3;
28
29 /**
30 * {@inheritdoc}
31 */
32 public function getCurrencySymbol($currency, $locale = null)
33 {
34 if (null === $locale) {
35 $locale = \Locale::getDefault();
36 }
37
38 return $this->readEntry($locale, array('Currencies', $currency, static::INDEX_SYMBOL));
39 }
40
41 /**
42 * {@inheritdoc}
43 */
44 public function getCurrencyName($currency, $locale = null)
45 {
46 if (null === $locale) {
47 $locale = \Locale::getDefault();
48 }
49
50 return $this->readEntry($locale, array('Currencies', $currency, static::INDEX_NAME));
51 }
52
53 /**
54 * {@inheritdoc}
55 */
56 public function getCurrencyNames($locale = null)
57 {
58 if (null === $locale) {
59 $locale = \Locale::getDefault();
60 }
61
62 if (null === ($currencies = $this->readEntry($locale, array('Currencies')))) {
63 return array();
64 }
65
66 if ($currencies instanceof \Traversable) {
67 $currencies = iterator_to_array($currencies);
68 }
69
70 $index = static::INDEX_NAME;
71
72 array_walk($currencies, function (&$value) use ($index) {
73 $value = $value[$index];
74 });
75
76 return $currencies;
77 }
78
79 /**
80 * {@inheritdoc}
81 */
82 public function getFractionDigits($currency)
83 {
84 return $this->readEntry('en', array('Currencies', $currency, static::INDEX_FRACTION_DIGITS));
85 }
86
87 /**
88 * {@inheritdoc}
89 */
90 public function getRoundingIncrement($currency)
91 {
92 return $this->readEntry('en', array('Currencies', $currency, static::INDEX_ROUNDING_INCREMENT));
93 }
94}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/CurrencyBundleInterface.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/CurrencyBundleInterface.php
deleted file mode 100644
index 1a88e937..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/CurrencyBundleInterface.php
+++ /dev/null
@@ -1,74 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle;
13
14/**
15 * Gives access to currency-related ICU data.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface CurrencyBundleInterface extends ResourceBundleInterface
20{
21 /**
22 * Returns the symbol used for a currency.
23 *
24 * @param string $currency A currency code (e.g. "EUR").
25 * @param string $locale Optional. The locale to return the result in.
26 * Defaults to {@link \Locale::getDefault()}.
27 *
28 * @return string|null The currency symbol or NULL if not found.
29 */
30 public function getCurrencySymbol($currency, $locale = null);
31
32 /**
33 * Returns the name of a currency.
34 *
35 * @param string $currency A currency code (e.g. "EUR").
36 * @param string $locale Optional. The locale to return the name in.
37 * Defaults to {@link \Locale::getDefault()}.
38 *
39 * @return string|null The name of the currency or NULL if not found.
40 */
41 public function getCurrencyName($currency, $locale = null);
42
43 /**
44 * Returns the names of all known currencies.
45 *
46 * @param string $locale Optional. The locale to return the names in.
47 * Defaults to {@link \Locale::getDefault()}.
48 *
49 * @return string[] A list of currency names indexed by currency codes.
50 */
51 public function getCurrencyNames($locale = null);
52
53 /**
54 * Returns the number of digits after the comma of a currency.
55 *
56 * @param string $currency A currency code (e.g. "EUR").
57 *
58 * @return integer|null The number of digits after the comma or NULL if not found.
59 */
60 public function getFractionDigits($currency);
61
62 /**
63 * Returns the rounding increment of a currency.
64 *
65 * The rounding increment indicates to which number a currency is rounded.
66 * For example, 1230 rounded to the nearest 50 is 1250. 1.234 rounded to the
67 * nearest 0.65 is 1.3.
68 *
69 * @param string $currency A currency code (e.g. "EUR").
70 *
71 * @return float|integer|null The rounding increment or NULL if not found.
72 */
73 public function getRoundingIncrement($currency);
74}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php
deleted file mode 100644
index c449f9c1..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php
+++ /dev/null
@@ -1,115 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle;
13
14/**
15 * Default implementation of {@link LanguageBundleInterface}.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class LanguageBundle extends AbstractBundle implements LanguageBundleInterface
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function getLanguageName($lang, $region = null, $locale = null)
25 {
26 if (null === $locale) {
27 $locale = \Locale::getDefault();
28 }
29
30 if (null === ($languages = $this->readEntry($locale, array('Languages')))) {
31 return null;
32 }
33
34 // Some languages are translated together with their region,
35 // i.e. "en_GB" is translated as "British English"
36 if (null !== $region && isset($languages[$lang.'_'.$region])) {
37 return $languages[$lang.'_'.$region];
38 }
39
40 return $languages[$lang];
41 }
42
43 /**
44 * {@inheritdoc}
45 */
46 public function getLanguageNames($locale = null)
47 {
48 if (null === $locale) {
49 $locale = \Locale::getDefault();
50 }
51
52 if (null === ($languages = $this->readEntry($locale, array('Languages')))) {
53 return array();
54 }
55
56 if ($languages instanceof \Traversable) {
57 $languages = iterator_to_array($languages);
58 }
59
60 return $languages;
61 }
62
63 /**
64 * {@inheritdoc}
65 */
66 public function getScriptName($script, $lang = null, $locale = null)
67 {
68 if (null === $locale) {
69 $locale = \Locale::getDefault();
70 }
71
72 $data = $this->read($locale);
73
74 // Some languages are translated together with their script,
75 // e.g. "zh_Hans" is translated as "Simplified Chinese"
76 if (null !== $lang && isset($data['Languages'][$lang.'_'.$script])) {
77 $langName = $data['Languages'][$lang.'_'.$script];
78
79 // If the script is appended in braces, extract it, e.g. "zh_Hans"
80 // is translated as "Chinesisch (vereinfacht)" in locale "de"
81 if (strpos($langName, '(') !== false) {
82 list($langName, $scriptName) = preg_split('/[\s()]/', $langName, null, PREG_SPLIT_NO_EMPTY);
83
84 return $scriptName;
85 }
86 }
87
88 // "af" (Afrikaans) has no "Scripts" block
89 if (!isset($data['Scripts'][$script])) {
90 return null;
91 }
92
93 return $data['Scripts'][$script];
94 }
95
96 /**
97 * {@inheritdoc}
98 */
99 public function getScriptNames($locale = null)
100 {
101 if (null === $locale) {
102 $locale = \Locale::getDefault();
103 }
104
105 if (null === ($scripts = $this->readEntry($locale, array('Scripts')))) {
106 return array();
107 }
108
109 if ($scripts instanceof \Traversable) {
110 $scripts = iterator_to_array($scripts);
111 }
112
113 return $scripts;
114 }
115}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LanguageBundleInterface.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LanguageBundleInterface.php
deleted file mode 100644
index de50bda0..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LanguageBundleInterface.php
+++ /dev/null
@@ -1,64 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle;
13
14/**
15 * Gives access to language-related ICU data.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface LanguageBundleInterface extends ResourceBundleInterface
20{
21 /**
22 * Returns the name of a language.
23 *
24 * @param string $lang A language code (e.g. "en").
25 * @param string|null $region Optional. A region code (e.g. "US").
26 * @param string $locale Optional. The locale to return the name in.
27 * Defaults to {@link \Locale::getDefault()}.
28 *
29 * @return string|null The name of the language or NULL if not found.
30 */
31 public function getLanguageName($lang, $region = null, $locale = null);
32
33 /**
34 * Returns the names of all known languages.
35 *
36 * @param string $locale Optional. The locale to return the names in.
37 * Defaults to {@link \Locale::getDefault()}.
38 *
39 * @return string[] A list of language names indexed by language codes.
40 */
41 public function getLanguageNames($locale = null);
42
43 /**
44 * Returns the name of a script.
45 *
46 * @param string $script A script code (e.g. "Hans").
47 * @param string $lang Optional. A language code (e.g. "zh").
48 * @param string $locale Optional. The locale to return the name in.
49 * Defaults to {@link \Locale::getDefault()}.
50 *
51 * @return string|null The name of the script or NULL if not found.
52 */
53 public function getScriptName($script, $lang = null, $locale = null);
54
55 /**
56 * Returns the names of all known scripts.
57 *
58 * @param string $locale Optional. The locale to return the names in.
59 * Defaults to {@link \Locale::getDefault()}.
60 *
61 * @return string[] A list of script names indexed by script codes.
62 */
63 public function getScriptNames($locale = null);
64}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php
deleted file mode 100644
index 6f6cdfcb..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php
+++ /dev/null
@@ -1,52 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle;
13
14/**
15 * Default implementation of {@link LocaleBundleInterface}.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class LocaleBundle extends AbstractBundle implements LocaleBundleInterface
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function getLocaleName($ofLocale, $locale = null)
25 {
26 if (null === $locale) {
27 $locale = \Locale::getDefault();
28 }
29
30 return $this->readEntry($locale, array('Locales', $ofLocale));
31 }
32
33 /**
34 * {@inheritdoc}
35 */
36 public function getLocaleNames($locale = null)
37 {
38 if (null === $locale) {
39 $locale = \Locale::getDefault();
40 }
41
42 if (null === ($locales = $this->readEntry($locale, array('Locales')))) {
43 return array();
44 }
45
46 if ($locales instanceof \Traversable) {
47 $locales = iterator_to_array($locales);
48 }
49
50 return $locales;
51 }
52}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LocaleBundleInterface.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LocaleBundleInterface.php
deleted file mode 100644
index daf5be68..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/LocaleBundleInterface.php
+++ /dev/null
@@ -1,41 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle;
13
14/**
15 * Gives access to locale-related ICU data.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface LocaleBundleInterface extends ResourceBundleInterface
20{
21 /**
22 * Returns the name of a locale.
23 *
24 * @param string $ofLocale The locale to return the name of (e.g. "de_AT").
25 * @param string $locale Optional. The locale to return the name in.
26 * Defaults to {@link \Locale::getDefault()}.
27 *
28 * @return string|null The name of the locale or NULL if not found.
29 */
30 public function getLocaleName($ofLocale, $locale = null);
31
32 /**
33 * Returns the names of all known locales.
34 *
35 * @param string $locale Optional. The locale to return the names in.
36 * Defaults to {@link \Locale::getDefault()}.
37 *
38 * @return string[] A list of locale names indexed by locale codes.
39 */
40 public function getLocaleNames($locale = null);
41}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/AbstractBundleReader.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/AbstractBundleReader.php
deleted file mode 100644
index c30693ac..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/AbstractBundleReader.php
+++ /dev/null
@@ -1,42 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Reader;
13
14/**
15 * Base class for {@link BundleReaderInterface} implementations.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19abstract class AbstractBundleReader implements BundleReaderInterface
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function getLocales($path)
25 {
26 $extension = '.' . $this->getFileExtension();
27 $locales = glob($path . '/*' . $extension);
28
29 // Remove file extension and sort
30 array_walk($locales, function (&$locale) use ($extension) { $locale = basename($locale, $extension); });
31 sort($locales);
32
33 return $locales;
34 }
35
36 /**
37 * Returns the extension of locale files in this bundle.
38 *
39 * @return string The file extension (without leading dot).
40 */
41 abstract protected function getFileExtension();
42}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/BinaryBundleReader.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/BinaryBundleReader.php
deleted file mode 100644
index 56cef806..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/BinaryBundleReader.php
+++ /dev/null
@@ -1,51 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Reader;
13
14use Symfony\Component\Intl\Exception\RuntimeException;
15use Symfony\Component\Intl\ResourceBundle\Util\ArrayAccessibleResourceBundle;
16
17/**
18 * Reads binary .res resource bundles.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class BinaryBundleReader extends AbstractBundleReader implements BundleReaderInterface
23{
24 /**
25 * {@inheritdoc}
26 */
27 public function read($path, $locale)
28 {
29 // Point for future extension: Modify this class so that it works also
30 // if the \ResourceBundle class is not available.
31 $bundle = new \ResourceBundle($locale, $path);
32
33 if (null === $bundle) {
34 throw new RuntimeException(sprintf(
35 'Could not load the resource bundle "%s/%s.res".',
36 $path,
37 $locale
38 ));
39 }
40
41 return new ArrayAccessibleResourceBundle($bundle);
42 }
43
44 /**
45 * {@inheritdoc}
46 */
47 protected function getFileExtension()
48 {
49 return 'res';
50 }
51}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/BufferedBundleReader.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/BufferedBundleReader.php
deleted file mode 100644
index e44074b1..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/BufferedBundleReader.php
+++ /dev/null
@@ -1,62 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Reader;
13
14use Symfony\Component\Intl\ResourceBundle\Util\RingBuffer;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class BufferedBundleReader implements BundleReaderInterface
20{
21 /**
22 * @var BundleReaderInterface
23 */
24 private $reader;
25
26 private $buffer;
27
28 /**
29 * Buffers a given reader.
30 *
31 * @param BundleReaderInterface $reader The reader to buffer.
32 * @param integer $bufferSize The number of entries to store
33 * in the buffer.
34 */
35 public function __construct(BundleReaderInterface $reader, $bufferSize)
36 {
37 $this->reader = $reader;
38 $this->buffer = new RingBuffer($bufferSize);
39 }
40
41 /**
42 * {@inheritdoc}
43 */
44 public function read($path, $locale)
45 {
46 $hash = $path . '//' . $locale;
47
48 if (!isset($this->buffer[$hash])) {
49 $this->buffer[$hash] = $this->reader->read($path, $locale);
50 }
51
52 return $this->buffer[$hash];
53 }
54
55 /**
56 * {@inheritdoc}
57 */
58 public function getLocales($path)
59 {
60 return $this->reader->getLocales($path);
61 }
62}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/BundleReaderInterface.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/BundleReaderInterface.php
deleted file mode 100644
index bc485cd5..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/BundleReaderInterface.php
+++ /dev/null
@@ -1,40 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Reader;
13
14/**
15 * Reads resource bundle files.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface BundleReaderInterface
20{
21 /**
22 * Reads a resource bundle.
23 *
24 * @param string $path The path to the resource bundle.
25 * @param string $locale The locale to read.
26 *
27 * @return mixed Returns an array or {@link \ArrayAccess} instance for
28 * complex data, a scalar value otherwise.
29 */
30 public function read($path, $locale);
31
32 /**
33 * Reads the available locales of a resource bundle.
34 *
35 * @param string $path The path to the resource bundle.
36 *
37 * @return string[] A list of supported locale codes.
38 */
39 public function getLocales($path);
40}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/PhpBundleReader.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/PhpBundleReader.php
deleted file mode 100644
index 663bcc9d..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/PhpBundleReader.php
+++ /dev/null
@@ -1,61 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Reader;
13
14use Symfony\Component\Intl\Exception\InvalidArgumentException;
15use Symfony\Component\Intl\Exception\RuntimeException;
16
17/**
18 * Reads .php resource bundles.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class PhpBundleReader extends AbstractBundleReader implements BundleReaderInterface
23{
24 /**
25 * {@inheritdoc}
26 */
27 public function read($path, $locale)
28 {
29 if ('en' !== $locale) {
30 throw new InvalidArgumentException('Only the locale "en" is supported.');
31 }
32
33 $fileName = $path . '/' . $locale . '.php';
34
35 if (!file_exists($fileName)) {
36 throw new RuntimeException(sprintf(
37 'The resource bundle "%s/%s.php" does not exist.',
38 $path,
39 $locale
40 ));
41 }
42
43 if (!is_file($fileName)) {
44 throw new RuntimeException(sprintf(
45 'The resource bundle "%s/%s.php" is not a file.',
46 $path,
47 $locale
48 ));
49 }
50
51 return include $fileName;
52 }
53
54 /**
55 * {@inheritdoc}
56 */
57 protected function getFileExtension()
58 {
59 return 'php';
60 }
61}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/StructuredBundleReader.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/StructuredBundleReader.php
deleted file mode 100644
index e3656fe2..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/StructuredBundleReader.php
+++ /dev/null
@@ -1,113 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Reader;
13
14use Symfony\Component\Intl\ResourceBundle\Util\RecursiveArrayAccess;
15
16/**
17 * A structured reader wrapping an existing resource bundle reader.
18 *
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 *
21 * @see StructuredResourceBundleBundleReaderInterface
22 */
23class StructuredBundleReader implements StructuredBundleReaderInterface
24{
25 /**
26 * @var BundleReaderInterface
27 */
28 private $reader;
29
30 /**
31 * Creates an entry reader based on the given resource bundle reader.
32 *
33 * @param BundleReaderInterface $reader A resource bundle reader to use.
34 */
35 public function __construct(BundleReaderInterface $reader)
36 {
37 $this->reader = $reader;
38 }
39
40 /**
41 * {@inheritdoc}
42 */
43 public function read($path, $locale)
44 {
45 return $this->reader->read($path, $locale);
46 }
47
48 /**
49 * {@inheritdoc}
50 */
51 public function getLocales($path)
52 {
53 return $this->reader->getLocales($path);
54 }
55
56 /**
57 * {@inheritdoc}
58 */
59 public function readEntry($path, $locale, array $indices, $fallback = true)
60 {
61 $data = $this->reader->read($path, $locale);
62
63 $entry = RecursiveArrayAccess::get($data, $indices);
64 $multivalued = is_array($entry) || $entry instanceof \Traversable;
65
66 if (!($fallback && (null === $entry || $multivalued))) {
67 return $entry;
68 }
69
70 if (null !== ($fallbackLocale = $this->getFallbackLocale($locale))) {
71 $parentEntry = $this->readEntry($path, $fallbackLocale, $indices, true);
72
73 if ($entry || $parentEntry) {
74 $multivalued = $multivalued || is_array($parentEntry) || $parentEntry instanceof \Traversable;
75
76 if ($multivalued) {
77 if ($entry instanceof \Traversable) {
78 $entry = iterator_to_array($entry);
79 }
80
81 if ($parentEntry instanceof \Traversable) {
82 $parentEntry = iterator_to_array($parentEntry);
83 }
84
85 $entry = array_merge(
86 $parentEntry ?: array(),
87 $entry ?: array()
88 );
89 } else {
90 $entry = null === $entry ? $parentEntry : $entry;
91 }
92 }
93 }
94
95 return $entry;
96 }
97
98 /**
99 * Returns the fallback locale for a given locale, if any
100 *
101 * @param string $locale The locale to find the fallback for.
102 *
103 * @return string|null The fallback locale, or null if no parent exists
104 */
105 private function getFallbackLocale($locale)
106 {
107 if (false === $pos = strrpos($locale, '_')) {
108 return null;
109 }
110
111 return substr($locale, 0, $pos);
112 }
113}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/StructuredBundleReaderInterface.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/StructuredBundleReaderInterface.php
deleted file mode 100644
index c22ad93b..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Reader/StructuredBundleReaderInterface.php
+++ /dev/null
@@ -1,50 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Reader;
13
14/**
15 * Reads individual entries of a resource file.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface StructuredBundleReaderInterface extends BundleReaderInterface
20{
21 /**
22 * Reads an entry from a resource bundle.
23 *
24 * An entry can be selected from the resource bundle by passing the path
25 * to that entry in the bundle. For example, if the bundle is structured
26 * like this:
27 *
28 * TopLevel
29 * NestedLevel
30 * Entry: Value
31 *
32 * Then the value can be read by calling:
33 *
34 * $reader->readEntry('...', 'en', array('TopLevel', 'NestedLevel', 'Entry'));
35 *
36 * @param string $path The path to the resource bundle.
37 * @param string $locale The locale to read.
38 * @param string[] $indices The indices to read from the bundle.
39 * @param Boolean $fallback Whether to merge the value with the value from
40 * the fallback locale (e.g. "en" for "en_GB").
41 * Only applicable if the result is multivalued
42 * (i.e. array or \ArrayAccess) or cannot be found
43 * in the requested locale.
44 *
45 * @return mixed Returns an array or {@link \ArrayAccess} instance for
46 * complex data, a scalar value for simple data and NULL
47 * if the given path could not be accessed.
48 */
49 public function readEntry($path, $locale, array $indices, $fallback = true);
50}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/RegionBundle.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/RegionBundle.php
deleted file mode 100644
index a3cd9bd3..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/RegionBundle.php
+++ /dev/null
@@ -1,52 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle;
13
14/**
15 * Default implementation of {@link RegionBundleInterface}.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class RegionBundle extends AbstractBundle implements RegionBundleInterface
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function getCountryName($country, $locale = null)
25 {
26 if (null === $locale) {
27 $locale = \Locale::getDefault();
28 }
29
30 return $this->readEntry($locale, array('Countries', $country));
31 }
32
33 /**
34 * {@inheritdoc}
35 */
36 public function getCountryNames($locale = null)
37 {
38 if (null === $locale) {
39 $locale = \Locale::getDefault();
40 }
41
42 if (null === ($countries = $this->readEntry($locale, array('Countries')))) {
43 return array();
44 }
45
46 if ($countries instanceof \Traversable) {
47 $countries = iterator_to_array($countries);
48 }
49
50 return $countries;
51 }
52}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/RegionBundleInterface.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/RegionBundleInterface.php
deleted file mode 100644
index 4e55f2dc..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/RegionBundleInterface.php
+++ /dev/null
@@ -1,41 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle;
13
14/**
15 * Gives access to region-related ICU data.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface RegionBundleInterface extends ResourceBundleInterface
20{
21 /**
22 * Returns the name of a country.
23 *
24 * @param string $country A country code (e.g. "US").
25 * @param string $locale Optional. The locale to return the name in.
26 * Defaults to {@link \Locale::getDefault()}.
27 *
28 * @return string|null The name of the country or NULL if not found.
29 */
30 public function getCountryName($country, $locale = null);
31
32 /**
33 * Returns the names of all known countries.
34 *
35 * @param string $locale Optional. The locale to return the names in.
36 * Defaults to {@link \Locale::getDefault()}.
37 *
38 * @return string[] A list of country names indexed by country codes.
39 */
40 public function getCountryNames($locale = null);
41}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/ResourceBundleInterface.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/ResourceBundleInterface.php
deleted file mode 100644
index 497a66a3..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/ResourceBundleInterface.php
+++ /dev/null
@@ -1,27 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle;
13
14/**
15 * Gives access to ICU data.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface ResourceBundleInterface
20{
21 /**
22 * Returns the list of locales that this bundle supports.
23 *
24 * @return string[] A list of locale codes.
25 */
26 public function getLocales();
27}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/BundleTransformer.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/BundleTransformer.php
deleted file mode 100644
index 0692d6fe..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/BundleTransformer.php
+++ /dev/null
@@ -1,96 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Transformer;
13
14use Symfony\Component\Intl\Exception\RuntimeException;
15use Symfony\Component\Intl\ResourceBundle\Transformer\Rule\TransformationRuleInterface;
16use Symfony\Component\Intl\ResourceBundle\Writer\PhpBundleWriter;
17
18/**
19 * Compiles a number of resource bundles based on predefined compilation rules.
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 */
23class BundleTransformer
24{
25 /**
26 * @var TransformationRuleInterface[]
27 */
28 private $rules = array();
29
30 /**
31 * Adds a new compilation rule.
32 *
33 * @param TransformationRuleInterface $rule The compilation rule.
34 */
35 public function addRule(TransformationRuleInterface $rule)
36 {
37 $this->rules[] = $rule;
38 }
39
40 /**
41 * Runs the compilation with the given compilation context.
42 *
43 * @param CompilationContextInterface $context The context storing information
44 * needed to run the compilation.
45 *
46 * @throws RuntimeException If any of the files to be compiled by the loaded
47 * compilation rules does not exist.
48 */
49 public function compileBundles(CompilationContextInterface $context)
50 {
51 $filesystem = $context->getFilesystem();
52 $compiler = $context->getCompiler();
53
54 $filesystem->remove($context->getBinaryDir());
55 $filesystem->mkdir($context->getBinaryDir());
56
57 foreach ($this->rules as $rule) {
58 $filesystem->mkdir($context->getBinaryDir() . '/' . $rule->getBundleName());
59
60 $resources = (array) $rule->beforeCompile($context);
61
62 foreach ($resources as $resource) {
63 if (!file_exists($resource)) {
64 throw new RuntimeException(sprintf(
65 'The file "%s" to be compiled by %s does not exist.',
66 $resource,
67 get_class($rule)
68 ));
69 }
70
71 $compiler->compile($resource, $context->getBinaryDir() . '/' . $rule->getBundleName());
72 }
73
74 $rule->afterCompile($context);
75 }
76 }
77
78 public function createStubs(StubbingContextInterface $context)
79 {
80 $filesystem = $context->getFilesystem();
81 $phpWriter = new PhpBundleWriter();
82
83 $filesystem->remove($context->getStubDir());
84 $filesystem->mkdir($context->getStubDir());
85
86 foreach ($this->rules as $rule) {
87 $filesystem->mkdir($context->getStubDir() . '/' . $rule->getBundleName());
88
89 $data = $rule->beforeCreateStub($context);
90
91 $phpWriter->write($context->getStubDir() . '/' . $rule->getBundleName(), 'en', $data);
92
93 $rule->afterCreateStub($context);
94 }
95 }
96}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/CompilationContext.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/CompilationContext.php
deleted file mode 100644
index cdc1951b..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/CompilationContext.php
+++ /dev/null
@@ -1,97 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Transformer;
13
14use Symfony\Component\Filesystem\Filesystem;
15use Symfony\Component\Intl\ResourceBundle\Compiler\BundleCompilerInterface;
16
17/**
18 * Default implementation of {@link CompilationContextInterface}.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class CompilationContext implements CompilationContextInterface
23{
24 /**
25 * @var string
26 */
27 private $sourceDir;
28
29 /**
30 * @var string
31 */
32 private $binaryDir;
33
34 /**
35 * @var FileSystem
36 */
37 private $filesystem;
38
39 /**
40 * @var BundleCompilerInterface
41 */
42 private $compiler;
43
44 /**
45 * @var string
46 */
47 private $icuVersion;
48
49 public function __construct($sourceDir, $binaryDir, Filesystem $filesystem, BundleCompilerInterface $compiler, $icuVersion)
50 {
51 $this->sourceDir = $sourceDir;
52 $this->binaryDir = $binaryDir;
53 $this->filesystem = $filesystem;
54 $this->compiler = $compiler;
55 $this->icuVersion = $icuVersion;
56 }
57
58 /**
59 * {@inheritdoc}
60 */
61 public function getSourceDir()
62 {
63 return $this->sourceDir;
64 }
65
66 /**
67 * {@inheritdoc}
68 */
69 public function getBinaryDir()
70 {
71 return $this->binaryDir;
72 }
73
74 /**
75 * {@inheritdoc}
76 */
77 public function getFilesystem()
78 {
79 return $this->filesystem;
80 }
81
82 /**
83 * {@inheritdoc}
84 */
85 public function getCompiler()
86 {
87 return $this->compiler;
88 }
89
90 /**
91 * {@inheritdoc}
92 */
93 public function getIcuVersion()
94 {
95 return $this->icuVersion;
96 }
97}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/CompilationContextInterface.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/CompilationContextInterface.php
deleted file mode 100644
index f05c2807..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/CompilationContextInterface.php
+++ /dev/null
@@ -1,56 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Transformer;
13
14/**
15 * Stores contextual information for resource bundle compilation.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface CompilationContextInterface
20{
21 /**
22 * Returns the directory where the source versions of the resource bundles
23 * are stored.
24 *
25 * @return string An absolute path to a directory.
26 */
27 public function getSourceDir();
28
29 /**
30 * Returns the directory where the binary resource bundles are stored.
31 *
32 * @return string An absolute path to a directory.
33 */
34 public function getBinaryDir();
35
36 /**
37 * Returns a tool for manipulating the filesystem.
38 *
39 * @return \Symfony\Component\Filesystem\Filesystem The filesystem manipulator.
40 */
41 public function getFilesystem();
42
43 /**
44 * Returns a resource bundle compiler.
45 *
46 * @return \Symfony\Component\Intl\ResourceBundle\Compiler\BundleCompilerInterface The loaded resource bundle compiler.
47 */
48 public function getCompiler();
49
50 /**
51 * Returns the ICU version of the bundles being converted.
52 *
53 * @return string The ICU version string.
54 */
55 public function getIcuVersion();
56}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/CurrencyBundleTransformationRule.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/CurrencyBundleTransformationRule.php
deleted file mode 100644
index 95783b3b..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/CurrencyBundleTransformationRule.php
+++ /dev/null
@@ -1,94 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Transformer\Rule;
13
14use Symfony\Component\Intl\Intl;
15use Symfony\Component\Intl\ResourceBundle\CurrencyBundle;
16use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface;
17use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface;
18use Symfony\Component\Intl\Util\IcuVersion;
19
20/**
21 * The rule for compiling the currency bundle.
22 *
23 * @author Bernhard Schussek <bschussek@gmail.com>
24 */
25class CurrencyBundleTransformationRule implements TransformationRuleInterface
26{
27 /**
28 * {@inheritdoc}
29 */
30 public function getBundleName()
31 {
32 return 'curr';
33 }
34
35 /**
36 * {@inheritdoc}
37 */
38 public function beforeCompile(CompilationContextInterface $context)
39 {
40 // The currency data is contained in the locales and misc bundles
41 // in ICU <= 4.2
42 if (IcuVersion::compare($context->getIcuVersion(), '4.2', '<=', 1)) {
43 return array(
44 $context->getSourceDir() . '/misc/supplementalData.txt',
45 $context->getSourceDir() . '/locales'
46 );
47 }
48
49 return $context->getSourceDir() . '/curr';
50 }
51
52 /**
53 * {@inheritdoc}
54 */
55 public function afterCompile(CompilationContextInterface $context)
56 {
57 // \ResourceBundle does not like locale names with uppercase chars, so rename
58 // the resource file
59 // See: http://bugs.php.net/bug.php?id=54025
60 $fileName = $context->getBinaryDir() . '/curr/supplementalData.res';
61 $fileNameLower = $context->getBinaryDir() . '/curr/supplementaldata.res';
62
63 $context->getFilesystem()->rename($fileName, $fileNameLower);
64 }
65
66 /**
67 * {@inheritdoc}
68 */
69 public function beforeCreateStub(StubbingContextInterface $context)
70 {
71 $currencies = array();
72 $currencyBundle = Intl::getCurrencyBundle();
73
74 foreach ($currencyBundle->getCurrencyNames('en') as $code => $name) {
75 $currencies[$code] = array(
76 CurrencyBundle::INDEX_NAME => $name,
77 CurrencyBundle::INDEX_SYMBOL => $currencyBundle->getCurrencySymbol($code, 'en'),
78 CurrencyBundle::INDEX_FRACTION_DIGITS => $currencyBundle->getFractionDigits($code),
79 CurrencyBundle::INDEX_ROUNDING_INCREMENT => $currencyBundle->getRoundingIncrement($code),
80 );
81 }
82
83 return array(
84 'Currencies' => $currencies,
85 );
86 }
87
88 /**
89 * {@inheritdoc}
90 */
91 public function afterCreateStub(StubbingContextInterface $context)
92 {
93 }
94}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/LanguageBundleTransformationRule.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/LanguageBundleTransformationRule.php
deleted file mode 100644
index 5e6f9018..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/LanguageBundleTransformationRule.php
+++ /dev/null
@@ -1,71 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Transformer\Rule;
13
14use Symfony\Component\Intl\Intl;
15use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface;
16use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface;
17use Symfony\Component\Intl\Util\IcuVersion;
18
19/**
20 * The rule for compiling the language bundle.
21 *
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class LanguageBundleTransformationRule implements TransformationRuleInterface
25{
26 /**
27 * {@inheritdoc}
28 */
29 public function getBundleName()
30 {
31 return 'lang';
32 }
33
34 /**
35 * {@inheritdoc}
36 */
37 public function beforeCompile(CompilationContextInterface $context)
38 {
39 // The language data is contained in the locales bundle in ICU <= 4.2
40 if (IcuVersion::compare($context->getIcuVersion(), '4.2', '<=', 1)) {
41 return $context->getSourceDir() . '/locales';
42 }
43
44 return $context->getSourceDir() . '/lang';
45 }
46
47 /**
48 * {@inheritdoc}
49 */
50 public function afterCompile(CompilationContextInterface $context)
51 {
52 }
53
54 /**
55 * {@inheritdoc}
56 */
57 public function beforeCreateStub(StubbingContextInterface $context)
58 {
59 return array(
60 'Languages' => Intl::getLanguageBundle()->getLanguageNames('en'),
61 'Scripts' => Intl::getLanguageBundle()->getScriptNames('en'),
62 );
63 }
64
65 /**
66 * {@inheritdoc}
67 */
68 public function afterCreateStub(StubbingContextInterface $context)
69 {
70 }
71}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/LocaleBundleTransformationRule.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/LocaleBundleTransformationRule.php
deleted file mode 100644
index b2576d6e..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/LocaleBundleTransformationRule.php
+++ /dev/null
@@ -1,251 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Transformer\Rule;
13
14use Symfony\Component\Intl\Exception\RuntimeException;
15use Symfony\Component\Intl\Intl;
16use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface;
17use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface;
18use Symfony\Component\Intl\ResourceBundle\Writer\TextBundleWriter;
19
20/**
21 * The rule for compiling the locale bundle.
22 *
23 * @author Bernhard Schussek <bschussek@gmail.com>
24 */
25class LocaleBundleTransformationRule implements TransformationRuleInterface
26{
27 /**
28 * @var \Symfony\Component\Intl\ResourceBundle\LanguageBundleInterface
29 */
30 private $languageBundle;
31
32 /**
33 * @var \Symfony\Component\Intl\ResourceBundle\RegionBundleInterface
34 */
35 private $regionBundle;
36
37 public function __construct()
38 {
39 $this->languageBundle = Intl::getLanguageBundle();
40 $this->regionBundle = Intl::getRegionBundle();
41 }
42
43 /**
44 * {@inheritdoc}
45 */
46 public function getBundleName()
47 {
48 return 'locales';
49 }
50
51 /**
52 * {@inheritdoc}
53 */
54 public function beforeCompile(CompilationContextInterface $context)
55 {
56 $tempDir = sys_get_temp_dir() . '/icu-data-locales';
57
58 $context->getFilesystem()->remove($tempDir);
59 $context->getFilesystem()->mkdir($tempDir);
60
61 $this->generateTextFiles($tempDir, $this->scanLocales($context));
62
63 return $tempDir;
64 }
65
66 /**
67 * {@inheritdoc}
68 */
69 public function afterCompile(CompilationContextInterface $context)
70 {
71 $context->getFilesystem()->remove(sys_get_temp_dir() . '/icu-data-locales');
72 }
73
74 /**
75 * {@inheritdoc}
76 */
77 public function beforeCreateStub(StubbingContextInterface $context)
78 {
79 return array(
80 'Locales' => Intl::getLocaleBundle()->getLocaleNames('en'),
81 );
82 }
83
84 /**
85 * {@inheritdoc}
86 */
87 public function afterCreateStub(StubbingContextInterface $context)
88 {
89 }
90
91 private function scanLocales(CompilationContextInterface $context)
92 {
93 $tempDir = sys_get_temp_dir() . '/icu-data-locales-source';
94
95 $context->getFilesystem()->remove($tempDir);
96 $context->getFilesystem()->mkdir($tempDir);
97
98 // Temporarily generate the resource bundles
99 $context->getCompiler()->compile($context->getSourceDir() . '/locales', $tempDir);
100
101 // Discover the list of supported locales, which are the names of the resource
102 // bundles in the "locales" directory
103 $locales = glob($tempDir . '/*.res');
104
105 // Remove file extension and sort
106 array_walk($locales, function (&$locale) { $locale = basename($locale, '.res'); });
107 sort($locales);
108
109 // Delete unneeded locales
110 foreach ($locales as $key => $locale) {
111 // Delete all aliases from the list
112 // i.e., "az_AZ" is an alias for "az_Latn_AZ"
113 $content = file_get_contents($context->getSourceDir() . '/locales/' . $locale . '.txt');
114
115 // The key "%%ALIAS" is not accessible through the \ResourceBundle class,
116 // so look in the original .txt file instead
117 if (strpos($content, '%%ALIAS') !== false) {
118 unset($locales[$key]);
119 }
120
121 // Delete locales that have no content (i.e. only "Version" key)
122 $bundle = new \ResourceBundle($locale, $tempDir);
123
124 if (null === $bundle) {
125 throw new RuntimeException('The resource bundle for locale ' . $locale . ' could not be loaded from directory ' . $tempDir);
126 }
127
128 // There seems to be no other way for identifying all keys in this specific
129 // resource bundle
130 if (array_keys(iterator_to_array($bundle)) === array('Version')) {
131 unset($locales[$key]);
132 }
133 }
134
135 $context->getFilesystem()->remove($tempDir);
136
137 return $locales;
138 }
139
140 private function generateTextFiles($targetDirectory, array $locales)
141 {
142 $displayLocales = array_unique(array_merge(
143 $this->languageBundle->getLocales(),
144 $this->regionBundle->getLocales()
145 ));
146
147 $txtWriter = new TextBundleWriter();
148
149 // Generate a list of locale names in the language of each display locale
150 // Each locale name has the form: "Language (Script, Region, Variant1, ...)
151 // Script, Region and Variants are optional. If none of them is available,
152 // the braces are not printed.
153 foreach ($displayLocales as $displayLocale) {
154 // Don't include ICU's root resource bundle
155 if ('root' === $displayLocale) {
156 continue;
157 }
158
159 $names = array();
160
161 foreach ($locales as $locale) {
162 // Don't include ICU's root resource bundle
163 if ($locale === 'root') {
164 continue;
165 }
166
167 if (null !== ($name = $this->generateLocaleName($locale, $displayLocale))) {
168 $names[$locale] = $name;
169 }
170 }
171
172 // If no names could be generated for the current locale, skip it
173 if (0 === count($names)) {
174 continue;
175 }
176
177 $txtWriter->write($targetDirectory, $displayLocale, array('Locales' => $names));
178 }
179 }
180
181 private function generateLocaleName($locale, $displayLocale)
182 {
183 $name = null;
184
185 $lang = \Locale::getPrimaryLanguage($locale);
186 $script = \Locale::getScript($locale);
187 $region = \Locale::getRegion($locale);
188 $variants = \Locale::getAllVariants($locale);
189
190 // Currently the only available variant is POSIX, which we don't want
191 // to include in the list
192 if (count($variants) > 0) {
193 return null;
194 }
195
196 // Some languages are translated together with their region,
197 // i.e. "en_GB" is translated as "British English"
198 // we don't include these languages though because they mess up
199 // the name sorting
200 // $name = $this->langBundle->getLanguageName($displayLocale, $lang, $region);
201
202 // Some languages are simply not translated
203 // Example: "az" (Azerbaijani) has no translation in "af" (Afrikaans)
204 if (null === ($name = $this->languageBundle->getLanguageName($lang, null, $displayLocale))) {
205 return null;
206 }
207
208 // "as" (Assamese) has no "Variants" block
209 //if (!$langBundle->get('Variants')) {
210 // continue;
211 //}
212
213 $extras = array();
214
215 // Discover the name of the script part of the locale
216 // i.e. in zh_Hans_MO, "Hans" is the script
217 if ($script) {
218 // Some scripts are not translated into every language
219 if (null === ($scriptName = $this->languageBundle->getScriptName($script, $lang, $displayLocale))) {
220 return null;
221 }
222
223 $extras[] = $scriptName;
224 }
225
226 // Discover the name of the region part of the locale
227 // i.e. in de_AT, "AT" is the region
228 if ($region) {
229 // Some regions are not translated into every language
230 if (null === ($regionName = $this->regionBundle->getCountryName($region, $displayLocale))) {
231 return null;
232 }
233
234 $extras[] = $regionName;
235 }
236
237 if (count($extras) > 0) {
238 // Remove any existing extras
239 // For example, in German, zh_Hans is "Chinesisch (vereinfacht)".
240 // The latter is the script part which is already included in the
241 // extras and will be appended again with the other extras.
242 if (preg_match('/^(.+)\s+\([^\)]+\)$/', $name, $matches)) {
243 $name = $matches[1];
244 }
245
246 $name .= ' ('.implode(', ', $extras).')';
247 }
248
249 return $name;
250 }
251}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/RegionBundleTransformationRule.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/RegionBundleTransformationRule.php
deleted file mode 100644
index 52fdbed8..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/RegionBundleTransformationRule.php
+++ /dev/null
@@ -1,70 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Transformer\Rule;
13
14use Symfony\Component\Intl\Intl;
15use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface;
16use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface;
17use Symfony\Component\Intl\Util\IcuVersion;
18
19/**
20 * The rule for compiling the region bundle.
21 *
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class RegionBundleTransformationRule implements TransformationRuleInterface
25{
26 /**
27 * {@inheritdoc}
28 */
29 public function getBundleName()
30 {
31 return 'region';
32 }
33
34 /**
35 * {@inheritdoc}
36 */
37 public function beforeCompile(CompilationContextInterface $context)
38 {
39 // The region data is contained in the locales bundle in ICU <= 4.2
40 if (IcuVersion::compare($context->getIcuVersion(), '4.2', '<=', 1)) {
41 return $context->getSourceDir() . '/locales';
42 }
43
44 return $context->getSourceDir() . '/region';
45 }
46
47 /**
48 * {@inheritdoc}
49 */
50 public function afterCompile(CompilationContextInterface $context)
51 {
52 }
53
54 /**
55 * {@inheritdoc}
56 */
57 public function beforeCreateStub(StubbingContextInterface $context)
58 {
59 return array(
60 'Countries' => Intl::getRegionBundle()->getCountryNames('en'),
61 );
62 }
63
64 /**
65 * {@inheritdoc}
66 */
67 public function afterCreateStub(StubbingContextInterface $context)
68 {
69 }
70}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/TransformationRuleInterface.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/TransformationRuleInterface.php
deleted file mode 100644
index 3965e0d2..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/TransformationRuleInterface.php
+++ /dev/null
@@ -1,70 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Transformer\Rule;
13
14use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface;
15use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface;
16
17/**
18 * Contains instruction for compiling a resource bundle.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22interface TransformationRuleInterface
23{
24 /**
25 * Returns the name of the compiled resource bundle.
26 *
27 * @return string The name of the bundle.
28 */
29 public function getBundleName();
30
31 /**
32 * Runs instructions to be executed before compiling the sources of the
33 * resource bundle.
34 *
35 * @param CompilationContextInterface $context The contextual information of
36 * the compilation.
37 *
38 * @return string[] The source directories/files of the bundle.
39 */
40 public function beforeCompile(CompilationContextInterface $context);
41
42 /**
43 * Runs instructions to be executed after compiling the sources of the
44 * resource bundle.
45 *
46 * @param CompilationContextInterface $context The contextual information of
47 * the compilation.
48 */
49 public function afterCompile(CompilationContextInterface $context);
50
51 /**
52 * Runs instructions to be executed before creating the stub version of the
53 * resource bundle.
54 *
55 * @param StubbingContextInterface $context The contextual information of
56 * the compilation.
57 *
58 * @return mixed The data to include in the stub version.
59 */
60 public function beforeCreateStub(StubbingContextInterface $context);
61
62 /**
63 * Runs instructions to be executed after creating the stub version of the
64 * resource bundle.
65 *
66 * @param StubbingContextInterface $context The contextual information of
67 * the compilation.
68 */
69 public function afterCreateStub(StubbingContextInterface $context);
70}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/StubbingContext.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/StubbingContext.php
deleted file mode 100644
index 25ab68db..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/StubbingContext.php
+++ /dev/null
@@ -1,80 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Transformer;
13
14use Symfony\Component\Filesystem\Filesystem;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class StubbingContext implements StubbingContextInterface
20{
21 /**
22 * @var string
23 */
24 private $binaryDir;
25
26 /**
27 * @var string
28 */
29 private $stubDir;
30
31 /**
32 * @var Filesystem
33 */
34 private $filesystem;
35
36 /**
37 * @var string
38 */
39 private $icuVersion;
40
41 public function __construct($binaryDir, $stubDir, Filesystem $filesystem, $icuVersion)
42 {
43 $this->binaryDir = $binaryDir;
44 $this->stubDir = $stubDir;
45 $this->filesystem = $filesystem;
46 $this->icuVersion = $icuVersion;
47 }
48
49 /**
50 * {@inheritdoc}
51 */
52 public function getBinaryDir()
53 {
54 return $this->binaryDir;
55 }
56
57 /**
58 * {@inheritdoc}
59 */
60 public function getStubDir()
61 {
62 return $this->stubDir;
63 }
64
65 /**
66 * {@inheritdoc}
67 */
68 public function getFilesystem()
69 {
70 return $this->filesystem;
71 }
72
73 /**
74 * {@inheritdoc}
75 */
76 public function getIcuVersion()
77 {
78 return $this->icuVersion;
79 }
80}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/StubbingContextInterface.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/StubbingContextInterface.php
deleted file mode 100644
index dc492556..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Transformer/StubbingContextInterface.php
+++ /dev/null
@@ -1,46 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Transformer;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17interface StubbingContextInterface
18{
19 /**
20 * Returns the directory where the binary resource bundles are stored.
21 *
22 * @return string An absolute path to a directory.
23 */
24 public function getBinaryDir();
25
26 /**
27 * Returns the directory where the stub resource bundles are stored.
28 *
29 * @return string An absolute path to a directory.
30 */
31 public function getStubDir();
32
33 /**
34 * Returns a tool for manipulating the filesystem.
35 *
36 * @return \Symfony\Component\Filesystem\Filesystem The filesystem manipulator.
37 */
38 public function getFilesystem();
39
40 /**
41 * Returns the ICU version of the bundles being converted.
42 *
43 * @return string The ICU version string.
44 */
45 public function getIcuVersion();
46}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/ArrayAccessibleResourceBundle.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/ArrayAccessibleResourceBundle.php
deleted file mode 100644
index 9a4cccb4..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/ArrayAccessibleResourceBundle.php
+++ /dev/null
@@ -1,79 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Util;
13
14use Symfony\Component\Intl\Exception\BadMethodCallException;
15
16/**
17 * Work-around for a bug in PHP's \ResourceBundle implementation.
18 *
19 * More information can be found on https://bugs.php.net/bug.php?id=64356.
20 * This class can be removed once that bug is fixed.
21 *
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class ArrayAccessibleResourceBundle implements \ArrayAccess, \IteratorAggregate, \Countable
25{
26 private $bundleImpl;
27
28 public function __construct(\ResourceBundle $bundleImpl)
29 {
30 $this->bundleImpl = $bundleImpl;
31 }
32
33 public function get($offset, $fallback = null)
34 {
35 $value = $this->bundleImpl->get($offset, $fallback);
36
37 return $value instanceof \ResourceBundle ? new static($value) : $value;
38 }
39
40 public function offsetExists($offset)
41 {
42 return null !== $this->bundleImpl[$offset];
43 }
44
45 public function offsetGet($offset)
46 {
47 return $this->get($offset);
48 }
49
50 public function offsetSet($offset, $value)
51 {
52 throw new BadMethodCallException('Resource bundles cannot be modified.');
53 }
54
55 public function offsetUnset($offset)
56 {
57 throw new BadMethodCallException('Resource bundles cannot be modified.');
58 }
59
60 public function getIterator()
61 {
62 return $this->bundleImpl;
63 }
64
65 public function count()
66 {
67 return $this->bundleImpl->count();
68 }
69
70 public function getErrorCode()
71 {
72 return $this->bundleImpl->getErrorCode();
73 }
74
75 public function getErrorMessage()
76 {
77 return $this->bundleImpl->getErrorMessage();
78 }
79}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/RecursiveArrayAccess.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/RecursiveArrayAccess.php
deleted file mode 100644
index e1feaa2c..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/RecursiveArrayAccess.php
+++ /dev/null
@@ -1,33 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Util;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17class RecursiveArrayAccess
18{
19 public static function get($array, array $indices)
20 {
21 foreach ($indices as $index) {
22 if (!$array instanceof \ArrayAccess && !is_array($array)) {
23 return null;
24 }
25
26 $array = $array[$index];
27 }
28
29 return $array;
30 }
31
32 private function __construct() {}
33}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/RingBuffer.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/RingBuffer.php
deleted file mode 100644
index 7ccbd1e7..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/RingBuffer.php
+++ /dev/null
@@ -1,88 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Util;
13
14use Symfony\Component\Intl\Exception\OutOfBoundsException;
15
16/**
17 * Implements a ring buffer.
18 *
19 * A ring buffer is an array-like structure with a fixed size. If the buffer
20 * is full, the next written element overwrites the first bucket in the buffer,
21 * then the second and so on.
22 *
23 * @author Bernhard Schussek <bschussek@gmail.com>
24 */
25class RingBuffer implements \ArrayAccess
26{
27 private $values = array();
28
29 private $indices = array();
30
31 private $cursor = 0;
32
33 private $size;
34
35 public function __construct($size)
36 {
37 $this->size = $size;
38 }
39
40 /**
41 * {@inheritdoc}
42 */
43 public function offsetExists($key)
44 {
45 return isset($this->indices[$key]);
46 }
47
48 /**
49 * {@inheritdoc}
50 */
51 public function offsetGet($key)
52 {
53 if (!isset($this->indices[$key])) {
54 throw new OutOfBoundsException(sprintf(
55 'The index "%s" does not exist.',
56 $key
57 ));
58 }
59
60 return $this->values[$this->indices[$key]];
61 }
62
63 /**
64 * {@inheritdoc}
65 */
66 public function offsetSet($key, $value)
67 {
68 if (false !== ($keyToRemove = array_search($this->cursor, $this->indices))) {
69 unset($this->indices[$keyToRemove]);
70 }
71
72 $this->values[$this->cursor] = $value;
73 $this->indices[$key] = $this->cursor;
74
75 $this->cursor = ($this->cursor + 1) % $this->size;
76 }
77
78 /**
79 * {@inheritdoc}
80 */
81 public function offsetUnset($key)
82 {
83 if (isset($this->indices[$key])) {
84 $this->values[$this->indices[$key]] = null;
85 unset($this->indices[$key]);
86 }
87 }
88}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer/BundleWriterInterface.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer/BundleWriterInterface.php
deleted file mode 100644
index cc3b9586..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer/BundleWriterInterface.php
+++ /dev/null
@@ -1,29 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Writer;
13
14/**
15 * Writes resource bundle files.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface BundleWriterInterface
20{
21 /**
22 * Writes data to a resource bundle.
23 *
24 * @param string $path The path to the resource bundle.
25 * @param string $locale The locale to (over-)write.
26 * @param mixed $data The data to write.
27 */
28 public function write($path, $locale, $data);
29}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer/PhpBundleWriter.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer/PhpBundleWriter.php
deleted file mode 100644
index d2688b49..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer/PhpBundleWriter.php
+++ /dev/null
@@ -1,50 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Writer;
13
14/**
15 * Writes .php resource bundles.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class PhpBundleWriter implements BundleWriterInterface
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function write($path, $locale, $data)
25 {
26 $template = <<<TEMPLATE
27<?php
28
29/*
30 * This file is part of the Symfony package.
31 *
32 * (c) Fabien Potencier <fabien@symfony.com>
33 *
34 * For the full copyright and license information, please view the LICENSE
35 * file that was distributed with this source code.
36 */
37
38return %s;
39
40TEMPLATE;
41
42 $data = var_export($data, true);
43 $data = preg_replace('/array \(/', 'array(', $data);
44 $data = preg_replace('/\n {1,10}array\(/', 'array(', $data);
45 $data = preg_replace('/ /', ' ', $data);
46 $data = sprintf($template, $data);
47
48 file_put_contents($path.'/'.$locale.'.php', $data);
49 }
50}
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer/TextBundleWriter.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer/TextBundleWriter.php
deleted file mode 100644
index 342ee2dc..00000000
--- a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer/TextBundleWriter.php
+++ /dev/null
@@ -1,202 +0,0 @@
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
12namespace Symfony\Component\Intl\ResourceBundle\Writer;
13
14/**
15 * Writes .txt resource bundles.
16 *
17 * The resulting files can be converted to binary .res files using the
18 * {@link \Symfony\Component\Intl\ResourceBundle\Transformer\BundleCompiler}.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 *
22 * @see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt
23 */
24class TextBundleWriter implements BundleWriterInterface
25{
26 /**
27 * {@inheritdoc}
28 */
29 public function write($path, $locale, $data)
30 {
31 $file = fopen($path.'/'.$locale.'.txt', 'w');
32
33 $this->writeResourceBundle($file, $locale, $data);
34
35 fclose($file);
36 }
37
38 /**
39 * Writes a "resourceBundle" node.
40 *
41 * @param resource $file The file handle to write to.
42 * @param string $bundleName The name of the bundle.
43 * @param mixed $value The value of the node.
44 *
45 * @see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt
46 */
47 private function writeResourceBundle($file, $bundleName, $value)
48 {
49 fwrite($file, $bundleName);
50
51 $this->writeTable($file, $value, 0);
52
53 fwrite($file, "\n");
54 }
55
56 /**
57 * Writes a "resource" node.
58 *
59 * @param resource $file The file handle to write to.
60 * @param mixed $value The value of the node.
61 * @param integer $indentation The number of levels to indent.
62 * @param Boolean $requireBraces Whether to require braces to be printed
63 * around the value.
64 *
65 * @see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt
66 */
67 private function writeResource($file, $value, $indentation, $requireBraces = true)
68 {
69 if (is_int($value)) {
70 $this->writeInteger($file, $value);
71
72 return;
73 }
74
75 if (is_array($value)) {
76 if (count($value) === count(array_filter($value, 'is_int'))) {
77 $this->writeIntVector($file, $value, $indentation);
78
79 return;
80 }
81
82 $keys = array_keys($value);
83
84 if (count($keys) === count(array_filter($keys, 'is_int'))) {
85 $this->writeArray($file, $value, $indentation);
86
87 return;
88 }
89
90 $this->writeTable($file, $value, $indentation);
91
92 return;
93 }
94
95 if (is_bool($value)) {
96 $value = $value ? 'true' : 'false';
97 }
98
99 $this->writeString($file, (string) $value, $requireBraces);
100 }
101
102 /**
103 * Writes an "integer" node.
104 *
105 * @param resource $file The file handle to write to.
106 * @param integer $value The value of the node.
107 *
108 * @see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt
109 */
110 private function writeInteger($file, $value)
111 {
112 fprintf($file, ':int{%d}', $value);
113 }
114
115 /**
116 * Writes an "intvector" node.
117 *
118 * @param resource $file The file handle to write to.
119 * @param array $value The value of the node.
120 * @param integer $indentation The number of levels to indent.
121 *
122 * @see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt
123 */
124 private function writeIntVector($file, array $value, $indentation)
125 {
126 fwrite($file, ":intvector{\n");
127
128 foreach ($value as $int) {
129 fprintf($file, "%s%d,\n", str_repeat(' ', $indentation + 1), $int);
130 }
131
132 fprintf($file, "%s}", str_repeat(' ', $indentation));
133 }
134
135 /**
136 * Writes a "string" node.
137 *
138 * @param resource $file The file handle to write to.
139 * @param string $value The value of the node.
140 * @param Boolean $requireBraces Whether to require braces to be printed
141 * around the value.
142 *
143 * @see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt
144 */
145 private function writeString($file, $value, $requireBraces = true)
146 {
147 if ($requireBraces) {
148 fprintf($file, '{"%s"}', $value);
149
150 return;
151 }
152
153 fprintf($file, '"%s"', $value);
154 }
155
156 /**
157 * Writes an "array" node.
158 *
159 * @param resource $file The file handle to write to.
160 * @param array $value The value of the node.
161 * @param integer $indentation The number of levels to indent.
162 *
163 * @see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt
164 */
165 private function writeArray($file, array $value, $indentation)
166 {
167 fwrite($file, "{\n");
168
169 foreach ($value as $entry) {
170 fwrite($file, str_repeat(' ', $indentation + 1));
171
172 $this->writeResource($file, $entry, $indentation + 1, false);
173
174 fwrite($file, ",\n");
175 }
176
177 fprintf($file, '%s}', str_repeat(' ', $indentation));
178 }
179
180 /**
181 * Writes a "table" node.
182 *
183 * @param resource $file The file handle to write to.
184 * @param array $value The value of the node.
185 * @param integer $indentation The number of levels to indent.
186 */
187 private function writeTable($file, array $value, $indentation)
188 {
189 fwrite($file, "{\n");
190
191 foreach ($value as $key => $entry) {
192 fwrite($file, str_repeat(' ', $indentation + 1));
193 fwrite($file, $key);
194
195 $this->writeResource($file, $entry, $indentation + 1);
196
197 fwrite($file, "\n");
198 }
199
200 fprintf($file, '%s}', str_repeat(' ', $indentation));
201 }
202}