Completed
Branch BUG-10738-inconsistency-in-ses... (a1eed8)
by
unknown
24:27 queued 12:29
created

EE_Psr4AutoloaderInit   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initializeAutoloader() 0 14 2
A psr4_loader() 0 3 1
1
<?php
2
use EventEspresso\core\Psr4Autoloader;
3
4
defined('EVENT_ESPRESSO_VERSION') || exit;
5
6
7
8
/**
9
 * Class EE_Psr4AutoloaderInit
10
 *
11
 * Loads the Psr4Autoloader class and registers namespaces
12
 *
13
 * @package 			Event Espresso
14
 * @subpackage 	core
15
 * @author 				Brent Christensen
16
 * @since 				4.8
17
 *
18
 */
19
20
class EE_Psr4AutoloaderInit {
21
22
23
	/**
24
	 * @type \EventEspresso\core\Psr4Autoloader
25
	 */
26
	protected static $psr4_loader;
27
28
29
30
	/**
31
	 * @return \EventEspresso\core\Psr4Autoloader
32
	 */
33
	public function initializeAutoloader() {
34
        static $initialized = false;
35
        if ( ! $initialized) {
36
            // instantiate PSR4 autoloader
37
			espresso_load_required( 'Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php' );
38
            EE_Psr4AutoloaderInit::$psr4_loader = new Psr4Autoloader();
39
            // register the autoloader
40
            EE_Psr4AutoloaderInit::$psr4_loader->register();
41
            // register the base directories for the namespace prefix
42
            EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspresso', EE_PLUGIN_DIR_PATH);
43
            EE_Psr4AutoloaderInit::$psr4_loader->addNamespace('EventEspressoBatchRequest', EE_LIBRARIES . 'batch');
44
            $initialized = true;
45
        }
46
    }
47
48
49
50
	/**
51
	 * @return \EventEspresso\core\Psr4Autoloader
52
	 */
53
	public static function psr4_loader() {
54
		return self::$psr4_loader;
55
	}
56
57
58
59
}
60
// End of file EE_Psr4AutoloaderInit.core.php
61
// Location: /core/EE_Psr4AutoloaderInit.core.php