src/Zicht/Tool/Packager/Node/StaticStub.php
protected function compileInitialization(Buffer $buffer)
    {
        $configurationLoader = new Configuration\ConfigurationLoader(
            $this->staticConfig,
            new FileLocator(array(getcwd())),
            new Configuration\FileLoader(
                new Configuration\PathDefaultFileLocator(
                    'ZPLUGINPATH',
                    $this->staticPluginPaths
                )
            )
        );

        $compiler = new ContainerCompiler($configurationLoader->processConfiguration(), array());
        $this->phar['container.php'] = $compiler->compileContainerCode();
        $buffer->writeln('$container = require_once \'phar://z.phar/container.php\';');

        foreach ($configurationLoader->getPlugins() as $name => $plugin) {
            $className = get_class($plugin);
            $embeddedFilename = 'plugins/' . $name . '.php';

            $class = new \ReflectionClass($className);

            $this->phar[$embeddedFilename] = file_get_contents($class->getFileName());
            $buffer->write('require_once ')->asPhp('phar://z.phar/' . $embeddedFilename)->raw(';')->eol();
            $buffer->write('$p = new ')->write($className)->raw('();')->eol();
            $buffer->writeln('$p->setContainer($container);');
        }
        $buffer
            ->writeln('Zicht\Tool\Application::$HEADER = \'\';')
            ->write('$app = new Zicht\Tool\Application(')
            ->asPhp($this->appName)
            ->raw(', Zicht\Version\Version::fromString(')
            ->asPhp($this->appVersion)
            ->raw(') ?: new Zicht\Version\Version());')
            ->eol()
        ;
        $buffer->writeln('$app->setContainer($container);');
    }
protected function compileInitialization(Buffer $buffer)
    {
        $configurationLoader = new Configuration\ConfigurationLoader(
            $this->staticConfig,
            new FileLocator(array(getcwd())),
            new Configuration\FileLoader(
                new Configuration\PathDefaultFileLocator(
                    'ZPLUGINPATH',
                    $this->staticPluginPaths
                )
            )
        );

        $compiler = new ContainerCompiler($configurationLoader->processConfiguration(), array());
        $this->phar['container.php'] = $compiler->compileContainerCode();
        $buffer->writeln('$container = require_once \'phar://z.phar/container.php\';');

        foreach ($configurationLoader->getPlugins() as $name => $plugin) {
            $className = get_class($plugin);
            $embeddedFilename = 'plugins/' . $name . '.php';

            $class = new \ReflectionClass($className);

            $this->phar[$embeddedFilename] = file_get_contents($class->getFileName());
            $buffer->write('require_once ')->asPhp('phar://z.phar/' . $embeddedFilename)->raw(';')->eol();
            $buffer->write('$p = new ')->write($className)->raw('();')->eol();
            $buffer->writeln('$p->setContainer($container);');
        }
        $buffer
            ->writeln('Zicht\Tool\Application::$HEADER = \'\';')
            ->write('$app = new Zicht\Tool\Application(')
            ->asPhp($this->appName)
            ->raw(', Zicht\Version\Version::fromString(')
            ->asPhp($this->appVersion)
            ->raw(') ?: new Zicht\Version\Version());')
            ->eol()
        ;
        $buffer->writeln('$app->setContainer($container);');
    }
protected function compileInitialization ( Buffer $ buffer ) { $ configurationLoader = new Configuration \ ConfigurationLoader ( $ this -> staticConfig , new FileLocator ( array ( getcwd ( ) ) ) , new Configuration \ FileLoader ( new Configuration \ PathDefaultFileLocator ( 'ZPLUGINPATH' , $ this -> staticPluginPaths ) ) ) ; $ compiler = new ContainerCompiler ( $ configurationLoader -> processConfiguration ( ) , array ( ) ) ; $ this -> phar [ 'container.php' ] = $ compiler -> compileContainerCode ( ) ; $ buffer -> writeln ( '$container = require_once \'phar://z.phar/container.php\';' ) ; foreach ( $ configurationLoader -> getPlugins ( ) as $ name => $ plugin ) { $ className = get_class ( $ plugin ) ; $ embeddedFilename = 'plugins/' . $ name . '.php' ; $ class = new \ ReflectionClass ( $ className ) ; $ this -> phar [ $ embeddedFilename ] = file_get_contents ( $ class -> getFileName ( ) ) ; $ buffer -> write ( 'require_once ' ) -> asPhp ( 'phar://z.phar/' . $ embeddedFilename ) -> raw ( ';' ) -> eol ( ) ; $ buffer -> write ( '$p = new ' ) -> write ( $ className ) -> raw ( '();' ) -> eol ( ) ; $ buffer -> writeln ( '$p->setContainer($container);' ) ; } $ buffer -> writeln ( 'Zicht\Tool\Application::$HEADER = \'\';' ) -> write ( '$app = new Zicht\Tool\Application(' ) -> asPhp ( $ this -> appName ) -> raw ( ', Zicht\Version\Version::fromString(' ) -> asPhp ( $ this -> appVersion ) -> raw ( ') ?: new Zicht\Version\Version());' ) -> eol ( ) ; $ buffer -> writeln ( '$app->setContainer($container);' ) ; }
Writes the initialization code for a static build of Z.

@param \Zicht\Tool\Script\Buffer $buffer
@return mixed|void
Writes the initialization code for a static build of Z .