for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PSFS\base\extension;
/**
* Class AssetsNode
* @package PSFS\base\extension
*/
class AssetsNode extends \Twig_Node
{
protected $hash;
protected $type;
* @param string $name
* @param array $values
* @param int $line
* @param null $tag
* @param string $type
public function __construct($name, $values, $line, $tag = null, $type = 'js')
parent::__construct(array('scripts' => $values["node"]), array('name' => $name), $line, $tag);
$this->hash = $values["hash"];
$this->type = $type;
}
public function compile(\Twig_Compiler $compiler)
$scripts = $this->getNode("scripts");
//Creamos el parser
$compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\'' . $this->type . '\')')
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.
->raw(";\n");
//Asociamos el hash
$compiler->write('$parser->setHash(\'' . $this->hash . '\')')
//Asociamos los ficheros
foreach ($scripts->getAttribute("value") as $value) {
$compiler->write('$parser->addFile(\'' . $value . '\')')->raw(";\n");
//Procesamos los ficheros
$compiler->write('$parser->compile()')
//Imprimimos los tags
$compiler->write('$parser->printHtml()')
//Damos oxigeno
$compiler->raw("\n");
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.