CoreFiles by mySites.guru
Response.php63 lines, 1,613 bytes, from Joomla_5.4.11-Stable-Full_Package.zip
Raw History Compare with 5.4.10
md5
c35be38099bed021033e902208349268
sha1
ae8fd2156f4a106d7bac991a766e6e9fadde2395
sha256
792b2d9a8b09bd1d93caa18419e935fc9d02b102dc9744cdc8f5af3f22492a66
<?php

/**
 * Part of the Joomla Framework Http Package
 *
 * @copyright  Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */

namespace Joomla\Http;

use Laminas\Diactoros\Response as PsrResponse;

/**
 * HTTP response data object class.
 *
 * @property-read  string   $body     The response body as a string
 * @property-read  integer  $code     The status code of the response
 * @property-read  array    $headers  The headers as an array
 *
 * @since  1.0
 */
class Response extends PsrResponse
{
    /**
     * Magic getter for backward compatibility with the 1.x API
     *
     * @param   string  $name  The variable to return
     *
     * @return  mixed
     *
     * @since   2.0.0
     * @deprecated  3.0  Access data via the PSR-7 ResponseInterface instead
     */
    public function __get($name)
    {
        switch (strtolower($name)) {
            case 'body':
                return (string) $this->getBody();

            case 'code':
                return $this->getStatusCode();

            case 'headers':
                return $this->getHeaders();

            default:
                $trace = debug_backtrace();

                trigger_error(
                    sprintf(
                        'Undefined property via __get(): %s in %s on line %s',
                        $name,
                        $trace[0]['file'],
                        $trace[0]['line']
                    ),
                    E_USER_NOTICE
                );

                break;
        }
    }
}

The same content is in 109 releases, Joomla 5.0.0-alpha1 to 6.0.0-alpha3. See them all, or every version of this file.