Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1335882
Resource.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
Resource.php
View Options
<?php
namespace
Balanced
;
use
Balanced\Errors\Error
;
use
RESTful\Exceptions\HTTPError
;
class
Resource
extends
\RESTful\Resource
{
public
static
$fields
,
$f
;
protected
static
$_client
,
$_registry
,
$_uri_spec
;
public
static
function
init
()
{
self
::
$_client
=
new
\RESTful\Client
(
'
\B
alanced
\S
ettings'
,
null
,
__NAMESPACE__
.
'
\R
esource::convertError'
);
self
::
$_registry
=
new
\RESTful\Registry
();
self
::
$f
=
self
::
$fields
=
new
\RESTful\Fields
();
}
public
static
function
convertError
(
$response
)
{
if
(
property_exists
(
$response
->
body
,
'category_code'
)
&&
array_key_exists
(
$response
->
body
->
category_code
,
Error
::
$codes
))
$error
=
new
Error
::
$codes
[
$response
->
body
->
category_code
](
$response
);
else
$error
=
new
HTTPError
(
$response
);
return
$error
;
}
public
static
function
getClient
()
{
$class
=
get_called_class
();
return
$class
::
$_client
;
}
public
static
function
getRegistry
()
{
$class
=
get_called_class
();
return
$class
::
$_registry
;
}
public
static
function
getURISpec
()
{
$class
=
get_called_class
();
return
$class
::
$_uri_spec
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jul 6, 7:28 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
316082
Default Alt Text
Resource.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment