1: | <?php
|
2: |
|
3: | namespace Mypos\IPC;
|
4: |
|
5: | |
6: | |
7: |
|
8: | class Loader{
|
9: |
|
10: | |
11: | |
12: | |
13: | |
14: |
|
15: | static public function loader($class_name){
|
16: |
|
17: | if(preg_match('/^' . str_replace('\\', '\\\\', __NAMESPACE__) . '\\\/', $class_name)){
|
18: | $filePath = dirname(__FILE__) . DIRECTORY_SEPARATOR . str_replace(array(__NAMESPACE__ . '\\', '\\'), array('', DIRECTORY_SEPARATOR), $class_name) . '.php';
|
19: | if(is_file($filePath) && is_readable($filePath)){
|
20: | require_once $filePath;
|
21: | return true;
|
22: | }
|
23: | }
|
24: | }
|
25: |
|
26: | }
|
27: |
|
28: | spl_autoload_register('\Mypos\IPC\Loader::loader');
|
29: | |