CoreFiles by mySites.guru
JsonRenderer.php48 lines, 1,078 bytes, from Joomla_4.2.2-Stable-Full_Package.zip
Raw History Compare with 4.2.1
md5
25958124ebb46a72a5bd5da7e246d6fb
sha1
ff5d0ed424035f1651381edf0ab4e9a7464c8295
sha256
7311f66217a913bd2b324720500fd0b5a5052ec7d72faf25b78191d9380f4782
<?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;

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

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * 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 225 releases, Joomla 4.2.1 to 6.2.1-rc1. See them all, or every version of this file.