-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApi.php
48 lines (47 loc) · 939 Bytes
/
Api.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
41
42
43
44
45
46
47
48
<?php
namespace PNPSystem;
use \AIOSystem\Api\Event;
use \AIOSystem\Api\System;
class Api {
/**
* @static
* @return void
*/
public static function Setup(){
spl_autoload_register( array(__CLASS__,'AutoLoader') );
}
/**
* AutoLoader: System
*
* @param string $Class
* @return bool
*/
private static function AutoLoader( $Class ) {
/**
* Check: Class matches loader
*/
if( strpos( $Class, __NAMESPACE__, 0 ) === 0 ) {
/**
* Replace: __NAMESPACE__ -> Current directory
* Build: Real path to class file
*/
$ClassPath = realpath( str_replace( __NAMESPACE__, __DIR__, $Class ).'.php' );
/**
* Check: File exists
*/
if( file_exists( $ClassPath ) ) {
/**
* Load: Class file
*/
Event::Message( 'Load: '.$Class.' -> '.$ClassPath, __METHOD__,__LINE__ );
require_once( $ClassPath );
return true;
}
}
return false;
}
}
/**
* Load API
*/
Api::Setup();