forked from krichprollsch/phpCssEmbed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoload.php.dist
28 lines (24 loc) · 853 Bytes
/
autoload.php.dist
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
<?php
spl_autoload_register(
function ($className) {
$className = ltrim($className, '\\');
if (0 != strpos($className, 'CssEmbed\\Tests')) {
return false;
}
$fileName = '';
$namespace = '';
if ($lastNsPos = strrpos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName = __DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . $fileName . $className . '.php';
if (is_file($fileName)) {
require $fileName;
return true;
}
return false;
}
);
// Use the bundled autoloader
require_once __DIR__.'/src/autoload.php';