for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Faulancer\View\Helper;
use Faulancer\View\AbstractViewHelper;
/**
* Class Block
*
* @package Faulancer\View\Helper
* @author Florian Knapp <[email protected]>
*/
class Block extends AbstractViewHelper
{
/** @var bool */
protected static $tagOpened = false;
protected static $content = '';
* Block opening handler
* @param string $name
public function __invoke(string $name = '')
if (!self::$tagOpened) {
ob_start(function($buffer) {
self::$content = $buffer;
});
} else {
$content = ob_get_contents();
ob_end_clean();
$this->view->getParentTemplate()->setVariable($name, $content);
self::$tagOpened = false;
}
self::$tagOpened = true;
public function __destruct()