Completed
Branch FET-9795-new-interfaces (ef7df2)
by
unknown
1145:32 queued 1126:00
created

EE_Psr4AutoloaderInit   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 47
rs 10
wmc 4
lcom 1
cbo 1

3 Methods

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