-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoload.php
More file actions
executable file
·45 lines (36 loc) · 1.08 KB
/
autoload.php
File metadata and controls
executable file
·45 lines (36 loc) · 1.08 KB
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
41
42
43
44
45
<?php
/**
* Tabs API Client autoloader.
*
* PHP Version 5.3
*
* @category API_Client
* @package Tabs
* @author Alex Wyett <alex@wyett.co.uk>
* @copyright 2013 Carlton Software
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @link http://www.carltonsoftware.co.uk
*/
spl_autoload_register(
function ($class) {
// Project specific namespace
$prefix = 'tabs\\api\\';
// Base directory
$base_dir = __DIR__ . '/src/';
// Does the class use this namespace?
$len = strlen($prefix);
// @codeCoverageIgnoreStart
if (strncmp($prefix, $class, $len) !== 0) {
// no
return;
}
// @codeCoverageIgnoreEnd
// Replace namespace prefix with the base directory, replace namepace
// separators with directory separators in teh relative class name,
// append with .class.php
$file = $base_dir . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
if (file_exists($file)) {
include $file;
}
}
);