Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92595315
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
Thu, Nov 21, 20:09
Size
955 B
Mime Type
text/x-php
Expires
Sat, Nov 23, 20:09 (2 d)
Engine
blob
Format
Raw Data
Handle
22465988
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