phug-php/phug

View on GitHub
src/Phug/Formatter/Formatter/Util/PhpUnwrap.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace Phug\Formatter\Util;

use Phug\Formatter;

class PhpUnwrap extends PhpUnwrapString
{
    public function __construct($element, Formatter $formatter)
    {
        parent::__construct(implode('', array_map(function ($child) use ($formatter) {
            return is_string($child) ? $child : $formatter->format($child);
        }, is_array($element) ? $element : [$element])));

        $this->unwrapStart();
        $this->unwrapEnd();
    }
}