mirror of
https://github.com/twigphp/Twig.git
synced 2026-11-01 08:35:42 +00:00
switched to namespace first, PSR-0 as a fallback
This commit is contained in:
@@ -1,11 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Twig.
|
||||
*
|
||||
* (c) Fabien Potencier
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Twig\Node;
|
||||
|
||||
class_exists('Twig_Node_Spaceless');
|
||||
use Twig\Compiler;
|
||||
|
||||
if (\false) {
|
||||
class SpacelessNode extends \Twig_Node_Spaceless
|
||||
/**
|
||||
* Represents a spaceless node.
|
||||
*
|
||||
* It removes spaces between HTML tags.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class SpacelessNode extends Node implements NodeOutputInterface
|
||||
{
|
||||
public function __construct(Node $body, $lineno, $tag = 'spaceless')
|
||||
{
|
||||
parent::__construct(['body' => $body], [], $lineno, $tag);
|
||||
}
|
||||
|
||||
public function compile(Compiler $compiler)
|
||||
{
|
||||
$compiler
|
||||
->addDebugInfo($this)
|
||||
->write("ob_start();\n")
|
||||
->subcompile($this->getNode('body'))
|
||||
->write("echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));\n")
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig\Node\SpacelessNode', 'Twig_Node_Spaceless');
|
||||
|
||||
Reference in New Issue
Block a user