aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/create-stubs.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-03 19:26:54 +0200
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-03 19:26:54 +0200
commit4f5b44bd3bd490309eb2ba7b44df4769816ba729 (patch)
tree6cefe170dfe0a5a361cb1e2d1fc4d580a3316d02 /vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/create-stubs.php
parent2b840e0cfb63a453bea67a98541f3df9c273c5f5 (diff)
downloadwallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.gz
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.zst
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.zip
twig implementation
Diffstat (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/create-stubs.php')
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/create-stubs.php112
1 files changed, 112 insertions, 0 deletions
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/create-stubs.php b/vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/create-stubs.php
new file mode 100644
index 00000000..d330d6b5
--- /dev/null
+++ b/vendor/symfony/intl/Symfony/Component/Intl/Resources/bin/create-stubs.php
@@ -0,0 +1,112 @@
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
12use Symfony\Component\Filesystem\Filesystem;
13use Symfony\Component\Icu\IcuData;
14use Symfony\Component\Intl\Intl;
15use Symfony\Component\Intl\ResourceBundle\Transformer\BundleTransformer;
16use Symfony\Component\Intl\ResourceBundle\Transformer\Rule\CurrencyBundleTransformationRule;
17use Symfony\Component\Intl\ResourceBundle\Transformer\Rule\LanguageBundleTransformationRule;
18use Symfony\Component\Intl\ResourceBundle\Transformer\Rule\LocaleBundleTransformationRule;
19use Symfony\Component\Intl\ResourceBundle\Transformer\Rule\RegionBundleTransformationRule;
20use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContext;
21
22require_once __DIR__ . '/common.php';
23require_once __DIR__ . '/autoload.php';
24
25if (1 !== $GLOBALS['argc']) {
26 bailout(<<<MESSAGE
27Usage: php create-stubs.php
28
29Creates resource bundle stubs from the resource bundles in the Icu component.
30
31For running this script, the intl extension must be loaded and all vendors
32must have been installed through composer:
33
34 composer install --dev
35
36MESSAGE
37 );
38}
39
40echo LINE;
41echo centered("ICU Resource Bundle Stub Creation") . "\n";
42echo LINE;
43
44if (!Intl::isExtensionLoaded()) {
45 bailout('The intl extension for PHP is not installed.');
46}
47
48if (!class_exists('\Symfony\Component\Icu\IcuData')) {
49 bailout('You must run "composer update --dev" before running this script.');
50}
51
52$stubBranch = '1.0.x';
53
54if (IcuData::isStubbed()) {
55 bailout("Please switch to a branch of the Icu component that contains .res files (anything but $stubBranch).");
56}
57
58$shortIcuVersionInPhp = strip_minor_versions(Intl::getIcuVersion());
59$shortIcuVersionInIntlComponent = strip_minor_versions(Intl::getIcuStubVersion());
60$shortIcuVersionInIcuComponent = strip_minor_versions(IcuData::getVersion());
61
62if ($shortIcuVersionInPhp !== $shortIcuVersionInIcuComponent) {
63 bailout("The ICU version of the component ($shortIcuVersionInIcuComponent) does not match the ICU version in the intl extension ($shortIcuVersionInPhp).");
64}
65
66if ($shortIcuVersionInIntlComponent !== $shortIcuVersionInIcuComponent) {
67 bailout("The ICU version of the component ($shortIcuVersionInIcuComponent) does not match the ICU version of the stub classes in the Intl component ($shortIcuVersionInIntlComponent).");
68}
69
70echo wordwrap("Make sure that you don't have any ICU development files " .
71 "installed. If the build fails, try to run:\n", LINE_WIDTH);
72
73echo "\n sudo apt-get remove libicu-dev\n\n";
74
75$icuVersionInIcuComponent = IcuData::getVersion();
76
77echo "Compiling stubs for ICU version $icuVersionInIcuComponent.\n";
78
79echo "Preparing stub creation...\n";
80
81$targetDir = sys_get_temp_dir() . '/icu-stubs';
82
83$context = new StubbingContext(
84 IcuData::getResourceDirectory(),
85 $targetDir,
86 new Filesystem(),
87 $icuVersionInIcuComponent
88);
89
90$transformer = new BundleTransformer();
91$transformer->addRule(new LanguageBundleTransformationRule());
92$transformer->addRule(new RegionBundleTransformationRule());
93$transformer->addRule(new CurrencyBundleTransformationRule());
94$transformer->addRule(new LocaleBundleTransformationRule());
95
96echo "Starting stub creation...\n";
97
98$transformer->createStubs($context);
99
100echo "Wrote stubs to $targetDir.\n";
101
102$versionFile = $context->getStubDir() . '/version.txt';
103
104file_put_contents($versionFile, "$icuVersionInIcuComponent\n");
105
106echo "Wrote $versionFile.\n";
107
108echo "Done.\n";
109
110echo wordwrap("Please change the Icu component to branch $stubBranch now and run:\n", LINE_WIDTH);
111
112echo "\n php copy-stubs-to-component.php\n";