Test Failed
Push — 1.0.0-dev ( 6506b5...225896 )
by nguereza
05:07
created

test_autoload()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 45
Code Lines 39

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 3
eloc 39
c 1
b 1
f 0
nc 3
nop 1
dl 0
loc 45
rs 9.296
1
<?php
2
	//Autoload function
3
	function test_autoload($class){
4
		$classesMap = array(
5
			//Caches
6
			'ApcCache' => CORE_CLASSES_CACHE_PATH . 'ApcCache.php',
7
			'CacheInterface' => CORE_CLASSES_CACHE_PATH . 'CacheInterface.php',
8
			'FileCache' => CORE_CLASSES_CACHE_PATH . 'FileCache.php',
9
			'DBSessionHandlerModel' => CORE_CLASSES_MODEL_PATH . 'DBSessionHandlerModel.php',
10
			'Model' => CORE_CLASSES_MODEL_PATH . 'Model.php',
11
			//Core classes
12
			'Config' => CORE_CLASSES_PATH . 'Config.php',
13
			'Controller' => CORE_CLASSES_PATH . 'Controller.php',
14
			'Database' => CORE_CLASSES_PATH . 'Database.php',
15
			'DBSessionHandler' => CORE_CLASSES_PATH . 'DBSessionHandler.php',
16
			'Event' => CORE_CLASSES_PATH . 'Event.php',
17
			'EventDispatcher' => CORE_CLASSES_PATH . 'EventDispatcher.php',
18
			'Lang' => CORE_CLASSES_PATH . 'Lang.php',
19
			'Loader' => CORE_CLASSES_PATH . 'Loader.php',
20
			'Log' => CORE_CLASSES_PATH . 'Log.php',
21
			'Module' => CORE_CLASSES_PATH . 'Module.php',
22
			'Request' => CORE_CLASSES_PATH . 'Request.php',
23
			'Response' => CORE_CLASSES_PATH . 'Response.php',
24
			'Router' => CORE_CLASSES_PATH . 'Router.php',
25
			'Security' => CORE_CLASSES_PATH . 'Security.php',
26
			'Session' => CORE_CLASSES_PATH . 'Session.php',
27
			'Url' => CORE_CLASSES_PATH . 'Url.php',
28
			//Core libraries
29
			'Assets' => CORE_LIBRARY_PATH . 'Assets.php',
30
			'Benchmark' => CORE_LIBRARY_PATH . 'Benchmark.php',
31
			'Browser' => CORE_LIBRARY_PATH . 'Browser.php',
32
			'Cookie' => CORE_LIBRARY_PATH . 'Cookie.php',
33
			'Email' => CORE_LIBRARY_PATH . 'Email.php',
34
			'Form' => CORE_LIBRARY_PATH . 'Form.php',
35
			'FormValidation' => CORE_LIBRARY_PATH . 'FormValidation.php',
36
			'Html' => CORE_LIBRARY_PATH . 'Html.php',
37
			'Pagination' => CORE_LIBRARY_PATH . 'Pagination.php',
38
			'PDF' => CORE_LIBRARY_PATH . 'PDF.php',
39
			'StringHash' => CORE_LIBRARY_PATH . 'StringHash.php',
40
			'Upload' => CORE_LIBRARY_PATH . 'Upload.php',
41
		);
42
		if(isset($classesMap[$class])){
43
			if(file_exists($classesMap[$class])){
44
				include_once $classesMap[$class];
45
			}
46
			else{
47
				echo 'File for class ' . $class . ' not found';
48
			}
49
		}
50
	}
51
	
52
	spl_autoload_register('test_autoload');