Completed
Branch BUG-10626-dst-unit-test (8c5dd4)
by
unknown
138:48 queued 126:51
created

EE_Psr4AutoloaderInit::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 2
nop 0
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
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
		static $initialized = false;
27
		if ( ! $initialized ) {
28
			// instantiate PSR4 autoloader
29
			espresso_load_required( 'Psr4Autoloader', EE_CORE . 'Psr4Autoloader.php' );
30
			EE_Psr4AutoloaderInit::$psr4_loader = new \EventEspresso\core\Psr4Autoloader();
31
			// register the autoloader
32
			EE_Psr4AutoloaderInit::$psr4_loader->register();
33
			// register the base directories for the namespace prefix
34
			EE_Psr4AutoloaderInit::$psr4_loader->addNamespace( 'EventEspresso', EE_PLUGIN_DIR_PATH );
35
			EE_Psr4AutoloaderInit::$psr4_loader->addNamespace( 'EventEspressoBatchRequest', EE_LIBRARIES . 'batch' );
36
			$initialized = true;
37
		}
38
	}
39
40
41
42
	/**
43
	 * @return \EventEspresso\core\Psr4Autoloader
44
	 */
45
	public static function psr4_loader() {
46
		return self::$psr4_loader;
47
	}
48
49
50
51
}
52
// End of file EE_Psr4AutoloaderInit.core.php
53
// Location: /core/EE_Psr4AutoloaderInit.core.php