CoreFiles by mySites.guru
JsonRenderer.php45 lines, 935 bytes, from Joomla_4.1.2-Stable-Full_Package.zip
Raw History Compare with 4.1.1
md5
369b1afea91b913745571cb31d492766
sha1
ed253843e5e5a25f4d80ccc46d1127a8e78cf033
sha256
77dbc74633e94893f760ab690cb6522cb5157c8d99d1b6f323085efacb77f128
<?php
/**
 * @package     Joomla.Installation
 * @subpackage  Error
 *
 * @copyright   (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Installation\Error\Renderer;

\defined('_JEXEC') or die;

use Joomla\CMS\Error\AbstractRenderer;
use Joomla\CMS\Installation\Response\JsonResponse;

/**
 * JSON error page renderer for the installation application
 *
 * @since  4.0.0
 */
class JsonRenderer extends AbstractRenderer
{
	/**
	 * The format (type) of the error page
	 *
	 * @var    string
	 * @since  4.0.0
	 */
	protected $type = 'json';

	/**
	 * Render the error page for the given object
	 *
	 * @param   \Throwable  $error  The error object to be rendered
	 *
	 * @return  string
	 *
	 * @since   4.0.0
	 */
	public function render(\Throwable $error): string
	{
		return json_encode(new JsonResponse($error));
	}
}

The same content is in 49 releases, Joomla 4.0.0-rc1 to 4.2.0-beta2. See them all, or every version of this file.