Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93971602
Httpful.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
Mon, Dec 2, 22:49
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Dec 4, 22:49 (2 d)
Engine
blob
Format
Raw Data
Handle
22731195
Attached To
rPH Phabricator
Httpful.php
View Options
<?php
namespace
Httpful
;
class
Httpful
{
const
VERSION
=
'0.1.7'
;
private
static
$mimeRegistrar
=
array
();
private
static
$default
=
null
;
/**
* @param string $mime_type
* @param MimeHandlerAdapter $handler
*/
public
static
function
register
(
$mimeType
,
\Httpful\Handlers\MimeHandlerAdapter
$handler
)
{
self
::
$mimeRegistrar
[
$mimeType
]
=
$handler
;
}
/**
* @param string $mime_type defaults to MimeHandlerAdapter
* @return MimeHandlerAdapter
*/
public
static
function
get
(
$mimeType
=
null
)
{
if
(
isset
(
self
::
$mimeRegistrar
[
$mimeType
]))
{
return
self
::
$mimeRegistrar
[
$mimeType
];
}
if
(
empty
(
self
::
$default
))
{
self
::
$default
=
new
\Httpful\Handlers\MimeHandlerAdapter
();
}
return
self
::
$default
;
}
/**
* Does this particular Mime Type have a parser registered
* for it?
* @return bool
*/
public
static
function
hasParserRegistered
(
$mimeType
)
{
return
isset
(
self
::
$mimeRegistrar
[
$mimeType
]);
}
}
Event Timeline
Log In to Comment