forked from productsupcom/Platform-API-Client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoload.php
More file actions
21 lines (20 loc) · 722 Bytes
/
autoload.php
File metadata and controls
21 lines (20 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
/**
* require this autoloader only if you do not use the composer installation
*/
namespace Productsup;
function autoload($className)
{
if(strpos($className,'Productsup') === false) return false;
$className = ltrim($className, '\\');
$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 .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
require __DIR__.'/lib/'.$fileName;
}
\spl_autoload_register('Productsup\\autoload');