diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-04 17:50:34 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-04 17:50:34 +0200 |
commit | 46b77928f746a4231d064774b5b67fd892c7ce86 (patch) | |
tree | e3ea690b3f0def1744ddae758923cf92171ef985 /vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer | |
parent | 68abd9c71b1d2f7bb2e9d21819584d1d15005b25 (diff) | |
download | wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.tar.gz wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.tar.zst wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.zip |
rm vendor
Diffstat (limited to 'vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Writer')
3 files changed, 0 insertions, 281 deletions
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 | |||
12 | namespace Symfony\Component\Intl\ResourceBundle\Writer; | ||
13 | |||
14 | /** | ||
15 | * Writes resource bundle files. | ||
16 | * | ||
17 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
18 | */ | ||
19 | interface 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 | |||
12 | namespace Symfony\Component\Intl\ResourceBundle\Writer; | ||
13 | |||
14 | /** | ||
15 | * Writes .php resource bundles. | ||
16 | * | ||
17 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
18 | */ | ||
19 | class 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 | |||
38 | return %s; | ||
39 | |||
40 | TEMPLATE; | ||
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 | |||
12 | namespace 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 | */ | ||
24 | class 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 | } | ||