Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60236557
HTTPFutureResponseStatusHTTP.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Apr 28, 13:19
Size
955 B
Mime Type
text/x-php
Expires
Tue, Apr 30, 13:19 (2 d)
Engine
blob
Format
Raw Data
Handle
17322877
Attached To
rPHU libphutil
HTTPFutureResponseStatusHTTP.php
View Options
<?php
/**
* @group futures
*/
final
class
HTTPFutureResponseStatusHTTP
extends
HTTPFutureResponseStatus
{
private
$excerpt
;
public
function
__construct
(
$status_code
,
$body
)
{
// NOTE: Avoiding phutil_utf8_shorten() here because this isn't lazy
// and responses may be large.
if
(
strlen
(
$body
)
>
512
)
{
$excerpt
=
substr
(
$body
,
0
,
512
).
'...'
;
}
else
{
$excerpt
=
$body
;
}
$this
->
excerpt
=
phutil_utf8ize
(
$excerpt
);
parent
::
__construct
(
$status_code
);
}
protected
function
getErrorCodeType
(
$code
)
{
return
'HTTP'
;
}
public
function
isError
()
{
return
(
$this
->
getStatusCode
()
<
200
)
||
(
$this
->
getStatusCode
()
>
299
);
}
public
function
isTimeout
()
{
return
false
;
}
protected
function
getErrorCodeDescription
(
$code
)
{
static
$map
=
array
(
404
=>
'Not Found'
,
500
=>
'Internal Server Error'
,
);
return
idx
(
$map
,
$code
).
"
\n
"
.
$this
->
excerpt
.
"
\n
"
;
}
}
Event Timeline
Log In to Comment