Completed
Branch BUG-9054-ee-config (5f56da)
by
unknown
255:53 queued 241:21
created

EE_Psr4AutoloaderInit::psr4_loader()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 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
			$initialized = true;
36
		}
37
	}
38
39
40
41
	/**
42
	 * @return \EventEspresso\Core\Psr4Autoloader
43
	 */
44
	public static function psr4_loader() {
45
		return self::$psr4_loader;
46
	}
47
48
49
50
}
51
// End of file EE_Psr4AutoloaderInit.core.php
52
// Location: /core/EE_Psr4AutoloaderInit.core.php