. */ declare(strict_types=1); namespace SP\Tests\Stubs; use Closure; use SP\Mvc\View\OutputHandlerInterface; /** * Class OutputHandlerStub */ final readonly class OutputHandlerStub implements OutputHandlerInterface { public function __construct(private Closure $outputChecker) { } /** * @inheritDoc */ public function bufferedContent(callable $callback): string { ob_flush(); ob_start(); $callback(); $out = ob_get_clean(); ($this->outputChecker)($out); return $out; } }