-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathResponse.php
More file actions
63 lines (54 loc) · 1.58 KB
/
Response.php
File metadata and controls
63 lines (54 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?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;
}
}
}