PHP Class Netgusto\PortalBundle\Twig\PortalExtension

Inheritance: extends Twig_Extension
Show file Open project: fruux/Baikal2

Protected Properties

Property Type Description
$container

Public Methods

Method Description
__construct ( Symfony\Component\DependencyInjection\ContainerInterface $container )
application ( $name, array $options = [] )
getFunctions ( )
getName ( )

Protected Methods

Method Description
reactwebpack ( $app, $options = [] ) * protected function embercli($app, $options = array()) {

Private Methods

Method Description
extractAppAndRewriteAssetsUrl ( $content, $assetprefix, $kept = [] )
produceConfigurationMeta ( $options, $cbk = null )

Method Details

__construct() public method

public __construct ( Symfony\Component\DependencyInjection\ContainerInterface $container )
$container Symfony\Component\DependencyInjection\ContainerInterface

application() public method

public application ( $name, array $options = [] )
$options array

getFunctions() public method

public getFunctions ( )

getName() public method

public getName ( )

reactwebpack() protected method

$sfdir = realpath($this->container->getParameter('kernel.root_dir') . '/../'); $apppath = realpath($sfdir . '/' . $app['path']); $webdir = realpath($sfdir . '/web'); $debug = $this->container->getParameter('kernel.debug'); if($debug) { $url = 'http://0.0.0.0:' . (array_key_exists('port', $app) ? $app['port'] : '4200'); $content = file_get_contents($url); $assetprefix = $url; } else { $content = file_get_contents($apppath . '/dist/index.html'); $relapppath = preg_replace('%^' . preg_quote($webdir) . '%', '', $apppath); $assetprefix = $relapppath . '/dist'; } $assetprefix = rtrim($assetprefix, '/') . '/'; # On récupère la balise meta config/environment $kept = array(); $kept[] = $this->produceConfigurationMeta($content, $options, function($config) { $config['locationType'] = 'hash'; return $config; }); $parts = $this->extractAppAndRewriteAssetsUrl($content, $assetprefix, $kept); return new PortalApplicationResponse($parts['assets'], $parts['html']); }
protected reactwebpack ( $app, $options = [] )

Property Details

$container protected property

protected $container