aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler
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/ResourceBundle/Compiler
parent2b840e0cfb63a453bea67a98541f3df9c273c5f5 (diff)
downloadwallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.gz
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.zst
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.zip
twig implementation
Diffstat (limited to 'vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler')
-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
2 files changed, 100 insertions, 0 deletions
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler/BundleCompiler.php b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler/BundleCompiler.php
new file mode 100644
index 00000000..174aa179
--- /dev/null
+++ b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler/BundleCompiler.php
@@ -0,0 +1,71 @@
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
new file mode 100644
index 00000000..6184ea3e
--- /dev/null
+++ b/vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Compiler/BundleCompilerInterface.php
@@ -0,0 +1,29 @@
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}