PhpBundleWriter example

echo "Using $genrb.\n";

$icuVersionInDownload = get_icu_version_from_genrb($genrbEnv.' '.$genrb);

echo "Preparing resource bundle compilation (version $icuVersionInDownload)...\n";

$compiler = new GenrbCompiler($genrb$genrbEnv);
$config = new GeneratorConfig($sourceDir.'/data', $icuVersionInDownload);
$dataDir = dirname(__DIR__).'/data';

$config->addBundleWriter($dataDirnew PhpBundleWriter());

echo "Starting resource bundle compilation. This may take a while...\n";

// We don't want to use fallback to English during generation Locale::setDefaultFallback('root');

echo "Generating language data...\n";

$generator = new LanguageDataGenerator($compiler, Intl::LANGUAGE_DIR);
$generator->generateData($config);

/** * @author Bernhard Schussek <bschussek@gmail.com> */
class PhpBundleWriterTest extends TestCase
{
    private PhpBundleWriter $writer;
    private string $directory;
    private Filesystem $filesystem;

    protected function setUp(): void
    {
        $this->writer = new PhpBundleWriter();
        $this->directory = sys_get_temp_dir().'/PhpBundleWriterTest/'.mt_rand(1000, 9999);
        $this->filesystem = new Filesystem();

        $this->filesystem->mkdir($this->directory);
    }

    protected function tearDown(): void
    {
        $this->filesystem->remove($this->directory);
    }

    
Home | Imprint | This part of the site doesn't use cookies.