4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Intl\ResourceBundle\Writer
;
15 * Writes .php resource bundles.
17 * @author Bernhard Schussek <bschussek@gmail.com>
19 class PhpBundleWriter
implements BundleWriterInterface
24 public function write($path, $locale, $data)
26 $template = <<<TEMPLATE
30 * This file is part of the Symfony package.
32 * (c) Fabien Potencier <fabien@symfony.com>
34 * For the full copyright and license information, please view the LICENSE
35 * file that was distributed with this source code.
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);
48 file_put_contents($path.'/'.$locale.'.php', $data);