for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Ctw\Middleware\HtmlMinifierMiddleware\Adapter\TidyAdapter;
use Ctw\Middleware\HtmlMinifierMiddleware\Adapter\AdapterInterface;
use tidy;
class TidyAdapter extends AbstractTidyAdapter implements AdapterInterface
{
public function minify(string $htmlSource): string
$tidy = tidy_parse_string($htmlSource, $this->getConfig(), 'utf8');
assert($tidy instanceof tidy);
//dd($tidy->errorBuffer);
if (!tidy_clean_repair($tidy)) {
return $htmlSource;
}
return $this->postProcess($tidy->html()->value);