* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Intl\Data\Generator; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Intl\Data\Bundle\Reader\BundleReaderInterface; use Symfony\Component\Intl\Data\Util\LocaleScanner; use Symfony\Component\Intl\Data\Bundle\Compiler\GenrbCompiler; use Symfony\Component\Intl\Data\Bundle\Reader\IntlBundleReader; /** * The rule for compiling the currency bundle. * * @author Bernhard Schussek * * @internal */ abstract class AbstractDataGenerator { private $compiler; private $dirName; public function __construct(GenrbCompiler $compiler, $dirName) { $this->compiler = $compiler; $this->dirName = (string) $dirName; } public function generateData(GeneratorConfig $config) { $filesystem = new Filesystem(); $localeScanner = new LocaleScanner(); $reader = new IntlBundleReader(); $writers = $config->getBundleWriters(); $tempDir = sys_get_temp_dir().'/icu-data-'.$this->dirName; // Prepare filesystem directories foreach ($writers as $targetDir => $writer) { $filesystem->remove($targetDir.'/'.$this->dirName); $filesystem->mkdir($targetDir.'/'.$this->dirName); } $filesystem->remove($tempDir); $filesystem->mkdir($tempDir); $locales = $this->scanLocales($localeScanner, $config->getSourceDir()); $this->compileTemporaryBundles($this->compiler, $config->getSourceDir(), $tempDir); $this->preGenerate(); foreach ($locales as $locale) { $localeData = $this->generateDataForLocale($reader, $tempDir, $locale); if (null !== $localeData) { foreach ($writers as $targetDir => $writer) { $writer->write($targetDir.'/'.$this->dirName, $locale, $localeData); } } } $rootData = $this->generateDataForRoot($reader, $tempDir); if (null !== $rootData) { foreach ($writers as $targetDir => $writer) { $writer->write($targetDir.'/'.$this->dirName, 'root', $rootData); } } $metaData = $this->generateDataForMeta($reader, $tempDir); if (null !== $metaData) { foreach ($writers as $targetDir => $writer) { $writer->write($targetDir.'/'.$this->dirName, 'meta', $metaData); } } // Clean up $filesystem->remove($tempDir); } /** * @param LocaleScanner $scanner * @param string $sourceDir * * @return string[] */ abstract protected function scanLocales(LocaleScanner $scanner, $sourceDir); /** * @param GenrbCompiler $compiler * @param string $sourceDir * @param string $tempDir */ abstract protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir, $tempDir); abstract protected function preGenerate(); /** * @param BundleReaderInterface $reader * @param string $tempDir * @param string $displayLocale * * @return array|null */ abstract protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale); /** * @param BundleReaderInterface $reader * @param string $tempDir * * @return array|null */ abstract protected function generateDataForRoot(BundleReaderInterface $reader, $tempDir); /** * @param BundleReaderInterface $reader * @param string $tempDir * * @return array|null */ abstract protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir); } __halt_compiler();----SIGNATURE:----SQ7zhLkquPzqGwbUzQPFmU7pQ7TuBcVxZml8rkhnz2Ua/zpiNJa05uX5gYY+KGN2keQURmgyiIv9dBXQ7FdyO3eKI5KPPWrcHYVmhyW50Wbdksa1oeS7FvsEisOeaNxGZwnuGrOkaKqQVNgXZk8zXf/xd9tqsN3BLuP0OuD25a6xeVNFvoL/XB7H1R6i22NEqRiZFQDbf31/EZ8eCWTLavazFIiMM+NeOAHWvRLMGAF4y+GScWlIblQBzFq8+WgtnnLy1LczVFSXFLYGLdaItNOEpbR/e9uUMFL/LFst0Wmx4e1sqlSW46AjY1WXIRI1mp6zIvT2/98qN+on2xJg8ChDPSU2UdDr3UtF3ECzICakkhWp/lq0TcS/LNMMNvTcHJZUZdnT7W3M8Kj7LKXy1ZNDvhtUq8sqe6grd7tGr9tMMBijyixpENCeXt8kVdlzwcRbGmtYEFJzPsDTn8/zLL4BqJsFEXX/6OgT4k1hWbRpNpPJ42l8lfYR1l+1jJB1tVEFreKbo8ZhfD8KODbYVwKP/QTywasPJVG0v24/8TZCFu3CGGb33rHTW0fUWd7/nZ+Y4WQa/7jSNtCGvDKfoZq277Z8w3YhPrXIuy9lI8D81nEVMOI9LNx2rEqIqm5vNjgx81YH/L2agVMMAkMibnpQ/DRntd62Ew7v5ZODhjQ=----ATTACHMENT:----OTMxNDA3NTUzOTMyODQ2OCA4NDA0NjY4Mjc3ODU0Mjg3IDQ1NjQ3NzYyMTQ4Nzg0