CoreFiles by mySites.guru
HtmlRenderer.php69 lines, 1,499 bytes, from Joomla_4.0.0-alpha8-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha7
md5
42f2c73436efef4a19b1ed5223e9edf5
sha1
baec88c785893586da77dce3c95e4ebccdbd2e7e
sha256
83752056e0c9b17e408200d873b5ff5342a6b899bdd1a75088630c8ab94bd672
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */

namespace Joomla\CMS\Error\Renderer;

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Error\AbstractRenderer;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;

/**
 * HTML error page renderer
 *
 * @since  4.0
 * @todo   Change this renderer to use JDocumentHtml instead of JDocumentError, the latter is only used for B/C at this time
 */
class HtmlRenderer extends AbstractRenderer
{
	/**
	 * The format (type) of the error page
	 *
	 * @var    string
	 * @since  4.0
	 */
	protected $type = 'error';

	/**
	 * Render the error page for the given object
	 *
	 * @param   \Throwable  $error  The error object to be rendered
	 *
	 * @return  string
	 *
	 * @since   4.0
	 */
	public function render(\Throwable $error): string
	{
		$app = Factory::getApplication();

		// Get the current template from the application
		$template = $app->getTemplate();

		// Push the error object into the document
		$this->getDocument()->setError($error);

		if (ob_get_contents())
		{
			ob_end_clean();
		}

		$this->getDocument()->setTitle(Text::_('Error') . ': ' . $error->getCode());

		return $this->getDocument()->render(
			false,
			[
				'template'  => $template,
				'directory' => JPATH_THEMES,
				'debug'     => JDEBUG,
				'csp_nonce' => $app->get('csp_nonce'),
			]
		);
	}
}

The same content is in 5 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha11. See them all, or every version of this file.