CoreFiles by mySites.guru
HtmlRenderer.php67 lines, 1,427 bytes, from Joomla_4.0.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha2
md5
0e293fcfb7a100a0ebf1f20a1456fe6c
sha1
47fb0bbb12d25c2d8fbc05419e8c2ba713d6ebc0
sha256
35301c748267d74e2c7b4bc44d43ed93a2b5fe6f151c7073bdc119e0a4bfd4b6
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2018 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;

/**
 * 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(\JText::_('Error') . ': ' . $error->getCode());

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

No other release has this exact content. See every version of this file.