forked from provisioner/Provisioner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoload.php
executable file
·40 lines (35 loc) · 1.02 KB
/
autoload.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* SPL Auto-loader
*
* @author Darren Schreiber
* @license MPL / GPLv2 / LGPL
* @package Provisioner
*/
class ProvisionerConfig {
/**
* Setup anything required to make our provisioner class work
*/
public static function setup() {
// Register auto-loader. When classes are requested that aren't loaded, we'll find them via endpointsAutoload()
spl_autoload_register(array(
'ProvisionerConfig',
'endpointsAutoload'
));
}
public static function endpointsAutoload($class) {
// If for some reason we get here and the class is already loaded, return
if (class_exists($class, FALSE))
{
return TRUE;
}
// Try to include the class
$file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
if (is_file(PROVISIONER_BASE . $file)) {
require_once(PROVISIONER_BASE . $file);
return TRUE;
}
return FALSE;
}
}
ProvisionerConfig::setup();