Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96361988
Bootstrap.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
Wed, Dec 25, 22:20
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Dec 27, 22:20 (2 d)
Engine
blob
Format
Raw Data
Handle
23172142
Attached To
rPH Phabricator
Bootstrap.php
View Options
<?php
namespace
RESTful
;
/**
* Bootstrapper for RESTful does autoloading.
*/
class
Bootstrap
{
const
DIR_SEPARATOR
=
DIRECTORY_SEPARATOR
;
const
NAMESPACE_SEPARATOR
=
'
\\
'
;
public
static
$initialized
=
false
;
public
static
function
init
()
{
spl_autoload_register
(
array
(
'
\R
ESTful
\B
ootstrap'
,
'autoload'
));
}
public
static
function
autoload
(
$classname
)
{
self
::
_autoload
(
dirname
(
dirname
(
__FILE__
)),
$classname
);
}
public
static
function
pharInit
()
{
spl_autoload_register
(
array
(
'
\R
ESTful
\B
ootstrap'
,
'pharAutoload'
));
}
public
static
function
pharAutoload
(
$classname
)
{
self
::
_autoload
(
'phar://restful.phar'
,
$classname
);
}
private
static
function
_autoload
(
$base
,
$classname
)
{
$parts
=
explode
(
self
::
NAMESPACE_SEPARATOR
,
$classname
);
$path
=
$base
.
self
::
DIR_SEPARATOR
.
implode
(
self
::
DIR_SEPARATOR
,
$parts
)
.
'.php'
;
if
(
file_exists
(
$path
))
{
require_once
(
$path
);
}
}
}
Event Timeline
Log In to Comment