Completed
Branch jed-i18n-for-js (f5884a)
by
unknown
25:34 queued 16:38
created
core/domain/services/assets/CoreAssetManager.php 3 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -6,9 +6,6 @@
 block discarded – undo
6 6
 use EE_Currency_Config;
7 7
 use EE_Registry;
8 8
 use EE_Template_Config;
9
-use EED_Core_Rest_Api;
10
-use EEH_DTT_Helper;
11
-use EventEspresso\core\domain\Domain;
12 9
 use EventEspresso\core\domain\DomainInterface;
13 10
 use EventEspresso\core\domain\values\assets\JavascriptAsset;
14 11
 use EventEspresso\core\exceptions\InvalidDataTypeException;
Please login to merge, or discard this patch.
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -31,156 +31,156 @@
 block discarded – undo
31 31
 class CoreAssetManager extends AssetManager
32 32
 {
33 33
 
34
-    // WordPress core / Third party JS asset handles
35
-    const JS_HANDLE_JS_CORE = 'eejs-core';
36
-
37
-    const JS_HANDLE_CORE    = 'espresso_core';
38
-
39
-    const JS_HANDLE_I18N    = 'eei18n';
40
-
41
-    const JS_HANDLE_VENDOR  = 'eventespresso-vendor';
42
-
43
-    // EE CSS assets handles
44
-    const CSS_HANDLE_DEFAULT = 'espresso_default';
45
-
46
-    const CSS_HANDLE_CUSTOM  = 'espresso_custom_css';
47
-
48
-    /**
49
-     * @var EE_Currency_Config $currency_config
50
-     */
51
-    protected $currency_config;
52
-
53
-    /**
54
-     * @var EE_Template_Config $template_config
55
-     */
56
-    protected $template_config;
57
-
58
-
59
-    /**
60
-     * CoreAssetRegister constructor.
61
-     *
62
-     * @param AssetCollection    $assets
63
-     * @param EE_Currency_Config $currency_config
64
-     * @param EE_Template_Config $template_config
65
-     * @param DomainInterface    $domain
66
-     * @param Registry           $registry
67
-     */
68
-    public function __construct(
69
-        AssetCollection $assets,
70
-        EE_Currency_Config $currency_config,
71
-        EE_Template_Config $template_config,
72
-        DomainInterface $domain,
73
-        Registry $registry
74
-    ) {
75
-        $this->currency_config = $currency_config;
76
-        $this->template_config = $template_config;
77
-        parent::__construct($domain, $assets, $registry);
78
-    }
79
-
80
-
81
-    /**
82
-     * @throws DomainException
83
-     * @throws DuplicateCollectionIdentifierException
84
-     * @throws InvalidArgumentException
85
-     * @throws InvalidDataTypeException
86
-     * @throws InvalidEntityException
87
-     * @throws InvalidInterfaceException
88
-     * @since 4.9.62.p
89
-     */
90
-    public function addAssets()
91
-    {
92
-        $this->addJavascriptFiles();
93
-        $this->addStylesheetFiles();
94
-    }
95
-
96
-
97
-    /**
98
-     * @throws DomainException
99
-     * @throws DuplicateCollectionIdentifierException
100
-     * @throws InvalidArgumentException
101
-     * @throws InvalidDataTypeException
102
-     * @throws InvalidEntityException
103
-     * @throws InvalidInterfaceException
104
-     * @since 4.9.62.p
105
-     */
106
-    public function addJavascriptFiles()
107
-    {
108
-        $this->addJs(CoreAssetManager::JS_HANDLE_VENDOR);
109
-        $this->addJs(CoreAssetManager::JS_HANDLE_JS_CORE)->setHasInlineData();
110
-        $this->addJavascript(
111
-            CoreAssetManager::JS_HANDLE_CORE,
112
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
113
-            [JqueryAssetManager::JS_HANDLE_JQUERY]
114
-        )->setInlineDataCallback(
115
-            function() {
116
-                wp_localize_script(
117
-                    CoreAssetManager::JS_HANDLE_CORE,
118
-                    CoreAssetManager::JS_HANDLE_I18N,
119
-                    EE_Registry::$i18n_js_strings
120
-                );
121
-            }
122
-        );
123
-    }
124
-
125
-
126
-    /**
127
-     * @throws DuplicateCollectionIdentifierException
128
-     * @throws InvalidDataTypeException
129
-     * @throws InvalidEntityException
130
-     * @throws DomainException
131
-     * @since 4.9.62.p
132
-     */
133
-    public function addStylesheetFiles()
134
-    {
135
-        if ($this->template_config->enable_default_style && ! is_admin()) {
136
-            $this->addStylesheet(
137
-                CoreAssetManager::CSS_HANDLE_DEFAULT,
138
-                is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css')
139
-                    ? EVENT_ESPRESSO_UPLOAD_URL . 'css/espresso_default.css'
140
-                    : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
141
-                ['dashicons']
142
-            );
143
-            //Load custom style sheet if available
144
-            if ($this->template_config->custom_style_sheet !== null) {
145
-                $this->addStylesheet(
146
-                    CoreAssetManager::CSS_HANDLE_CUSTOM,
147
-                    EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
148
-                    [CoreAssetManager::CSS_HANDLE_DEFAULT]
149
-                );
150
-            }
151
-        }
152
-    }
153
-
154
-
155
-    /**
156
-     * Returns configuration data for the js Currency VO.
157
-     *
158
-     * @return array
159
-     * @since 4.9.71.p
160
-     */
161
-    private function getCurrencySettings()
162
-    {
163
-        return [
164
-            'code'               => $this->currency_config->code,
165
-            'singularLabel'      => $this->currency_config->name,
166
-            'pluralLabel'        => $this->currency_config->plural,
167
-            'sign'               => $this->currency_config->sign,
168
-            'signB4'             => $this->currency_config->sign_b4,
169
-            'decimalPlaces'      => $this->currency_config->dec_plc,
170
-            'decimalMark'        => $this->currency_config->dec_mrk,
171
-            'thousandsSeparator' => $this->currency_config->thsnds,
172
-        ];
173
-    }
174
-
175
-
176
-    /**
177
-     * replacement:
178
-     * EventEspresso\core\domain\services\assets\EspressoLegacyAdminAssetManager::loadQtipJs()
179
-     *
180
-     * @param JavascriptAsset $script
181
-     * @deprecated $VID:$
182
-     */
183
-    public function loadQtipJs(JavascriptAsset $script)
184
-    {
185
-    }
34
+	// WordPress core / Third party JS asset handles
35
+	const JS_HANDLE_JS_CORE = 'eejs-core';
36
+
37
+	const JS_HANDLE_CORE    = 'espresso_core';
38
+
39
+	const JS_HANDLE_I18N    = 'eei18n';
40
+
41
+	const JS_HANDLE_VENDOR  = 'eventespresso-vendor';
42
+
43
+	// EE CSS assets handles
44
+	const CSS_HANDLE_DEFAULT = 'espresso_default';
45
+
46
+	const CSS_HANDLE_CUSTOM  = 'espresso_custom_css';
47
+
48
+	/**
49
+	 * @var EE_Currency_Config $currency_config
50
+	 */
51
+	protected $currency_config;
52
+
53
+	/**
54
+	 * @var EE_Template_Config $template_config
55
+	 */
56
+	protected $template_config;
57
+
58
+
59
+	/**
60
+	 * CoreAssetRegister constructor.
61
+	 *
62
+	 * @param AssetCollection    $assets
63
+	 * @param EE_Currency_Config $currency_config
64
+	 * @param EE_Template_Config $template_config
65
+	 * @param DomainInterface    $domain
66
+	 * @param Registry           $registry
67
+	 */
68
+	public function __construct(
69
+		AssetCollection $assets,
70
+		EE_Currency_Config $currency_config,
71
+		EE_Template_Config $template_config,
72
+		DomainInterface $domain,
73
+		Registry $registry
74
+	) {
75
+		$this->currency_config = $currency_config;
76
+		$this->template_config = $template_config;
77
+		parent::__construct($domain, $assets, $registry);
78
+	}
79
+
80
+
81
+	/**
82
+	 * @throws DomainException
83
+	 * @throws DuplicateCollectionIdentifierException
84
+	 * @throws InvalidArgumentException
85
+	 * @throws InvalidDataTypeException
86
+	 * @throws InvalidEntityException
87
+	 * @throws InvalidInterfaceException
88
+	 * @since 4.9.62.p
89
+	 */
90
+	public function addAssets()
91
+	{
92
+		$this->addJavascriptFiles();
93
+		$this->addStylesheetFiles();
94
+	}
95
+
96
+
97
+	/**
98
+	 * @throws DomainException
99
+	 * @throws DuplicateCollectionIdentifierException
100
+	 * @throws InvalidArgumentException
101
+	 * @throws InvalidDataTypeException
102
+	 * @throws InvalidEntityException
103
+	 * @throws InvalidInterfaceException
104
+	 * @since 4.9.62.p
105
+	 */
106
+	public function addJavascriptFiles()
107
+	{
108
+		$this->addJs(CoreAssetManager::JS_HANDLE_VENDOR);
109
+		$this->addJs(CoreAssetManager::JS_HANDLE_JS_CORE)->setHasInlineData();
110
+		$this->addJavascript(
111
+			CoreAssetManager::JS_HANDLE_CORE,
112
+			EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
113
+			[JqueryAssetManager::JS_HANDLE_JQUERY]
114
+		)->setInlineDataCallback(
115
+			function() {
116
+				wp_localize_script(
117
+					CoreAssetManager::JS_HANDLE_CORE,
118
+					CoreAssetManager::JS_HANDLE_I18N,
119
+					EE_Registry::$i18n_js_strings
120
+				);
121
+			}
122
+		);
123
+	}
124
+
125
+
126
+	/**
127
+	 * @throws DuplicateCollectionIdentifierException
128
+	 * @throws InvalidDataTypeException
129
+	 * @throws InvalidEntityException
130
+	 * @throws DomainException
131
+	 * @since 4.9.62.p
132
+	 */
133
+	public function addStylesheetFiles()
134
+	{
135
+		if ($this->template_config->enable_default_style && ! is_admin()) {
136
+			$this->addStylesheet(
137
+				CoreAssetManager::CSS_HANDLE_DEFAULT,
138
+				is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css')
139
+					? EVENT_ESPRESSO_UPLOAD_URL . 'css/espresso_default.css'
140
+					: EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
141
+				['dashicons']
142
+			);
143
+			//Load custom style sheet if available
144
+			if ($this->template_config->custom_style_sheet !== null) {
145
+				$this->addStylesheet(
146
+					CoreAssetManager::CSS_HANDLE_CUSTOM,
147
+					EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
148
+					[CoreAssetManager::CSS_HANDLE_DEFAULT]
149
+				);
150
+			}
151
+		}
152
+	}
153
+
154
+
155
+	/**
156
+	 * Returns configuration data for the js Currency VO.
157
+	 *
158
+	 * @return array
159
+	 * @since 4.9.71.p
160
+	 */
161
+	private function getCurrencySettings()
162
+	{
163
+		return [
164
+			'code'               => $this->currency_config->code,
165
+			'singularLabel'      => $this->currency_config->name,
166
+			'pluralLabel'        => $this->currency_config->plural,
167
+			'sign'               => $this->currency_config->sign,
168
+			'signB4'             => $this->currency_config->sign_b4,
169
+			'decimalPlaces'      => $this->currency_config->dec_plc,
170
+			'decimalMark'        => $this->currency_config->dec_mrk,
171
+			'thousandsSeparator' => $this->currency_config->thsnds,
172
+		];
173
+	}
174
+
175
+
176
+	/**
177
+	 * replacement:
178
+	 * EventEspresso\core\domain\services\assets\EspressoLegacyAdminAssetManager::loadQtipJs()
179
+	 *
180
+	 * @param JavascriptAsset $script
181
+	 * @deprecated $VID:$
182
+	 */
183
+	public function loadQtipJs(JavascriptAsset $script)
184
+	{
185
+	}
186 186
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         $this->addJs(CoreAssetManager::JS_HANDLE_JS_CORE)->setHasInlineData();
110 110
         $this->addJavascript(
111 111
             CoreAssetManager::JS_HANDLE_CORE,
112
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
112
+            EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js',
113 113
             [JqueryAssetManager::JS_HANDLE_JQUERY]
114 114
         )->setInlineDataCallback(
115 115
             function() {
@@ -135,16 +135,16 @@  discard block
 block discarded – undo
135 135
         if ($this->template_config->enable_default_style && ! is_admin()) {
136 136
             $this->addStylesheet(
137 137
                 CoreAssetManager::CSS_HANDLE_DEFAULT,
138
-                is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css')
138
+                is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css')
139 139
                     ? EVENT_ESPRESSO_UPLOAD_URL . 'css/espresso_default.css'
140
-                    : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
140
+                    : EE_GLOBAL_ASSETS_URL.'css/espresso_default.css',
141 141
                 ['dashicons']
142 142
             );
143 143
             //Load custom style sheet if available
144 144
             if ($this->template_config->custom_style_sheet !== null) {
145 145
                 $this->addStylesheet(
146 146
                     CoreAssetManager::CSS_HANDLE_CUSTOM,
147
-                    EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
147
+                    EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->template_config->custom_style_sheet,
148 148
                     [CoreAssetManager::CSS_HANDLE_DEFAULT]
149 149
                 );
150 150
             }
Please login to merge, or discard this patch.
core/services/json/JsonDataNodeHandler.php 2 patches
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -18,132 +18,132 @@
 block discarded – undo
18 18
 class JsonDataNodeHandler
19 19
 {
20 20
 
21
-    /**
22
-     * @var PrimaryJsonDataNode $primary_data_node
23
-     */
24
-    private $primary_data_node;
25
-
26
-    /**
27
-     * @var JsonDataNodeValidator $validator
28
-     */
29
-    private $validator;
30
-
31
-
32
-    /**
33
-     * @param JsonDataNodeValidator $validator
34
-     */
35
-    public function __construct(JsonDataNodeValidator $validator)
36
-    {
37
-        $this->validator = $validator;
38
-    }
39
-
40
-
41
-    /**
42
-     * @param JsonDataNode $data_node
43
-     * @throws DomainException
44
-     */
45
-    public function addDataNode(JsonDataNode $data_node)
46
-    {
47
-        if ($data_node->isNotInitialized()) {
48
-            $this->validatePrimaryDataNode($data_node);
49
-            $this->primary_data_node->addDataNode($data_node);
50
-        }
51
-    }
52
-
53
-
54
-    /**
55
-     * @param PrimaryJsonDataNode $primary_data_node
56
-     */
57
-    public function setPrimaryDataNode(PrimaryJsonDataNode $primary_data_node)
58
-    {
59
-        $this->primary_data_node = $primary_data_node;
60
-    }
61
-
62
-
63
-    /**
64
-     * @param JsonDataNode $data_node
65
-     * @param int                $depth
66
-     * @return mixed
67
-     * @since $VID:$
68
-     */
69
-    private function initializeDataNodes(JsonDataNode $data_node, $depth = 0)
70
-    {
71
-        $depth++;
72
-        $data = [];
73
-        // initialize the data node if not done already
74
-        if ($data_node->isNotInitialized()) {
75
-            $data_node->initialize();
76
-            // grab the data node's data array
77
-            $data_node_data = $data_node->data();
78
-            foreach ($data_node_data as $child_node_name => $child_node) {
79
-                // don't parse node if it's the primary, OR if depth has exceeded wp_json_encode() limit
80
-                if ($child_node instanceof PrimaryJsonDataNode || $depth > 512) {
81
-                    continue;
82
-                }
83
-                if ($child_node instanceof JsonDataNode) {
84
-                    // feed data node back into this function
85
-                    $data[ $child_node_name ] = $this->initializeDataNodes($child_node, $depth);
86
-                } else {
87
-                    // or assign data directly
88
-                    $data[ $child_node_name ] = $child_node;
89
-                }
90
-            }
91
-        }
92
-        return $data;
93
-    }
94
-
95
-
96
-    /**
97
-     * @throws DomainException
98
-     * @since $VID:$
99
-     */
100
-    public function printDataNode()
101
-    {
102
-        if (!$this->primary_data_node instanceof PrimaryJsonDataNode) {
103
-            return;
104
-        }
105
-        // validate that the domain, node name, and target script are set
106
-        $domain = $this->primary_data_node->domain();
107
-        $node_name = $this->primary_data_node->nodeName();
108
-        $data_valid =  $this->validator->validateCriticalProperty($domain, 'domain route', false)
109
-                       && $this->validator->validateCriticalProperty($node_name, 'node name', false);
110
-        if (! $data_valid) {
111
-            return;
112
-        }
113
-        // initialize and parse data from primary data node
114
-        $data = $this->initializeDataNodes($this->primary_data_node);
115
-        // this prepends the current domain "use case" to the front of the array
116
-        $data = ['domain' => $domain] + $data;
117
-        // add legacy i18n strings
118
-        $data['eei18n'] = EE_Registry::$i18n_js_strings;
119
-        // and finally, print the JSON encoded data to the DOM
120
-        printf(
121
-            "<script type='text/javascript' id='%s'>\nvar %s = %s\n</script>\n",
122
-            $node_name,
123
-            $node_name,
124
-            json_encode($data)
125
-        );
126
-    }
127
-
128
-
129
-    /**
130
-     * @param JsonDataNode $data_node
131
-     * @throws DomainException
132
-     */
133
-    private function validatePrimaryDataNode(JsonDataNode $data_node)
134
-    {
135
-        // set primary data node if that's what the incoming node is
136
-        if ($data_node instanceof PrimaryJsonDataNode) {
137
-            $this->setPrimaryDataNode($data_node);
138
-        }
139
-        // and don't allow other nodes to be set until a primary is set
140
-        if (! $this->primary_data_node instanceof PrimaryJsonDataNode) {
141
-            throw new DomainException(
142
-                esc_html__(
143
-                    'A PrimaryJsonDataNode needs to be set before data nodes can be added.',
144
-                    'event_espresso'
145
-                )
146
-            );
147
-        }
148
-    }
21
+	/**
22
+	 * @var PrimaryJsonDataNode $primary_data_node
23
+	 */
24
+	private $primary_data_node;
25
+
26
+	/**
27
+	 * @var JsonDataNodeValidator $validator
28
+	 */
29
+	private $validator;
30
+
31
+
32
+	/**
33
+	 * @param JsonDataNodeValidator $validator
34
+	 */
35
+	public function __construct(JsonDataNodeValidator $validator)
36
+	{
37
+		$this->validator = $validator;
38
+	}
39
+
40
+
41
+	/**
42
+	 * @param JsonDataNode $data_node
43
+	 * @throws DomainException
44
+	 */
45
+	public function addDataNode(JsonDataNode $data_node)
46
+	{
47
+		if ($data_node->isNotInitialized()) {
48
+			$this->validatePrimaryDataNode($data_node);
49
+			$this->primary_data_node->addDataNode($data_node);
50
+		}
51
+	}
52
+
53
+
54
+	/**
55
+	 * @param PrimaryJsonDataNode $primary_data_node
56
+	 */
57
+	public function setPrimaryDataNode(PrimaryJsonDataNode $primary_data_node)
58
+	{
59
+		$this->primary_data_node = $primary_data_node;
60
+	}
61
+
62
+
63
+	/**
64
+	 * @param JsonDataNode $data_node
65
+	 * @param int                $depth
66
+	 * @return mixed
67
+	 * @since $VID:$
68
+	 */
69
+	private function initializeDataNodes(JsonDataNode $data_node, $depth = 0)
70
+	{
71
+		$depth++;
72
+		$data = [];
73
+		// initialize the data node if not done already
74
+		if ($data_node->isNotInitialized()) {
75
+			$data_node->initialize();
76
+			// grab the data node's data array
77
+			$data_node_data = $data_node->data();
78
+			foreach ($data_node_data as $child_node_name => $child_node) {
79
+				// don't parse node if it's the primary, OR if depth has exceeded wp_json_encode() limit
80
+				if ($child_node instanceof PrimaryJsonDataNode || $depth > 512) {
81
+					continue;
82
+				}
83
+				if ($child_node instanceof JsonDataNode) {
84
+					// feed data node back into this function
85
+					$data[ $child_node_name ] = $this->initializeDataNodes($child_node, $depth);
86
+				} else {
87
+					// or assign data directly
88
+					$data[ $child_node_name ] = $child_node;
89
+				}
90
+			}
91
+		}
92
+		return $data;
93
+	}
94
+
95
+
96
+	/**
97
+	 * @throws DomainException
98
+	 * @since $VID:$
99
+	 */
100
+	public function printDataNode()
101
+	{
102
+		if (!$this->primary_data_node instanceof PrimaryJsonDataNode) {
103
+			return;
104
+		}
105
+		// validate that the domain, node name, and target script are set
106
+		$domain = $this->primary_data_node->domain();
107
+		$node_name = $this->primary_data_node->nodeName();
108
+		$data_valid =  $this->validator->validateCriticalProperty($domain, 'domain route', false)
109
+					   && $this->validator->validateCriticalProperty($node_name, 'node name', false);
110
+		if (! $data_valid) {
111
+			return;
112
+		}
113
+		// initialize and parse data from primary data node
114
+		$data = $this->initializeDataNodes($this->primary_data_node);
115
+		// this prepends the current domain "use case" to the front of the array
116
+		$data = ['domain' => $domain] + $data;
117
+		// add legacy i18n strings
118
+		$data['eei18n'] = EE_Registry::$i18n_js_strings;
119
+		// and finally, print the JSON encoded data to the DOM
120
+		printf(
121
+			"<script type='text/javascript' id='%s'>\nvar %s = %s\n</script>\n",
122
+			$node_name,
123
+			$node_name,
124
+			json_encode($data)
125
+		);
126
+	}
127
+
128
+
129
+	/**
130
+	 * @param JsonDataNode $data_node
131
+	 * @throws DomainException
132
+	 */
133
+	private function validatePrimaryDataNode(JsonDataNode $data_node)
134
+	{
135
+		// set primary data node if that's what the incoming node is
136
+		if ($data_node instanceof PrimaryJsonDataNode) {
137
+			$this->setPrimaryDataNode($data_node);
138
+		}
139
+		// and don't allow other nodes to be set until a primary is set
140
+		if (! $this->primary_data_node instanceof PrimaryJsonDataNode) {
141
+			throw new DomainException(
142
+				esc_html__(
143
+					'A PrimaryJsonDataNode needs to be set before data nodes can be added.',
144
+					'event_espresso'
145
+				)
146
+			);
147
+		}
148
+	}
149 149
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
                 }
83 83
                 if ($child_node instanceof JsonDataNode) {
84 84
                     // feed data node back into this function
85
-                    $data[ $child_node_name ] = $this->initializeDataNodes($child_node, $depth);
85
+                    $data[$child_node_name] = $this->initializeDataNodes($child_node, $depth);
86 86
                 } else {
87 87
                     // or assign data directly
88
-                    $data[ $child_node_name ] = $child_node;
88
+                    $data[$child_node_name] = $child_node;
89 89
                 }
90 90
             }
91 91
         }
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function printDataNode()
101 101
     {
102
-        if (!$this->primary_data_node instanceof PrimaryJsonDataNode) {
102
+        if ( ! $this->primary_data_node instanceof PrimaryJsonDataNode) {
103 103
             return;
104 104
         }
105 105
         // validate that the domain, node name, and target script are set
106 106
         $domain = $this->primary_data_node->domain();
107 107
         $node_name = $this->primary_data_node->nodeName();
108
-        $data_valid =  $this->validator->validateCriticalProperty($domain, 'domain route', false)
108
+        $data_valid = $this->validator->validateCriticalProperty($domain, 'domain route', false)
109 109
                        && $this->validator->validateCriticalProperty($node_name, 'node name', false);
110
-        if (! $data_valid) {
110
+        if ( ! $data_valid) {
111 111
             return;
112 112
         }
113 113
         // initialize and parse data from primary data node
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             $this->setPrimaryDataNode($data_node);
138 138
         }
139 139
         // and don't allow other nodes to be set until a primary is set
140
-        if (! $this->primary_data_node instanceof PrimaryJsonDataNode) {
140
+        if ( ! $this->primary_data_node instanceof PrimaryJsonDataNode) {
141 141
             throw new DomainException(
142 142
                 esc_html__(
143 143
                     'A PrimaryJsonDataNode needs to be set before data nodes can be added.',
Please login to merge, or discard this patch.
core/services/routing/RouteHandler.php 1 patch
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -20,162 +20,162 @@
 block discarded – undo
20 20
 class RouteHandler
21 21
 {
22 22
 
23
-    /**
24
-     * @var JsonDataNodeHandler $data_node_handler
25
-     */
26
-    private $data_node_handler;
27
-
28
-    /**
29
-     * @var LoaderInterface $loader
30
-     */
31
-    private $loader;
32
-
33
-    /**
34
-     * @var RequestInterface $request
35
-     */
36
-    protected $request;
37
-
38
-    /**
39
-     * @var RouteCollection $routes
40
-     */
41
-    private $routes;
42
-
43
-    /**
44
-     * @var boolean $print_data_nodes
45
-     */
46
-    private $print_data_nodes = true;
47
-
48
-    /**
49
-     * @var string $route_request_type
50
-     */
51
-    protected $route_request_type;
52
-
53
-
54
-    /**
55
-     * RouteHandler constructor.
56
-     *
57
-     * @param JsonDataNodeHandler $data_node_handler
58
-     * @param LoaderInterface     $loader
59
-     * @param RequestInterface    $request
60
-     * @param RouteCollection     $routes
61
-     */
62
-    public function __construct(
63
-        JsonDataNodeHandler $data_node_handler,
64
-        LoaderInterface $loader,
65
-        RequestInterface $request,
66
-        RouteCollection $routes
67
-    ) {
68
-        $this->data_node_handler = $data_node_handler;
69
-        $this->loader            = $loader;
70
-        $this->request           = $request;
71
-        $this->routes            = $routes;
72
-    }
73
-
74
-
75
-    /**
76
-     * @param string $fqcn   Fully Qualified Class Name for Route
77
-     * @param bool   $handle if true [default] will immediately call RouteInterface::handleRequest() after adding
78
-     * @throws Exception
79
-     * @since $VID:$
80
-     */
81
-    public function addRoute($fqcn, $handle = true)
82
-    {
83
-        try {
84
-            $route = $this->loader->getShared($fqcn);
85
-            $this->validateRoute($route, $fqcn);
86
-            $this->routes->add($route);
87
-            $this->handle($route, $handle);
88
-        } catch (Exception $exception) {
89
-            new ExceptionStackTraceDisplay($exception);
90
-        }
91
-    }
92
-
93
-
94
-    /**
95
-     * @return string
96
-     */
97
-    public function getRouteRequestType()
98
-    {
99
-        return $this->route_request_type;
100
-    }
101
-
102
-
103
-    /**
104
-     * @param string $route_request_type
105
-     */
106
-    public function setRouteRequestType($route_request_type)
107
-    {
108
-        $this->route_request_type = $route_request_type !== null ? $route_request_type : $this->route_request_type;
109
-    }
110
-
111
-
112
-    /**
113
-     * @param RouteInterface $route
114
-     * @param bool           $handle if true [default] will immediately call RouteInterface::handleRequest()
115
-     */
116
-    public function handle(RouteInterface $route, $handle = true)
117
-    {
118
-        if ($handle && $route->isNotHandled()) {
119
-            $route->handleRequest();
120
-            if ($route instanceof PrimaryRoute) {
121
-                $this->setRouteRequestType($route->getRouteRequestType());
122
-            }
123
-            $data_node = $route->dataNode();
124
-            if ($data_node instanceof JsonDataNode) {
125
-                $this->data_node_handler->addDataNode($data_node);
126
-                $this->printDataNodes();
127
-            }
128
-        }
129
-    }
130
-
131
-
132
-    /**
133
-     * calls RouteInterface::handleRequest() on all Routes that
134
-     *      - match current request
135
-     *      - have yet to be handled
136
-     *
137
-     * @return void
138
-     */
139
-    public function handleRoutesForCurrentRequest()
140
-    {
141
-        $this->routes->handleRoutesForCurrentRequest();
142
-    }
143
-
144
-
145
-    /**
146
-     * @since $VID:$
147
-     */
148
-    private function printDataNodes()
149
-    {
150
-        if ($this->print_data_nodes) {
151
-            add_action('admin_footer', [$this->data_node_handler, 'printDataNode'], 0);
152
-            add_action('wp_footer', [$this->data_node_handler, 'printDataNode'], 0);
153
-            $this->print_data_nodes = false;
154
-        }
155
-    }
156
-
157
-
158
-    /**
159
-     * @param RouteInterface $route
160
-     * @param string         $fqcn
161
-     * @since $VID:$
162
-     */
163
-    private function validateRoute($route, $fqcn)
164
-    {
165
-        if (! $route instanceof RouteInterface) {
166
-            throw new InvalidClassException(
167
-                sprintf(
168
-                    /*
23
+	/**
24
+	 * @var JsonDataNodeHandler $data_node_handler
25
+	 */
26
+	private $data_node_handler;
27
+
28
+	/**
29
+	 * @var LoaderInterface $loader
30
+	 */
31
+	private $loader;
32
+
33
+	/**
34
+	 * @var RequestInterface $request
35
+	 */
36
+	protected $request;
37
+
38
+	/**
39
+	 * @var RouteCollection $routes
40
+	 */
41
+	private $routes;
42
+
43
+	/**
44
+	 * @var boolean $print_data_nodes
45
+	 */
46
+	private $print_data_nodes = true;
47
+
48
+	/**
49
+	 * @var string $route_request_type
50
+	 */
51
+	protected $route_request_type;
52
+
53
+
54
+	/**
55
+	 * RouteHandler constructor.
56
+	 *
57
+	 * @param JsonDataNodeHandler $data_node_handler
58
+	 * @param LoaderInterface     $loader
59
+	 * @param RequestInterface    $request
60
+	 * @param RouteCollection     $routes
61
+	 */
62
+	public function __construct(
63
+		JsonDataNodeHandler $data_node_handler,
64
+		LoaderInterface $loader,
65
+		RequestInterface $request,
66
+		RouteCollection $routes
67
+	) {
68
+		$this->data_node_handler = $data_node_handler;
69
+		$this->loader            = $loader;
70
+		$this->request           = $request;
71
+		$this->routes            = $routes;
72
+	}
73
+
74
+
75
+	/**
76
+	 * @param string $fqcn   Fully Qualified Class Name for Route
77
+	 * @param bool   $handle if true [default] will immediately call RouteInterface::handleRequest() after adding
78
+	 * @throws Exception
79
+	 * @since $VID:$
80
+	 */
81
+	public function addRoute($fqcn, $handle = true)
82
+	{
83
+		try {
84
+			$route = $this->loader->getShared($fqcn);
85
+			$this->validateRoute($route, $fqcn);
86
+			$this->routes->add($route);
87
+			$this->handle($route, $handle);
88
+		} catch (Exception $exception) {
89
+			new ExceptionStackTraceDisplay($exception);
90
+		}
91
+	}
92
+
93
+
94
+	/**
95
+	 * @return string
96
+	 */
97
+	public function getRouteRequestType()
98
+	{
99
+		return $this->route_request_type;
100
+	}
101
+
102
+
103
+	/**
104
+	 * @param string $route_request_type
105
+	 */
106
+	public function setRouteRequestType($route_request_type)
107
+	{
108
+		$this->route_request_type = $route_request_type !== null ? $route_request_type : $this->route_request_type;
109
+	}
110
+
111
+
112
+	/**
113
+	 * @param RouteInterface $route
114
+	 * @param bool           $handle if true [default] will immediately call RouteInterface::handleRequest()
115
+	 */
116
+	public function handle(RouteInterface $route, $handle = true)
117
+	{
118
+		if ($handle && $route->isNotHandled()) {
119
+			$route->handleRequest();
120
+			if ($route instanceof PrimaryRoute) {
121
+				$this->setRouteRequestType($route->getRouteRequestType());
122
+			}
123
+			$data_node = $route->dataNode();
124
+			if ($data_node instanceof JsonDataNode) {
125
+				$this->data_node_handler->addDataNode($data_node);
126
+				$this->printDataNodes();
127
+			}
128
+		}
129
+	}
130
+
131
+
132
+	/**
133
+	 * calls RouteInterface::handleRequest() on all Routes that
134
+	 *      - match current request
135
+	 *      - have yet to be handled
136
+	 *
137
+	 * @return void
138
+	 */
139
+	public function handleRoutesForCurrentRequest()
140
+	{
141
+		$this->routes->handleRoutesForCurrentRequest();
142
+	}
143
+
144
+
145
+	/**
146
+	 * @since $VID:$
147
+	 */
148
+	private function printDataNodes()
149
+	{
150
+		if ($this->print_data_nodes) {
151
+			add_action('admin_footer', [$this->data_node_handler, 'printDataNode'], 0);
152
+			add_action('wp_footer', [$this->data_node_handler, 'printDataNode'], 0);
153
+			$this->print_data_nodes = false;
154
+		}
155
+	}
156
+
157
+
158
+	/**
159
+	 * @param RouteInterface $route
160
+	 * @param string         $fqcn
161
+	 * @since $VID:$
162
+	 */
163
+	private function validateRoute($route, $fqcn)
164
+	{
165
+		if (! $route instanceof RouteInterface) {
166
+			throw new InvalidClassException(
167
+				sprintf(
168
+					/*
169 169
                      * translators:
170 170
                      * The supplied FQCN (Fully\Qualified\Class\Name) must be an instance of RouteInterface.
171 171
                      */
172
-                    esc_html__(
173
-                        'The supplied FQCN (%1$s) must be an instance of RouteInterface.',
174
-                        'event_espresso'
175
-                    ),
176
-                    $fqcn
177
-                )
178
-            );
179
-        }
180
-    }
172
+					esc_html__(
173
+						'The supplied FQCN (%1$s) must be an instance of RouteInterface.',
174
+						'event_espresso'
175
+					),
176
+					$fqcn
177
+				)
178
+			);
179
+		}
180
+	}
181 181
 }
Please login to merge, or discard this patch.
core/services/assets/BlockAssetManager.php 1 patch
Indentation   +248 added lines, -248 removed lines patch added patch discarded remove patch
@@ -20,253 +20,253 @@
 block discarded – undo
20 20
  */
21 21
 abstract class BlockAssetManager extends AssetManager implements BlockAssetManagerInterface
22 22
 {
23
-    /**
24
-     * @var string $editor_script_handle
25
-     */
26
-    private $editor_script_handle;
27
-
28
-    /**
29
-     * @var string $editor_style_handle
30
-     */
31
-    private $editor_style_handle;
32
-
33
-    /**
34
-     * @var string $script_handle
35
-     */
36
-    private $script_handle;
37
-
38
-    /**
39
-     * @var string $style_handle
40
-     */
41
-    private $style_handle;
42
-
43
-
44
-    /**
45
-     * @return string
46
-     */
47
-    public function getEditorScriptHandle()
48
-    {
49
-        return $this->editor_script_handle;
50
-    }
51
-
52
-
53
-    /**
54
-     * @param string $editor_script_handle
55
-     */
56
-    public function setEditorScriptHandle($editor_script_handle)
57
-    {
58
-        if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
59
-            $editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
60
-        }
61
-        $this->editor_script_handle = $editor_script_handle;
62
-    }
63
-
64
-
65
-    /**
66
-     * @return string
67
-     */
68
-    public function getEditorStyleHandle()
69
-    {
70
-        return $this->editor_style_handle;
71
-    }
72
-
73
-
74
-    /**
75
-     * @param string $editor_style_handle
76
-     */
77
-    public function setEditorStyleHandle($editor_style_handle)
78
-    {
79
-        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
80
-            $editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
81
-        }
82
-        $this->editor_style_handle = $editor_style_handle;
83
-    }
84
-
85
-
86
-    /**
87
-     * @return string
88
-     */
89
-    public function getScriptHandle()
90
-    {
91
-        return $this->script_handle;
92
-    }
93
-
94
-
95
-    /**
96
-     * @param string $script_handle
97
-     */
98
-    public function setScriptHandle($script_handle)
99
-    {
100
-        if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
101
-            $script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
102
-        }
103
-        $this->script_handle = $script_handle;
104
-    }
105
-
106
-
107
-    /**
108
-     * @return string
109
-     */
110
-    public function getStyleHandle()
111
-    {
112
-        return $this->style_handle;
113
-    }
114
-
115
-
116
-    /**
117
-     * @param string $style_handle
118
-     */
119
-    public function setStyleHandle($style_handle)
120
-    {
121
-        if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
122
-            $style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
123
-        }
124
-        $this->style_handle = $style_handle;
125
-    }
126
-
127
-    /**
128
-     * @since 4.9.71.p
129
-     * @throws InvalidDataTypeException
130
-     * @throws InvalidEntityException
131
-     * @throws DuplicateCollectionIdentifierException
132
-     */
133
-    public function addAssets()
134
-    {
135
-        $this->addEditorScript($this->getEditorScriptHandle());
136
-        // $this->addEditorStyle($this->getEditorStyleHandle());
137
-        $this->addScript($this->getScriptHandle());
138
-        // $this->addStyle($this->getStyleHandle());
139
-    }
140
-
141
-
142
-    /**
143
-     * @param       $handle
144
-     * @param array $dependencies
145
-     * @since 4.9.71.p
146
-     * @return JavascriptAsset
147
-     * @throws InvalidDataTypeException
148
-     * @throws InvalidEntityException
149
-     * @throws DuplicateCollectionIdentifierException
150
-     */
151
-    public function addEditorScript($handle, array $dependencies = array())
152
-    {
153
-        if ($this->assets->hasJavascriptAsset($handle)){
154
-            return $this->assets->getJavascriptAsset($handle);
155
-        }
156
-        $dependencies = array_merge(
157
-            $dependencies,
158
-            ['wp-blocks']
159
-        );
160
-        return $this->addJs($handle, $dependencies);
161
-    }
162
-
163
-
164
-    /**
165
-     * @param        $handle
166
-     * @param array  $dependencies
167
-     * @since 4.9.71.p
168
-     * @return StylesheetAsset
169
-     * @throws InvalidDataTypeException
170
-     * @throws InvalidEntityException
171
-     * @throws DuplicateCollectionIdentifierException
172
-     */
173
-    public function addEditorStyle($handle, array $dependencies = array())
174
-    {
175
-        if ($this->assets->hasStylesheetAsset($handle)) {
176
-            return $this->assets->getStylesheetAsset($handle);
177
-        }
178
-        return $this->addCss($handle, $dependencies);
179
-    }
180
-
181
-
182
-    /**
183
-     * @param       $handle
184
-     * @param array $dependencies
185
-     * @since 4.9.71.p
186
-     * @return JavascriptAsset
187
-     * @throws InvalidDataTypeException
188
-     * @throws InvalidEntityException
189
-     * @throws DuplicateCollectionIdentifierException
190
-     */
191
-    public function addScript($handle, array $dependencies = array())
192
-    {
193
-        if ($this->assets->hasJavascriptAsset($handle)) {
194
-            return $this->assets->getJavascriptAsset($handle);
195
-        }
196
-        return $this->addJs($handle, $dependencies);
197
-    }
198
-
199
-
200
-    /**
201
-     * @param        $handle
202
-     * @param array  $dependencies
203
-     * @since 4.9.71.p
204
-     * @return StylesheetAsset
205
-     * @throws InvalidDataTypeException
206
-     * @throws InvalidEntityException
207
-     * @throws DuplicateCollectionIdentifierException
208
-     */
209
-    public function addStyle($handle, array $dependencies = array())
210
-    {
211
-        if ($this->assets->hasStylesheetAsset($handle)) {
212
-            return $this->assets->getStylesheetAsset($handle);
213
-        }
214
-        return $this->addCss($handle, $dependencies);
215
-    }
216
-
217
-
218
-    /**
219
-     * @return JavascriptAsset|null
220
-     */
221
-    public function getEditorScript()
222
-    {
223
-        return $this->assets->getJavascriptAsset($this->editor_script_handle);
224
-    }
225
-
226
-
227
-    /**
228
-     * @return StylesheetAsset|null
229
-     */
230
-    public function getEditorStyle()
231
-    {
232
-        return $this->assets->getStylesheetAsset($this->editor_style_handle);
233
-    }
234
-
235
-
236
-    /**
237
-     * @return JavascriptAsset|null
238
-     */
239
-    public function getScript()
240
-    {
241
-        return $this->assets->getJavascriptAsset($this->script_handle);
242
-    }
243
-
244
-
245
-    /**
246
-     * @return StylesheetAsset|null
247
-     */
248
-    public function getStyle()
249
-    {
250
-        return $this->assets->getStylesheetAsset($this->style_handle);
251
-    }
252
-
253
-
254
-    /**
255
-     * @return  void
256
-     */
257
-    public function enqueueAssets()
258
-    {
259
-        $assets = array(
260
-            $this->getEditorScript(),
261
-            $this->getEditorStyle(),
262
-            $this->getScript(),
263
-            $this->getStyle(),
264
-        );
265
-        foreach ($assets as $asset) {
266
-            if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
267
-                $asset->enqueueAsset();
268
-            }
269
-        }
270
-    }
23
+	/**
24
+	 * @var string $editor_script_handle
25
+	 */
26
+	private $editor_script_handle;
27
+
28
+	/**
29
+	 * @var string $editor_style_handle
30
+	 */
31
+	private $editor_style_handle;
32
+
33
+	/**
34
+	 * @var string $script_handle
35
+	 */
36
+	private $script_handle;
37
+
38
+	/**
39
+	 * @var string $style_handle
40
+	 */
41
+	private $style_handle;
42
+
43
+
44
+	/**
45
+	 * @return string
46
+	 */
47
+	public function getEditorScriptHandle()
48
+	{
49
+		return $this->editor_script_handle;
50
+	}
51
+
52
+
53
+	/**
54
+	 * @param string $editor_script_handle
55
+	 */
56
+	public function setEditorScriptHandle($editor_script_handle)
57
+	{
58
+		if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
59
+			$editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
60
+		}
61
+		$this->editor_script_handle = $editor_script_handle;
62
+	}
63
+
64
+
65
+	/**
66
+	 * @return string
67
+	 */
68
+	public function getEditorStyleHandle()
69
+	{
70
+		return $this->editor_style_handle;
71
+	}
72
+
73
+
74
+	/**
75
+	 * @param string $editor_style_handle
76
+	 */
77
+	public function setEditorStyleHandle($editor_style_handle)
78
+	{
79
+		if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
80
+			$editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
81
+		}
82
+		$this->editor_style_handle = $editor_style_handle;
83
+	}
84
+
85
+
86
+	/**
87
+	 * @return string
88
+	 */
89
+	public function getScriptHandle()
90
+	{
91
+		return $this->script_handle;
92
+	}
93
+
94
+
95
+	/**
96
+	 * @param string $script_handle
97
+	 */
98
+	public function setScriptHandle($script_handle)
99
+	{
100
+		if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
101
+			$script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
102
+		}
103
+		$this->script_handle = $script_handle;
104
+	}
105
+
106
+
107
+	/**
108
+	 * @return string
109
+	 */
110
+	public function getStyleHandle()
111
+	{
112
+		return $this->style_handle;
113
+	}
114
+
115
+
116
+	/**
117
+	 * @param string $style_handle
118
+	 */
119
+	public function setStyleHandle($style_handle)
120
+	{
121
+		if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
122
+			$style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
123
+		}
124
+		$this->style_handle = $style_handle;
125
+	}
126
+
127
+	/**
128
+	 * @since 4.9.71.p
129
+	 * @throws InvalidDataTypeException
130
+	 * @throws InvalidEntityException
131
+	 * @throws DuplicateCollectionIdentifierException
132
+	 */
133
+	public function addAssets()
134
+	{
135
+		$this->addEditorScript($this->getEditorScriptHandle());
136
+		// $this->addEditorStyle($this->getEditorStyleHandle());
137
+		$this->addScript($this->getScriptHandle());
138
+		// $this->addStyle($this->getStyleHandle());
139
+	}
140
+
141
+
142
+	/**
143
+	 * @param       $handle
144
+	 * @param array $dependencies
145
+	 * @since 4.9.71.p
146
+	 * @return JavascriptAsset
147
+	 * @throws InvalidDataTypeException
148
+	 * @throws InvalidEntityException
149
+	 * @throws DuplicateCollectionIdentifierException
150
+	 */
151
+	public function addEditorScript($handle, array $dependencies = array())
152
+	{
153
+		if ($this->assets->hasJavascriptAsset($handle)){
154
+			return $this->assets->getJavascriptAsset($handle);
155
+		}
156
+		$dependencies = array_merge(
157
+			$dependencies,
158
+			['wp-blocks']
159
+		);
160
+		return $this->addJs($handle, $dependencies);
161
+	}
162
+
163
+
164
+	/**
165
+	 * @param        $handle
166
+	 * @param array  $dependencies
167
+	 * @since 4.9.71.p
168
+	 * @return StylesheetAsset
169
+	 * @throws InvalidDataTypeException
170
+	 * @throws InvalidEntityException
171
+	 * @throws DuplicateCollectionIdentifierException
172
+	 */
173
+	public function addEditorStyle($handle, array $dependencies = array())
174
+	{
175
+		if ($this->assets->hasStylesheetAsset($handle)) {
176
+			return $this->assets->getStylesheetAsset($handle);
177
+		}
178
+		return $this->addCss($handle, $dependencies);
179
+	}
180
+
181
+
182
+	/**
183
+	 * @param       $handle
184
+	 * @param array $dependencies
185
+	 * @since 4.9.71.p
186
+	 * @return JavascriptAsset
187
+	 * @throws InvalidDataTypeException
188
+	 * @throws InvalidEntityException
189
+	 * @throws DuplicateCollectionIdentifierException
190
+	 */
191
+	public function addScript($handle, array $dependencies = array())
192
+	{
193
+		if ($this->assets->hasJavascriptAsset($handle)) {
194
+			return $this->assets->getJavascriptAsset($handle);
195
+		}
196
+		return $this->addJs($handle, $dependencies);
197
+	}
198
+
199
+
200
+	/**
201
+	 * @param        $handle
202
+	 * @param array  $dependencies
203
+	 * @since 4.9.71.p
204
+	 * @return StylesheetAsset
205
+	 * @throws InvalidDataTypeException
206
+	 * @throws InvalidEntityException
207
+	 * @throws DuplicateCollectionIdentifierException
208
+	 */
209
+	public function addStyle($handle, array $dependencies = array())
210
+	{
211
+		if ($this->assets->hasStylesheetAsset($handle)) {
212
+			return $this->assets->getStylesheetAsset($handle);
213
+		}
214
+		return $this->addCss($handle, $dependencies);
215
+	}
216
+
217
+
218
+	/**
219
+	 * @return JavascriptAsset|null
220
+	 */
221
+	public function getEditorScript()
222
+	{
223
+		return $this->assets->getJavascriptAsset($this->editor_script_handle);
224
+	}
225
+
226
+
227
+	/**
228
+	 * @return StylesheetAsset|null
229
+	 */
230
+	public function getEditorStyle()
231
+	{
232
+		return $this->assets->getStylesheetAsset($this->editor_style_handle);
233
+	}
234
+
235
+
236
+	/**
237
+	 * @return JavascriptAsset|null
238
+	 */
239
+	public function getScript()
240
+	{
241
+		return $this->assets->getJavascriptAsset($this->script_handle);
242
+	}
243
+
244
+
245
+	/**
246
+	 * @return StylesheetAsset|null
247
+	 */
248
+	public function getStyle()
249
+	{
250
+		return $this->assets->getStylesheetAsset($this->style_handle);
251
+	}
252
+
253
+
254
+	/**
255
+	 * @return  void
256
+	 */
257
+	public function enqueueAssets()
258
+	{
259
+		$assets = array(
260
+			$this->getEditorScript(),
261
+			$this->getEditorStyle(),
262
+			$this->getScript(),
263
+			$this->getStyle(),
264
+		);
265
+		foreach ($assets as $asset) {
266
+			if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
267
+				$asset->enqueueAsset();
268
+			}
269
+		}
270
+	}
271 271
 
272 272
 }
Please login to merge, or discard this patch.
core/services/assets/JedLocaleData.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -15,35 +15,35 @@
 block discarded – undo
15 15
 class JedLocaleData
16 16
 {
17 17
 
18
-    /**
19
-     * @var array $locales
20
-     */
21
-    protected $locales = [];
18
+	/**
19
+	 * @var array $locales
20
+	 */
21
+	protected $locales = [];
22 22
 
23
-    /**
24
-     * Returns Jed-formatted localization data.
25
-     *
26
-     * @param string $domain Translation domain.
27
-     * @return array
28
-     */
29
-    public function getData($domain = Domain::TEXT_DOMAIN)
30
-    {
31
-        if (! isset($locales[ $domain ])) {
32
-            $translations = get_translations_for_domain($domain);
33
-            $locale = [
34
-                '' => [
35
-                    'domain' => $domain,
36
-                    'lang'   => is_admin() ? EEH_DTT_Helper::get_user_locale() : get_locale()
37
-                ],
38
-            ];
39
-            if (! empty($translations->headers['Plural-Forms'])) {
40
-                $locale['']['plural_forms'] = $translations->headers['Plural-Forms'];
41
-            }
42
-            foreach ($translations->entries as $id => $entry) {
43
-                $locale[ $id ] = $entry->translations;
44
-            }
45
-            $locales[ $domain ] = $locale;
46
-        }
47
-        return $locales[ $domain ];
48
-    }
23
+	/**
24
+	 * Returns Jed-formatted localization data.
25
+	 *
26
+	 * @param string $domain Translation domain.
27
+	 * @return array
28
+	 */
29
+	public function getData($domain = Domain::TEXT_DOMAIN)
30
+	{
31
+		if (! isset($locales[ $domain ])) {
32
+			$translations = get_translations_for_domain($domain);
33
+			$locale = [
34
+				'' => [
35
+					'domain' => $domain,
36
+					'lang'   => is_admin() ? EEH_DTT_Helper::get_user_locale() : get_locale()
37
+				],
38
+			];
39
+			if (! empty($translations->headers['Plural-Forms'])) {
40
+				$locale['']['plural_forms'] = $translations->headers['Plural-Forms'];
41
+			}
42
+			foreach ($translations->entries as $id => $entry) {
43
+				$locale[ $id ] = $entry->translations;
44
+			}
45
+			$locales[ $domain ] = $locale;
46
+		}
47
+		return $locales[ $domain ];
48
+	}
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function getData($domain = Domain::TEXT_DOMAIN)
30 30
     {
31
-        if (! isset($locales[ $domain ])) {
31
+        if ( ! isset($locales[$domain])) {
32 32
             $translations = get_translations_for_domain($domain);
33 33
             $locale = [
34 34
                 '' => [
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
                     'lang'   => is_admin() ? EEH_DTT_Helper::get_user_locale() : get_locale()
37 37
                 ],
38 38
             ];
39
-            if (! empty($translations->headers['Plural-Forms'])) {
39
+            if ( ! empty($translations->headers['Plural-Forms'])) {
40 40
                 $locale['']['plural_forms'] = $translations->headers['Plural-Forms'];
41 41
             }
42 42
             foreach ($translations->entries as $id => $entry) {
43
-                $locale[ $id ] = $entry->translations;
43
+                $locale[$id] = $entry->translations;
44 44
             }
45
-            $locales[ $domain ] = $locale;
45
+            $locales[$domain] = $locale;
46 46
         }
47
-        return $locales[ $domain ];
47
+        return $locales[$domain];
48 48
     }
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
core/services/assets/Registry.php 1 patch
Indentation   +573 added lines, -573 removed lines patch added patch discarded remove patch
@@ -24,584 +24,584 @@
 block discarded – undo
24 24
 class Registry
25 25
 {
26 26
 
27
-    const FILE_NAME_BUILD_MANIFEST = 'build-manifest.json';
28
-
29
-    /**
30
-     * @var AssetCollection[] $assets
31
-     */
32
-    protected $assets = [];
33
-
34
-    /**
35
-     * @var AssetManifestInterface
36
-     */
37
-    private $asset_manifest;
38
-
39
-    /**
40
-     * This holds the jsdata data object that will be exposed on pages that enqueue the `eejs-core` script.
41
-     *
42
-     * @var array
43
-     */
44
-    protected $jsdata = array();
45
-
46
-    /**
47
-     * This keeps track of all scripts with registered data.  It is used to prevent duplicate data objects setup in the
48
-     * page source.
49
-     *
50
-     * @var array
51
-     */
52
-    private $script_handles_with_data = array();
53
-
54
-
55
-    /**
56
-     * Registry constructor.
57
-     * Hooking into WP actions for script registry.
58
-     *
59
-     * @param AssetCollection        $assets
60
-     * @param AssetManifestInterface $asset_manifest
61
-     * @throws InvalidArgumentException
62
-     * @throws InvalidDataTypeException
63
-     * @throws InvalidInterfaceException
64
-     */
65
-    public function __construct(AssetCollection $assets, AssetManifestInterface $asset_manifest)
66
-    {
67
-        $this->addAssetCollection($assets);
68
-        $this->asset_manifest = $asset_manifest;
69
-        $this->asset_manifest->initialize();
70
-        add_action('wp_enqueue_scripts', array($this, 'registerScriptsAndStyles'), 4);
71
-        add_action('admin_enqueue_scripts', array($this, 'registerScriptsAndStyles'), 4);
72
-        add_action('wp_enqueue_scripts', array($this, 'enqueueData'), 5);
73
-        add_action('admin_enqueue_scripts', array($this, 'enqueueData'), 5);
74
-        add_action('wp_print_footer_scripts', array($this, 'enqueueData'), 1);
75
-        add_action('admin_print_footer_scripts', array($this, 'enqueueData'), 1);
76
-    }
77
-
78
-
79
-    /**
80
-     * @param AssetCollection $asset_collection
81
-     */
82
-    public function addAssetCollection(AssetCollection $asset_collection)
83
-    {
84
-        $id = $asset_collection->collectionIdentifier();
85
-        if (! array_key_exists($id, $this->assets)) {
86
-            $this->assets[ $id ] = $asset_collection;
87
-        }
88
-    }
89
-
90
-
91
-
92
-    /**
93
-     * Callback for the wp_enqueue_scripts actions used to register assets.
94
-     *
95
-     * @since 4.9.62.p
96
-     * @throws Exception
97
-     */
98
-    public function registerScriptsAndStyles()
99
-    {
100
-        try {
101
-            foreach ($this->assets as $asset_collection) {
102
-                $this->registerScripts($asset_collection->getJavascriptAssets());
103
-                $this->registerStyles($asset_collection->getStylesheetAssets());
104
-            }
105
-        } catch (Exception $exception) {
106
-            new ExceptionStackTraceDisplay($exception);
107
-        }
108
-    }
109
-
110
-
111
-    /**
112
-     * Registers JS assets with WP core
113
-     *
114
-     * @param JavascriptAsset[] $scripts
115
-     * @throws AssetRegistrationException
116
-     * @throws InvalidDataTypeException
117
-     * @throws DomainException
118
-     * @since 4.9.62.p
119
-     */
120
-    public function registerScripts(array $scripts)
121
-    {
122
-        foreach ($scripts as $script) {
123
-            // skip to next script if this has already been done
124
-            if ($script->isRegistered()) {
125
-                continue;
126
-            }
127
-            do_action(
128
-                'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
129
-                $script
130
-            );
131
-            $registered = wp_register_script(
132
-                $script->handle(),
133
-                $script->source(),
134
-                $script->dependencies(),
135
-                $script->version(),
136
-                $script->loadInFooter()
137
-            );
138
-            if (! $registered && $this->debug()) {
139
-                throw new AssetRegistrationException($script->handle());
140
-            }
141
-            $script->setRegistered($registered);
142
-            if ($script->enqueueImmediately()) {
143
-                wp_enqueue_script($script->handle());
144
-            }
145
-            do_action(
146
-                'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__after_script',
147
-                $script
148
-            );
149
-        }
150
-    }
151
-
152
-
153
-    /**
154
-     * Registers CSS assets with WP core
155
-     *
156
-     * @param StylesheetAsset[] $styles
157
-     * @throws InvalidDataTypeException
158
-     * @throws DomainException
159
-     * @since 4.9.62.p
160
-     */
161
-    public function registerStyles(array $styles)
162
-    {
163
-        foreach ($styles as $style) {
164
-            // skip to next style if this has already been done
165
-            if ($style->isRegistered()) {
166
-                continue;
167
-            }
168
-            do_action(
169
-                'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__before_style',
170
-                $style
171
-            );
172
-            wp_register_style(
173
-                $style->handle(),
174
-                $style->source(),
175
-                $style->dependencies(),
176
-                $style->version(),
177
-                $style->media()
178
-            );
179
-            $style->setRegistered();
180
-            if ($style->enqueueImmediately()) {
181
-                wp_enqueue_style($style->handle());
182
-            }
183
-            do_action(
184
-                'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__after_style',
185
-                $style
186
-            );
187
-        }
188
-    }
189
-
190
-
191
-    /**
192
-     * Call back for the script print in frontend and backend.
193
-     * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.
194
-     *
195
-     * @throws Exception
196
-     * @since 4.9.31.rc.015
197
-     */
198
-    public function enqueueData()
199
-    {
200
-        try {
201
-            $this->removeAlreadyRegisteredDataForScriptHandles();
202
-            wp_add_inline_script(
203
-                'eejs-core',
204
-                'var eejsdata=' . wp_json_encode(['data' => $this->jsdata]),
205
-                'before'
206
-            );
207
-            foreach ($this->assets as $asset_collection) {
208
-                $scripts = $asset_collection->getJavascriptAssetsWithData();
209
-                foreach ($scripts as $script) {
210
-                    $this->addRegisteredScriptHandlesWithData($script->handle());
211
-                    if ($script->hasInlineDataCallback()) {
212
-                        $localize = $script->inlineDataCallback();
213
-                        $localize();
214
-                    }
215
-                }
216
-            }
217
-        } catch (Exception $exception) {
218
-            EE_Error::add_error($exception->getMessage(), __FILE__, __FUNCTION__, __LINE__);
219
-            new ExceptionStackTraceDisplay($exception);
220
-        }
221
-    }
222
-
223
-
224
-    /**
225
-     * Used to add data to eejs.data object.
226
-     * Note:  Overriding existing data is not allowed.
227
-     * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.
228
-     * If the data you add is something like this:
229
-     *  $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );
230
-     * It will be exposed in the page source as:
231
-     *  eejs.data.my_plugin_data.foo == gar
232
-     *
233
-     * @param string       $key   Key used to access your data
234
-     * @param string|array $value Value to attach to key
235
-     * @throws InvalidArgumentException
236
-     */
237
-    public function addData($key, $value)
238
-    {
239
-        if ($this->verifyDataNotExisting($key)) {
240
-            $this->jsdata[ $key ] = $value;
241
-        }
242
-    }
243
-
244
-
245
-    /**
246
-     * Similar to addData except this allows for users to push values to an existing key where the values on key are
247
-     * elements in an array.
248
-     *
249
-     * When you use this method, the value you include will be merged with the array on $key.
250
-     * So if the $key was 'test' and you added a value of ['my_data'] then it would be represented in the javascript
251
-     * object like this, eejs.data.test = [ my_data,
252
-     * ]
253
-     * If there has already been a scalar value attached to the data object given key (via addData for instance), then
254
-     * this will throw an exception.
255
-     *
256
-     * Caution: Only add data using this method if you are okay with the potential for additional data added on the same
257
-     * key potentially overriding the existing data on merge (specifically with associative arrays).
258
-     *
259
-     * @param string       $key   Key to attach data to.
260
-     * @param string|array $value Value being registered.
261
-     * @throws InvalidArgumentException
262
-     */
263
-    public function pushData($key, $value)
264
-    {
265
-        if (isset($this->jsdata[ $key ])
266
-            && ! is_array($this->jsdata[ $key ])
267
-        ) {
268
-            if (! $this->debug()) {
269
-                return;
270
-            }
271
-            throw new InvalidArgumentException(
272
-                sprintf(
273
-                    __(
274
-                        'The value for %1$s is already set and it is not an array. The %2$s method can only be used to
27
+	const FILE_NAME_BUILD_MANIFEST = 'build-manifest.json';
28
+
29
+	/**
30
+	 * @var AssetCollection[] $assets
31
+	 */
32
+	protected $assets = [];
33
+
34
+	/**
35
+	 * @var AssetManifestInterface
36
+	 */
37
+	private $asset_manifest;
38
+
39
+	/**
40
+	 * This holds the jsdata data object that will be exposed on pages that enqueue the `eejs-core` script.
41
+	 *
42
+	 * @var array
43
+	 */
44
+	protected $jsdata = array();
45
+
46
+	/**
47
+	 * This keeps track of all scripts with registered data.  It is used to prevent duplicate data objects setup in the
48
+	 * page source.
49
+	 *
50
+	 * @var array
51
+	 */
52
+	private $script_handles_with_data = array();
53
+
54
+
55
+	/**
56
+	 * Registry constructor.
57
+	 * Hooking into WP actions for script registry.
58
+	 *
59
+	 * @param AssetCollection        $assets
60
+	 * @param AssetManifestInterface $asset_manifest
61
+	 * @throws InvalidArgumentException
62
+	 * @throws InvalidDataTypeException
63
+	 * @throws InvalidInterfaceException
64
+	 */
65
+	public function __construct(AssetCollection $assets, AssetManifestInterface $asset_manifest)
66
+	{
67
+		$this->addAssetCollection($assets);
68
+		$this->asset_manifest = $asset_manifest;
69
+		$this->asset_manifest->initialize();
70
+		add_action('wp_enqueue_scripts', array($this, 'registerScriptsAndStyles'), 4);
71
+		add_action('admin_enqueue_scripts', array($this, 'registerScriptsAndStyles'), 4);
72
+		add_action('wp_enqueue_scripts', array($this, 'enqueueData'), 5);
73
+		add_action('admin_enqueue_scripts', array($this, 'enqueueData'), 5);
74
+		add_action('wp_print_footer_scripts', array($this, 'enqueueData'), 1);
75
+		add_action('admin_print_footer_scripts', array($this, 'enqueueData'), 1);
76
+	}
77
+
78
+
79
+	/**
80
+	 * @param AssetCollection $asset_collection
81
+	 */
82
+	public function addAssetCollection(AssetCollection $asset_collection)
83
+	{
84
+		$id = $asset_collection->collectionIdentifier();
85
+		if (! array_key_exists($id, $this->assets)) {
86
+			$this->assets[ $id ] = $asset_collection;
87
+		}
88
+	}
89
+
90
+
91
+
92
+	/**
93
+	 * Callback for the wp_enqueue_scripts actions used to register assets.
94
+	 *
95
+	 * @since 4.9.62.p
96
+	 * @throws Exception
97
+	 */
98
+	public function registerScriptsAndStyles()
99
+	{
100
+		try {
101
+			foreach ($this->assets as $asset_collection) {
102
+				$this->registerScripts($asset_collection->getJavascriptAssets());
103
+				$this->registerStyles($asset_collection->getStylesheetAssets());
104
+			}
105
+		} catch (Exception $exception) {
106
+			new ExceptionStackTraceDisplay($exception);
107
+		}
108
+	}
109
+
110
+
111
+	/**
112
+	 * Registers JS assets with WP core
113
+	 *
114
+	 * @param JavascriptAsset[] $scripts
115
+	 * @throws AssetRegistrationException
116
+	 * @throws InvalidDataTypeException
117
+	 * @throws DomainException
118
+	 * @since 4.9.62.p
119
+	 */
120
+	public function registerScripts(array $scripts)
121
+	{
122
+		foreach ($scripts as $script) {
123
+			// skip to next script if this has already been done
124
+			if ($script->isRegistered()) {
125
+				continue;
126
+			}
127
+			do_action(
128
+				'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
129
+				$script
130
+			);
131
+			$registered = wp_register_script(
132
+				$script->handle(),
133
+				$script->source(),
134
+				$script->dependencies(),
135
+				$script->version(),
136
+				$script->loadInFooter()
137
+			);
138
+			if (! $registered && $this->debug()) {
139
+				throw new AssetRegistrationException($script->handle());
140
+			}
141
+			$script->setRegistered($registered);
142
+			if ($script->enqueueImmediately()) {
143
+				wp_enqueue_script($script->handle());
144
+			}
145
+			do_action(
146
+				'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__after_script',
147
+				$script
148
+			);
149
+		}
150
+	}
151
+
152
+
153
+	/**
154
+	 * Registers CSS assets with WP core
155
+	 *
156
+	 * @param StylesheetAsset[] $styles
157
+	 * @throws InvalidDataTypeException
158
+	 * @throws DomainException
159
+	 * @since 4.9.62.p
160
+	 */
161
+	public function registerStyles(array $styles)
162
+	{
163
+		foreach ($styles as $style) {
164
+			// skip to next style if this has already been done
165
+			if ($style->isRegistered()) {
166
+				continue;
167
+			}
168
+			do_action(
169
+				'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__before_style',
170
+				$style
171
+			);
172
+			wp_register_style(
173
+				$style->handle(),
174
+				$style->source(),
175
+				$style->dependencies(),
176
+				$style->version(),
177
+				$style->media()
178
+			);
179
+			$style->setRegistered();
180
+			if ($style->enqueueImmediately()) {
181
+				wp_enqueue_style($style->handle());
182
+			}
183
+			do_action(
184
+				'AHEE__EventEspresso_core_services_assets_Registry__registerStyles__after_style',
185
+				$style
186
+			);
187
+		}
188
+	}
189
+
190
+
191
+	/**
192
+	 * Call back for the script print in frontend and backend.
193
+	 * Used to call wp_localize_scripts so that data can be added throughout the runtime until this later hook point.
194
+	 *
195
+	 * @throws Exception
196
+	 * @since 4.9.31.rc.015
197
+	 */
198
+	public function enqueueData()
199
+	{
200
+		try {
201
+			$this->removeAlreadyRegisteredDataForScriptHandles();
202
+			wp_add_inline_script(
203
+				'eejs-core',
204
+				'var eejsdata=' . wp_json_encode(['data' => $this->jsdata]),
205
+				'before'
206
+			);
207
+			foreach ($this->assets as $asset_collection) {
208
+				$scripts = $asset_collection->getJavascriptAssetsWithData();
209
+				foreach ($scripts as $script) {
210
+					$this->addRegisteredScriptHandlesWithData($script->handle());
211
+					if ($script->hasInlineDataCallback()) {
212
+						$localize = $script->inlineDataCallback();
213
+						$localize();
214
+					}
215
+				}
216
+			}
217
+		} catch (Exception $exception) {
218
+			EE_Error::add_error($exception->getMessage(), __FILE__, __FUNCTION__, __LINE__);
219
+			new ExceptionStackTraceDisplay($exception);
220
+		}
221
+	}
222
+
223
+
224
+	/**
225
+	 * Used to add data to eejs.data object.
226
+	 * Note:  Overriding existing data is not allowed.
227
+	 * Data will be accessible as a javascript object when you list `eejs-core` as a dependency for your javascript.
228
+	 * If the data you add is something like this:
229
+	 *  $this->addData( 'my_plugin_data', array( 'foo' => 'gar' ) );
230
+	 * It will be exposed in the page source as:
231
+	 *  eejs.data.my_plugin_data.foo == gar
232
+	 *
233
+	 * @param string       $key   Key used to access your data
234
+	 * @param string|array $value Value to attach to key
235
+	 * @throws InvalidArgumentException
236
+	 */
237
+	public function addData($key, $value)
238
+	{
239
+		if ($this->verifyDataNotExisting($key)) {
240
+			$this->jsdata[ $key ] = $value;
241
+		}
242
+	}
243
+
244
+
245
+	/**
246
+	 * Similar to addData except this allows for users to push values to an existing key where the values on key are
247
+	 * elements in an array.
248
+	 *
249
+	 * When you use this method, the value you include will be merged with the array on $key.
250
+	 * So if the $key was 'test' and you added a value of ['my_data'] then it would be represented in the javascript
251
+	 * object like this, eejs.data.test = [ my_data,
252
+	 * ]
253
+	 * If there has already been a scalar value attached to the data object given key (via addData for instance), then
254
+	 * this will throw an exception.
255
+	 *
256
+	 * Caution: Only add data using this method if you are okay with the potential for additional data added on the same
257
+	 * key potentially overriding the existing data on merge (specifically with associative arrays).
258
+	 *
259
+	 * @param string       $key   Key to attach data to.
260
+	 * @param string|array $value Value being registered.
261
+	 * @throws InvalidArgumentException
262
+	 */
263
+	public function pushData($key, $value)
264
+	{
265
+		if (isset($this->jsdata[ $key ])
266
+			&& ! is_array($this->jsdata[ $key ])
267
+		) {
268
+			if (! $this->debug()) {
269
+				return;
270
+			}
271
+			throw new InvalidArgumentException(
272
+				sprintf(
273
+					__(
274
+						'The value for %1$s is already set and it is not an array. The %2$s method can only be used to
275 275
                          push values to this data element when it is an array.',
276
-                        'event_espresso'
277
-                    ),
278
-                    $key,
279
-                    __METHOD__
280
-                )
281
-            );
282
-        }
283
-        if ( ! isset( $this->jsdata[ $key ] ) ) {
284
-            $this->jsdata[ $key ] = is_array($value) ? $value : [$value];
285
-        } else {
286
-            $this->jsdata[ $key ] = array_merge( $this->jsdata[$key], (array) $value);
287
-        }
288
-    }
289
-
290
-
291
-    /**
292
-     * Used to set content used by javascript for a template.
293
-     * Note: Overrides of existing registered templates are not allowed.
294
-     *
295
-     * @param string $template_reference
296
-     * @param string $template_content
297
-     * @throws InvalidArgumentException
298
-     */
299
-    public function addTemplate($template_reference, $template_content)
300
-    {
301
-        if (! isset($this->jsdata['templates'])) {
302
-            $this->jsdata['templates'] = array();
303
-        }
304
-        //no overrides allowed.
305
-        if (isset($this->jsdata['templates'][ $template_reference ])) {
306
-            if (! $this->debug()) {
307
-                return;
308
-            }
309
-            throw new InvalidArgumentException(
310
-                sprintf(
311
-                    __(
312
-                        'The %1$s key already exists for the templates array in the js data array.  No overrides are allowed.',
313
-                        'event_espresso'
314
-                    ),
315
-                    $template_reference
316
-                )
317
-            );
318
-        }
319
-        $this->jsdata['templates'][ $template_reference ] = $template_content;
320
-    }
321
-
322
-
323
-    /**
324
-     * Retrieve the template content already registered for the given reference.
325
-     *
326
-     * @param string $template_reference
327
-     * @return string
328
-     */
329
-    public function getTemplate($template_reference)
330
-    {
331
-        return isset($this->jsdata['templates'][ $template_reference ])
332
-            ? $this->jsdata['templates'][ $template_reference ]
333
-            : '';
334
-    }
335
-
336
-
337
-    /**
338
-     * Retrieve registered data.
339
-     *
340
-     * @param string $key Name of key to attach data to.
341
-     * @return mixed                If there is no for the given key, then false is returned.
342
-     */
343
-    public function getData($key)
344
-    {
345
-        return isset($this->jsdata[ $key ])
346
-            ? $this->jsdata[ $key ]
347
-            : false;
348
-    }
349
-
350
-
351
-    /**
352
-     * Verifies whether the given data exists already on the jsdata array.
353
-     * Overriding data is not allowed.
354
-     *
355
-     * @param string $key Index for data.
356
-     * @return bool        If valid then return true.
357
-     * @throws InvalidArgumentException if data already exists.
358
-     */
359
-    protected function verifyDataNotExisting($key)
360
-    {
361
-        if (isset($this->jsdata[ $key ])) {
362
-            if (! $this->debug()) {
363
-                return false;
364
-            }
365
-            if (is_array($this->jsdata[ $key ])) {
366
-                throw new InvalidArgumentException(
367
-                    sprintf(
368
-                        __(
369
-                            'The value for %1$s already exists in the Registry::eejs object.
276
+						'event_espresso'
277
+					),
278
+					$key,
279
+					__METHOD__
280
+				)
281
+			);
282
+		}
283
+		if ( ! isset( $this->jsdata[ $key ] ) ) {
284
+			$this->jsdata[ $key ] = is_array($value) ? $value : [$value];
285
+		} else {
286
+			$this->jsdata[ $key ] = array_merge( $this->jsdata[$key], (array) $value);
287
+		}
288
+	}
289
+
290
+
291
+	/**
292
+	 * Used to set content used by javascript for a template.
293
+	 * Note: Overrides of existing registered templates are not allowed.
294
+	 *
295
+	 * @param string $template_reference
296
+	 * @param string $template_content
297
+	 * @throws InvalidArgumentException
298
+	 */
299
+	public function addTemplate($template_reference, $template_content)
300
+	{
301
+		if (! isset($this->jsdata['templates'])) {
302
+			$this->jsdata['templates'] = array();
303
+		}
304
+		//no overrides allowed.
305
+		if (isset($this->jsdata['templates'][ $template_reference ])) {
306
+			if (! $this->debug()) {
307
+				return;
308
+			}
309
+			throw new InvalidArgumentException(
310
+				sprintf(
311
+					__(
312
+						'The %1$s key already exists for the templates array in the js data array.  No overrides are allowed.',
313
+						'event_espresso'
314
+					),
315
+					$template_reference
316
+				)
317
+			);
318
+		}
319
+		$this->jsdata['templates'][ $template_reference ] = $template_content;
320
+	}
321
+
322
+
323
+	/**
324
+	 * Retrieve the template content already registered for the given reference.
325
+	 *
326
+	 * @param string $template_reference
327
+	 * @return string
328
+	 */
329
+	public function getTemplate($template_reference)
330
+	{
331
+		return isset($this->jsdata['templates'][ $template_reference ])
332
+			? $this->jsdata['templates'][ $template_reference ]
333
+			: '';
334
+	}
335
+
336
+
337
+	/**
338
+	 * Retrieve registered data.
339
+	 *
340
+	 * @param string $key Name of key to attach data to.
341
+	 * @return mixed                If there is no for the given key, then false is returned.
342
+	 */
343
+	public function getData($key)
344
+	{
345
+		return isset($this->jsdata[ $key ])
346
+			? $this->jsdata[ $key ]
347
+			: false;
348
+	}
349
+
350
+
351
+	/**
352
+	 * Verifies whether the given data exists already on the jsdata array.
353
+	 * Overriding data is not allowed.
354
+	 *
355
+	 * @param string $key Index for data.
356
+	 * @return bool        If valid then return true.
357
+	 * @throws InvalidArgumentException if data already exists.
358
+	 */
359
+	protected function verifyDataNotExisting($key)
360
+	{
361
+		if (isset($this->jsdata[ $key ])) {
362
+			if (! $this->debug()) {
363
+				return false;
364
+			}
365
+			if (is_array($this->jsdata[ $key ])) {
366
+				throw new InvalidArgumentException(
367
+					sprintf(
368
+						__(
369
+							'The value for %1$s already exists in the Registry::eejs object.
370 370
                             Overrides are not allowed. Since the value of this data is an array, you may want to use the
371 371
                             %2$s method to push your value to the array.',
372
-                            'event_espresso'
373
-                        ),
374
-                        $key,
375
-                        'pushData()'
376
-                    )
377
-                );
378
-            }
379
-            throw new InvalidArgumentException(
380
-                sprintf(
381
-                    __(
382
-                        'The value for %1$s already exists in the Registry::eejs object. Overrides are not
372
+							'event_espresso'
373
+						),
374
+						$key,
375
+						'pushData()'
376
+					)
377
+				);
378
+			}
379
+			throw new InvalidArgumentException(
380
+				sprintf(
381
+					__(
382
+						'The value for %1$s already exists in the Registry::eejs object. Overrides are not
383 383
                         allowed.  Consider attaching your value to a different key',
384
-                        'event_espresso'
385
-                    ),
386
-                    $key
387
-                )
388
-            );
389
-        }
390
-        return true;
391
-    }
392
-
393
-
394
-    /**
395
-     * Get the actual asset path for asset manifests.
396
-     * If there is no asset path found for the given $chunk_name, then the $chunk_name is returned.
397
-     *
398
-     * @param string $namespace  The namespace associated with the manifest file hosting the map of chunk_name to actual
399
-     *                           asset file location.
400
-     * @param string $chunk_name
401
-     * @param string $asset_type
402
-     * @return string
403
-     * @since 4.9.59.p
404
-     */
405
-    public function getAssetUrl($namespace, $chunk_name, $asset_type)
406
-    {
407
-        return apply_filters(
408
-            'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',
409
-            $this->asset_manifest->getAssetUrl($chunk_name, $asset_type),
410
-            $namespace,
411
-            $chunk_name,
412
-            $asset_type
413
-        );
414
-    }
415
-
416
-
417
-
418
-    /**
419
-     * Return the url to a js file for the given namespace and chunk name.
420
-     *
421
-     * @param string $namespace
422
-     * @param string $chunk_name
423
-     * @return string
424
-     */
425
-    public function getJsUrl($namespace, $chunk_name)
426
-    {
427
-        return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_JS);
428
-    }
429
-
430
-
431
-    /**
432
-     * Return the url to a css file for the given namespace and chunk name.
433
-     *
434
-     * @param string $namespace
435
-     * @param string $chunk_name
436
-     * @return string
437
-     */
438
-    public function getCssUrl($namespace, $chunk_name)
439
-    {
440
-        return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_CSS);
441
-    }
442
-
443
-
444
-    /**
445
-     * This is used to set registered script handles that have data.
446
-     *
447
-     * @param string $script_handle
448
-     */
449
-    private function addRegisteredScriptHandlesWithData($script_handle)
450
-    {
451
-        $this->script_handles_with_data[ $script_handle ] = $script_handle;
452
-    }
453
-
454
-
455
-    /**i
384
+						'event_espresso'
385
+					),
386
+					$key
387
+				)
388
+			);
389
+		}
390
+		return true;
391
+	}
392
+
393
+
394
+	/**
395
+	 * Get the actual asset path for asset manifests.
396
+	 * If there is no asset path found for the given $chunk_name, then the $chunk_name is returned.
397
+	 *
398
+	 * @param string $namespace  The namespace associated with the manifest file hosting the map of chunk_name to actual
399
+	 *                           asset file location.
400
+	 * @param string $chunk_name
401
+	 * @param string $asset_type
402
+	 * @return string
403
+	 * @since 4.9.59.p
404
+	 */
405
+	public function getAssetUrl($namespace, $chunk_name, $asset_type)
406
+	{
407
+		return apply_filters(
408
+			'FHEE__EventEspresso_core_services_assets_Registry__getAssetUrl',
409
+			$this->asset_manifest->getAssetUrl($chunk_name, $asset_type),
410
+			$namespace,
411
+			$chunk_name,
412
+			$asset_type
413
+		);
414
+	}
415
+
416
+
417
+
418
+	/**
419
+	 * Return the url to a js file for the given namespace and chunk name.
420
+	 *
421
+	 * @param string $namespace
422
+	 * @param string $chunk_name
423
+	 * @return string
424
+	 */
425
+	public function getJsUrl($namespace, $chunk_name)
426
+	{
427
+		return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_JS);
428
+	}
429
+
430
+
431
+	/**
432
+	 * Return the url to a css file for the given namespace and chunk name.
433
+	 *
434
+	 * @param string $namespace
435
+	 * @param string $chunk_name
436
+	 * @return string
437
+	 */
438
+	public function getCssUrl($namespace, $chunk_name)
439
+	{
440
+		return $this->getAssetUrl($namespace, $chunk_name, Asset::TYPE_CSS);
441
+	}
442
+
443
+
444
+	/**
445
+	 * This is used to set registered script handles that have data.
446
+	 *
447
+	 * @param string $script_handle
448
+	 */
449
+	private function addRegisteredScriptHandlesWithData($script_handle)
450
+	{
451
+		$this->script_handles_with_data[ $script_handle ] = $script_handle;
452
+	}
453
+
454
+
455
+	/**i
456 456
      * Checks WP_Scripts for all of each script handle registered internally as having data and unsets from the
457 457
      * Dependency stored in WP_Scripts if its set.
458 458
      */
459
-    private function removeAlreadyRegisteredDataForScriptHandles()
460
-    {
461
-        if (empty($this->script_handles_with_data)) {
462
-            return;
463
-        }
464
-        foreach ($this->script_handles_with_data as $script_handle) {
465
-            $this->removeAlreadyRegisteredDataForScriptHandle($script_handle);
466
-        }
467
-    }
468
-
469
-
470
-    /**
471
-     * Removes any data dependency registered in WP_Scripts if its set.
472
-     *
473
-     * @param string $script_handle
474
-     */
475
-    private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
476
-    {
477
-        if (isset($this->script_handles_with_data[ $script_handle ])) {
478
-            global $wp_scripts;
479
-            $unset_handle = false;
480
-            if ($wp_scripts->get_data($script_handle, 'data')) {
481
-                unset($wp_scripts->registered[ $script_handle ]->extra['data']);
482
-                $unset_handle = true;
483
-            }
484
-            //deal with inline_scripts
485
-            if ($wp_scripts->get_data($script_handle, 'before')) {
486
-                unset($wp_scripts->registered[ $script_handle ]->extra['before']);
487
-                $unset_handle = true;
488
-            }
489
-            if ($wp_scripts->get_data($script_handle, 'after')) {
490
-                unset($wp_scripts->registered[ $script_handle ]->extra['after']);
491
-            }
492
-            if ($unset_handle) {
493
-                unset($this->script_handles_with_data[ $script_handle ]);
494
-            }
495
-        }
496
-    }
497
-
498
-
499
-    /**
500
-     * @since 4.9.63.p
501
-     * @return bool
502
-     */
503
-    private function debug()
504
-    {
505
-        return apply_filters(
506
-            'FHEE__EventEspresso_core_services_assets_Registry__debug',
507
-            defined('EE_DEBUG') && EE_DEBUG
508
-        );
509
-    }
510
-
511
-
512
-    /**************** deprecated ****************/
513
-
514
-
515
-
516
-    /**
517
-     * @return null
518
-     * @deprecated $VID:$
519
-     */
520
-    public function getI18nRegistry()
521
-    {
522
-        return null;
523
-    }
524
-
525
-
526
-    /**
527
-     * @param string $handle
528
-     * @deprecated $VID:$
529
-     */
530
-    public function registerTranslation($handle)
531
-    {
532
-    }
533
-
534
-
535
-    /**
536
-     * @param string $namespace
537
-     * @param string $chunk_name
538
-     * @return array
539
-     * @deprecated $VID:$
540
-     */
541
-    public function getCssAssetDetails($namespace, $chunk_name)
542
-    {
543
-        return [
544
-            AssetManifest::KEY_DEPENDENCIES => $this->asset_manifest->getAssetDependencies($chunk_name, Asset::TYPE_CSS),
545
-            AssetManifest::KEY_VERSION => $this->asset_manifest->getAssetVersion($chunk_name, Asset::TYPE_CSS),
546
-        ];
547
-    }
548
-
549
-
550
-    /**
551
-     * @param string $namespace
552
-     * @param string $chunk_name
553
-     * @return array
554
-     * @deprecated $VID:$
555
-     */
556
-    public function getCssDependencies($namespace, $chunk_name)
557
-    {
558
-        return $this->asset_manifest->getAssetDependencies($chunk_name, AssetManifest::ASSET_EXT_CSS);
559
-    }
560
-
561
-
562
-    /**
563
-     * @param string $namespace
564
-     * @param string $chunk_name
565
-     * @return array
566
-     * @deprecated $VID:$
567
-     */
568
-    public function getJsAssetDetails($namespace, $chunk_name)
569
-    {
570
-        return [
571
-            AssetManifest::KEY_DEPENDENCIES => $this->asset_manifest->getAssetDependencies($chunk_name, Asset::TYPE_JS),
572
-            AssetManifest::KEY_VERSION => $this->asset_manifest->getAssetVersion($chunk_name, Asset::TYPE_JS),
573
-        ];
574
-    }
575
-
576
-
577
-    /**
578
-     * @param string $namespace
579
-     * @param string $chunk_name
580
-     * @return array
581
-     * @deprecated $VID:$
582
-     */
583
-    public function getJsDependencies($namespace, $chunk_name)
584
-    {
585
-        return $this->asset_manifest->getAssetDependencies($chunk_name);
586
-    }
587
-
588
-
589
-    /**
590
-     * @deprecated $VID:$
591
-     */
592
-    public function registerManifestFiles()
593
-    {
594
-    }
595
-
596
-
597
-    /**
598
-     * @param string $namespace
599
-     * @param string $url_base
600
-     * @param string $manifest_file
601
-     * @param string $manifest_file_path
602
-     * @deprecated $VID:$
603
-     */
604
-    public function registerManifestFile($namespace, $url_base, $manifest_file, $manifest_file_path = '')
605
-    {
606
-    }
459
+	private function removeAlreadyRegisteredDataForScriptHandles()
460
+	{
461
+		if (empty($this->script_handles_with_data)) {
462
+			return;
463
+		}
464
+		foreach ($this->script_handles_with_data as $script_handle) {
465
+			$this->removeAlreadyRegisteredDataForScriptHandle($script_handle);
466
+		}
467
+	}
468
+
469
+
470
+	/**
471
+	 * Removes any data dependency registered in WP_Scripts if its set.
472
+	 *
473
+	 * @param string $script_handle
474
+	 */
475
+	private function removeAlreadyRegisteredDataForScriptHandle($script_handle)
476
+	{
477
+		if (isset($this->script_handles_with_data[ $script_handle ])) {
478
+			global $wp_scripts;
479
+			$unset_handle = false;
480
+			if ($wp_scripts->get_data($script_handle, 'data')) {
481
+				unset($wp_scripts->registered[ $script_handle ]->extra['data']);
482
+				$unset_handle = true;
483
+			}
484
+			//deal with inline_scripts
485
+			if ($wp_scripts->get_data($script_handle, 'before')) {
486
+				unset($wp_scripts->registered[ $script_handle ]->extra['before']);
487
+				$unset_handle = true;
488
+			}
489
+			if ($wp_scripts->get_data($script_handle, 'after')) {
490
+				unset($wp_scripts->registered[ $script_handle ]->extra['after']);
491
+			}
492
+			if ($unset_handle) {
493
+				unset($this->script_handles_with_data[ $script_handle ]);
494
+			}
495
+		}
496
+	}
497
+
498
+
499
+	/**
500
+	 * @since 4.9.63.p
501
+	 * @return bool
502
+	 */
503
+	private function debug()
504
+	{
505
+		return apply_filters(
506
+			'FHEE__EventEspresso_core_services_assets_Registry__debug',
507
+			defined('EE_DEBUG') && EE_DEBUG
508
+		);
509
+	}
510
+
511
+
512
+	/**************** deprecated ****************/
513
+
514
+
515
+
516
+	/**
517
+	 * @return null
518
+	 * @deprecated $VID:$
519
+	 */
520
+	public function getI18nRegistry()
521
+	{
522
+		return null;
523
+	}
524
+
525
+
526
+	/**
527
+	 * @param string $handle
528
+	 * @deprecated $VID:$
529
+	 */
530
+	public function registerTranslation($handle)
531
+	{
532
+	}
533
+
534
+
535
+	/**
536
+	 * @param string $namespace
537
+	 * @param string $chunk_name
538
+	 * @return array
539
+	 * @deprecated $VID:$
540
+	 */
541
+	public function getCssAssetDetails($namespace, $chunk_name)
542
+	{
543
+		return [
544
+			AssetManifest::KEY_DEPENDENCIES => $this->asset_manifest->getAssetDependencies($chunk_name, Asset::TYPE_CSS),
545
+			AssetManifest::KEY_VERSION => $this->asset_manifest->getAssetVersion($chunk_name, Asset::TYPE_CSS),
546
+		];
547
+	}
548
+
549
+
550
+	/**
551
+	 * @param string $namespace
552
+	 * @param string $chunk_name
553
+	 * @return array
554
+	 * @deprecated $VID:$
555
+	 */
556
+	public function getCssDependencies($namespace, $chunk_name)
557
+	{
558
+		return $this->asset_manifest->getAssetDependencies($chunk_name, AssetManifest::ASSET_EXT_CSS);
559
+	}
560
+
561
+
562
+	/**
563
+	 * @param string $namespace
564
+	 * @param string $chunk_name
565
+	 * @return array
566
+	 * @deprecated $VID:$
567
+	 */
568
+	public function getJsAssetDetails($namespace, $chunk_name)
569
+	{
570
+		return [
571
+			AssetManifest::KEY_DEPENDENCIES => $this->asset_manifest->getAssetDependencies($chunk_name, Asset::TYPE_JS),
572
+			AssetManifest::KEY_VERSION => $this->asset_manifest->getAssetVersion($chunk_name, Asset::TYPE_JS),
573
+		];
574
+	}
575
+
576
+
577
+	/**
578
+	 * @param string $namespace
579
+	 * @param string $chunk_name
580
+	 * @return array
581
+	 * @deprecated $VID:$
582
+	 */
583
+	public function getJsDependencies($namespace, $chunk_name)
584
+	{
585
+		return $this->asset_manifest->getAssetDependencies($chunk_name);
586
+	}
587
+
588
+
589
+	/**
590
+	 * @deprecated $VID:$
591
+	 */
592
+	public function registerManifestFiles()
593
+	{
594
+	}
595
+
596
+
597
+	/**
598
+	 * @param string $namespace
599
+	 * @param string $url_base
600
+	 * @param string $manifest_file
601
+	 * @param string $manifest_file_path
602
+	 * @deprecated $VID:$
603
+	 */
604
+	public function registerManifestFile($namespace, $url_base, $manifest_file, $manifest_file_path = '')
605
+	{
606
+	}
607 607
 }
Please login to merge, or discard this patch.
core/services/assets/I18nRegistry.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -13,46 +13,46 @@
 block discarded – undo
13 13
  */
14 14
 class I18nRegistry
15 15
 {
16
-    /**
17
-     * @var DomainInterface
18
-     */
19
-    private $domain;
16
+	/**
17
+	 * @var DomainInterface
18
+	 */
19
+	private $domain;
20 20
 
21
-    /**
22
-     * @var JedLocaleData $jed_locale
23
-     */
24
-    private $jed_locale;
21
+	/**
22
+	 * @var JedLocaleData $jed_locale
23
+	 */
24
+	private $jed_locale;
25 25
 
26
-    /**
27
-     * I18nRegistry constructor.
28
-     *
29
-     * @param DomainInterface $domain
30
-     * @param JedLocaleData $jed_locale
31
-     * @param array() $i18n_map
32
-     * @deprecated $VID:$
33
-     */
34
-    public function __construct(DomainInterface $domain, JedLocaleData $jed_locale, array $i18n_map = [])
35
-    {
36
-        $this->domain = $domain;
37
-        $this->jed_locale = $jed_locale;
38
-    }
26
+	/**
27
+	 * I18nRegistry constructor.
28
+	 *
29
+	 * @param DomainInterface $domain
30
+	 * @param JedLocaleData $jed_locale
31
+	 * @param array() $i18n_map
32
+	 * @deprecated $VID:$
33
+	 */
34
+	public function __construct(DomainInterface $domain, JedLocaleData $jed_locale, array $i18n_map = [])
35
+	{
36
+		$this->domain = $domain;
37
+		$this->jed_locale = $jed_locale;
38
+	}
39 39
 
40
-    /**
41
-     * @param string $handle The script handle reference.
42
-     * @param string $domain The i18n domain for the strings.
43
-     * @deprecated $VID:$
44
-     */
45
-    public function registerScriptI18n($handle, $domain = Domain::TEXT_DOMAIN)
46
-    {
47
-    }
40
+	/**
41
+	 * @param string $handle The script handle reference.
42
+	 * @param string $domain The i18n domain for the strings.
43
+	 * @deprecated $VID:$
44
+	 */
45
+	public function registerScriptI18n($handle, $domain = Domain::TEXT_DOMAIN)
46
+	{
47
+	}
48 48
 
49
-    /**
50
-     * @param array $handles Array of registered script handles.
51
-     * @return array
52
-     * @deprecated $VID:$
53
-     */
54
-    public function queueI18n(array $handles)
55
-    {
56
-        return $handles;
57
-    }
49
+	/**
50
+	 * @param array $handles Array of registered script handles.
51
+	 * @return array
52
+	 * @deprecated $VID:$
53
+	 */
54
+	public function queueI18n(array $handles)
55
+	{
56
+		return $handles;
57
+	}
58 58
 }
Please login to merge, or discard this patch.
core/EE_Dependency_Map.core.php 1 patch
Indentation   +991 added lines, -991 removed lines patch added patch discarded remove patch
@@ -21,995 +21,995 @@
 block discarded – undo
21 21
 class EE_Dependency_Map
22 22
 {
23 23
 
24
-    /**
25
-     * This means that the requested class dependency is not present in the dependency map
26
-     */
27
-    const not_registered = 0;
28
-
29
-    /**
30
-     * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.
31
-     */
32
-    const load_new_object = 1;
33
-
34
-    /**
35
-     * This instructs class loaders to return a previously instantiated and cached object for the requested class.
36
-     * IF a previously instantiated object does not exist, a new one will be created and added to the cache.
37
-     */
38
-    const load_from_cache = 2;
39
-
40
-    /**
41
-     * When registering a dependency,
42
-     * this indicates to keep any existing dependencies that already exist,
43
-     * and simply discard any new dependencies declared in the incoming data
44
-     */
45
-    const KEEP_EXISTING_DEPENDENCIES = 0;
46
-
47
-    /**
48
-     * When registering a dependency,
49
-     * this indicates to overwrite any existing dependencies that already exist using the incoming data
50
-     */
51
-    const OVERWRITE_DEPENDENCIES = 1;
52
-
53
-    /**
54
-     * @type EE_Dependency_Map $_instance
55
-     */
56
-    protected static $_instance;
57
-
58
-    /**
59
-     * @var ClassInterfaceCache $class_cache
60
-     */
61
-    private $class_cache;
62
-
63
-    /**
64
-     * @type RequestInterface $request
65
-     */
66
-    protected $request;
67
-
68
-    /**
69
-     * @type LegacyRequestInterface $legacy_request
70
-     */
71
-    protected $legacy_request;
72
-
73
-    /**
74
-     * @type ResponseInterface $response
75
-     */
76
-    protected $response;
77
-
78
-    /**
79
-     * @type LoaderInterface $loader
80
-     */
81
-    protected $loader;
82
-
83
-    /**
84
-     * @type array $_dependency_map
85
-     */
86
-    protected $_dependency_map = [];
87
-
88
-    /**
89
-     * @type array $_class_loaders
90
-     */
91
-    protected $_class_loaders = [];
92
-
93
-
94
-    /**
95
-     * EE_Dependency_Map constructor.
96
-     *
97
-     * @param ClassInterfaceCache $class_cache
98
-     */
99
-    protected function __construct(ClassInterfaceCache $class_cache)
100
-    {
101
-        $this->class_cache = $class_cache;
102
-        do_action('EE_Dependency_Map____construct', $this);
103
-    }
104
-
105
-
106
-    /**
107
-     * @return void
108
-     * @throws InvalidAliasException
109
-     */
110
-    public function initialize()
111
-    {
112
-        $this->_register_core_dependencies();
113
-        $this->_register_core_class_loaders();
114
-        $this->_register_core_aliases();
115
-    }
116
-
117
-
118
-    /**
119
-     * @singleton method used to instantiate class object
120
-     * @param ClassInterfaceCache|null $class_cache
121
-     * @return EE_Dependency_Map
122
-     */
123
-    public static function instance(ClassInterfaceCache $class_cache = null)
124
-    {
125
-        // check if class object is instantiated, and instantiated properly
126
-        if (! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map
127
-            && $class_cache instanceof ClassInterfaceCache
128
-        ) {
129
-            EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache);
130
-        }
131
-        return EE_Dependency_Map::$_instance;
132
-    }
133
-
134
-
135
-    /**
136
-     * @param RequestInterface $request
137
-     */
138
-    public function setRequest(RequestInterface $request)
139
-    {
140
-        $this->request = $request;
141
-    }
142
-
143
-
144
-    /**
145
-     * @param LegacyRequestInterface $legacy_request
146
-     */
147
-    public function setLegacyRequest(LegacyRequestInterface $legacy_request)
148
-    {
149
-        $this->legacy_request = $legacy_request;
150
-    }
151
-
152
-
153
-    /**
154
-     * @param ResponseInterface $response
155
-     */
156
-    public function setResponse(ResponseInterface $response)
157
-    {
158
-        $this->response = $response;
159
-    }
160
-
161
-
162
-    /**
163
-     * @param LoaderInterface $loader
164
-     */
165
-    public function setLoader(LoaderInterface $loader)
166
-    {
167
-        $this->loader = $loader;
168
-    }
169
-
170
-
171
-    /**
172
-     * @param string $class
173
-     * @param array  $dependencies
174
-     * @param int    $overwrite
175
-     * @return bool
176
-     */
177
-    public static function register_dependencies(
178
-        $class,
179
-        array $dependencies,
180
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
181
-    ) {
182
-        return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite);
183
-    }
184
-
185
-
186
-    /**
187
-     * Assigns an array of class names and corresponding load sources (new or cached)
188
-     * to the class specified by the first parameter.
189
-     * IMPORTANT !!!
190
-     * The order of elements in the incoming $dependencies array MUST match
191
-     * the order of the constructor parameters for the class in question.
192
-     * This is especially important when overriding any existing dependencies that are registered.
193
-     * the third parameter controls whether any duplicate dependencies are overwritten or not.
194
-     *
195
-     * @param string $class
196
-     * @param array  $dependencies
197
-     * @param int    $overwrite
198
-     * @return bool
199
-     */
200
-    public function registerDependencies(
201
-        $class,
202
-        array $dependencies,
203
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
204
-    ) {
205
-        $class = trim($class, '\\');
206
-        $registered = false;
207
-        if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) {
208
-            EE_Dependency_Map::$_instance->_dependency_map[ $class ] = [];
209
-        }
210
-        // we need to make sure that any aliases used when registering a dependency
211
-        // get resolved to the correct class name
212
-        foreach ($dependencies as $dependency => $load_source) {
213
-            $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency);
214
-            if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
215
-                || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ])
216
-            ) {
217
-                unset($dependencies[ $dependency ]);
218
-                $dependencies[ $alias ] = $load_source;
219
-                $registered = true;
220
-            }
221
-        }
222
-        // now add our two lists of dependencies together.
223
-        // using Union (+=) favours the arrays in precedence from left to right,
224
-        // so $dependencies is NOT overwritten because it is listed first
225
-        // ie: with A = B + C, entries in B take precedence over duplicate entries in C
226
-        // Union is way faster than array_merge() but should be used with caution...
227
-        // especially with numerically indexed arrays
228
-        $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ];
229
-        // now we need to ensure that the resulting dependencies
230
-        // array only has the entries that are required for the class
231
-        // so first count how many dependencies were originally registered for the class
232
-        $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]);
233
-        // if that count is non-zero (meaning dependencies were already registered)
234
-        EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count
235
-            // then truncate the  final array to match that count
236
-            ? array_slice($dependencies, 0, $dependency_count)
237
-            // otherwise just take the incoming array because nothing previously existed
238
-            : $dependencies;
239
-        return $registered;
240
-    }
241
-
242
-
243
-    /**
244
-     * @param string $class_name
245
-     * @param string $loader
246
-     * @return bool
247
-     * @throws DomainException
248
-     */
249
-    public static function register_class_loader($class_name, $loader = 'load_core')
250
-    {
251
-        return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader);
252
-    }
253
-
254
-
255
-    /**
256
-     * @param string $class_name
257
-     * @param string $loader
258
-     * @return bool
259
-     * @throws DomainException
260
-     */
261
-    public function registerClassLoader($class_name, $loader = 'load_core')
262
-    {
263
-        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
264
-            throw new DomainException(
265
-                esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
266
-            );
267
-        }
268
-        // check that loader is callable or method starts with "load_" and exists in EE_Registry
269
-        if (! is_callable($loader)
270
-            && (
271
-                strpos($loader, 'load_') !== 0
272
-                || ! method_exists('EE_Registry', $loader)
273
-            )
274
-        ) {
275
-            throw new DomainException(
276
-                sprintf(
277
-                    esc_html__(
278
-                        '"%1$s" is not a valid loader method on EE_Registry.',
279
-                        'event_espresso'
280
-                    ),
281
-                    $loader
282
-                )
283
-            );
284
-        }
285
-        $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name);
286
-        if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) {
287
-            EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader;
288
-            return true;
289
-        }
290
-        return false;
291
-    }
292
-
293
-
294
-    /**
295
-     * @return array
296
-     */
297
-    public function dependency_map()
298
-    {
299
-        return $this->_dependency_map;
300
-    }
301
-
302
-
303
-    /**
304
-     * returns TRUE if dependency map contains a listing for the provided class name
305
-     *
306
-     * @param string $class_name
307
-     * @return boolean
308
-     */
309
-    public function has($class_name = '')
310
-    {
311
-        // all legacy models have the same dependencies
312
-        if (strpos($class_name, 'EEM_') === 0) {
313
-            $class_name = 'LEGACY_MODELS';
314
-        }
315
-        return isset($this->_dependency_map[ $class_name ]);
316
-    }
317
-
318
-
319
-    /**
320
-     * returns TRUE if dependency map contains a listing for the provided class name AND dependency
321
-     *
322
-     * @param string $class_name
323
-     * @param string $dependency
324
-     * @return bool
325
-     */
326
-    public function has_dependency_for_class($class_name = '', $dependency = '')
327
-    {
328
-        // all legacy models have the same dependencies
329
-        if (strpos($class_name, 'EEM_') === 0) {
330
-            $class_name = 'LEGACY_MODELS';
331
-        }
332
-        $dependency = $this->getFqnForAlias($dependency, $class_name);
333
-        return isset($this->_dependency_map[ $class_name ][ $dependency ]);
334
-    }
335
-
336
-
337
-    /**
338
-     * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
339
-     *
340
-     * @param string $class_name
341
-     * @param string $dependency
342
-     * @return int
343
-     */
344
-    public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
345
-    {
346
-        // all legacy models have the same dependencies
347
-        if (strpos($class_name, 'EEM_') === 0) {
348
-            $class_name = 'LEGACY_MODELS';
349
-        }
350
-        $dependency = $this->getFqnForAlias($dependency);
351
-        return $this->has_dependency_for_class($class_name, $dependency)
352
-            ? $this->_dependency_map[ $class_name ][ $dependency ]
353
-            : EE_Dependency_Map::not_registered;
354
-    }
355
-
356
-
357
-    /**
358
-     * @param string $class_name
359
-     * @return string | Closure
360
-     */
361
-    public function class_loader($class_name)
362
-    {
363
-        // all legacy models use load_model()
364
-        if (strpos($class_name, 'EEM_') === 0) {
365
-            return 'load_model';
366
-        }
367
-        // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
368
-        // perform strpos() first to avoid loading regex every time we load a class
369
-        if (strpos($class_name, 'EE_CPT_') === 0
370
-            && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
371
-        ) {
372
-            return 'load_core';
373
-        }
374
-        $class_name = $this->getFqnForAlias($class_name);
375
-        return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
376
-    }
377
-
378
-
379
-    /**
380
-     * @return array
381
-     */
382
-    public function class_loaders()
383
-    {
384
-        return $this->_class_loaders;
385
-    }
386
-
387
-
388
-    /**
389
-     * adds an alias for a classname
390
-     *
391
-     * @param string $fqcn      the class name that should be used (concrete class to replace interface)
392
-     * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
393
-     * @param string $for_class the class that has the dependency (is type hinting for the interface)
394
-     * @throws InvalidAliasException
395
-     */
396
-    public function add_alias($fqcn, $alias, $for_class = '')
397
-    {
398
-        $this->class_cache->addAlias($fqcn, $alias, $for_class);
399
-    }
400
-
401
-
402
-    /**
403
-     * Returns TRUE if the provided fully qualified name IS an alias
404
-     * WHY?
405
-     * Because if a class is type hinting for a concretion,
406
-     * then why would we need to find another class to supply it?
407
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
408
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
409
-     * Don't go looking for some substitute.
410
-     * Whereas if a class is type hinting for an interface...
411
-     * then we need to find an actual class to use.
412
-     * So the interface IS the alias for some other FQN,
413
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
414
-     * represents some other class.
415
-     *
416
-     * @param string $fqn
417
-     * @param string $for_class
418
-     * @return bool
419
-     */
420
-    public function isAlias($fqn = '', $for_class = '')
421
-    {
422
-        return $this->class_cache->isAlias($fqn, $for_class);
423
-    }
424
-
425
-
426
-    /**
427
-     * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
428
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
429
-     *  for example:
430
-     *      if the following two entries were added to the _aliases array:
431
-     *          array(
432
-     *              'interface_alias'           => 'some\namespace\interface'
433
-     *              'some\namespace\interface'  => 'some\namespace\classname'
434
-     *          )
435
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
436
-     *      to load an instance of 'some\namespace\classname'
437
-     *
438
-     * @param string $alias
439
-     * @param string $for_class
440
-     * @return string
441
-     */
442
-    public function getFqnForAlias($alias = '', $for_class = '')
443
-    {
444
-        return (string) $this->class_cache->getFqnForAlias($alias, $for_class);
445
-    }
446
-
447
-
448
-    /**
449
-     * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
450
-     * if one exists, or whether a new object should be generated every time the requested class is loaded.
451
-     * This is done by using the following class constants:
452
-     *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
453
-     *        EE_Dependency_Map::load_new_object - generates a new object every time
454
-     */
455
-    protected function _register_core_dependencies()
456
-    {
457
-        $this->_dependency_map = [
458
-            'EE_Request_Handler'                                                                                          => [
459
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
460
-            ],
461
-            'EE_System'                                                                                                   => [
462
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
463
-                'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
464
-                'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
465
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
466
-                'EventEspresso\core\services\routing\Router'  => EE_Dependency_Map::load_from_cache,
467
-            ],
468
-            'EE_Admin'                                                                                                    => [
469
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
470
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
471
-            ],
472
-            'EE_Cart'                                                                                                     => [
473
-                'EE_Session' => EE_Dependency_Map::load_from_cache,
474
-            ],
475
-            'EE_Messenger_Collection_Loader'                                                                              => [
476
-                'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
477
-            ],
478
-            'EE_Message_Type_Collection_Loader'                                                                           => [
479
-                'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
480
-            ],
481
-            'EE_Message_Resource_Manager'                                                                                 => [
482
-                'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
483
-                'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
484
-                'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
485
-            ],
486
-            'EE_Message_Factory'                                                                                          => [
487
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
488
-            ],
489
-            'EE_messages'                                                                                                 => [
490
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
491
-            ],
492
-            'EE_Messages_Generator'                                                                                       => [
493
-                'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
494
-                'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
495
-                'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
496
-                'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
497
-            ],
498
-            'EE_Messages_Processor'                                                                                       => [
499
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
500
-            ],
501
-            'EE_Messages_Queue'                                                                                           => [
502
-                'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
503
-            ],
504
-            'EE_Messages_Template_Defaults'                                                                               => [
505
-                'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
506
-                'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
507
-            ],
508
-            'EE_Message_To_Generate_From_Request'                                                                         => [
509
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
510
-                'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
511
-            ],
512
-            'EventEspresso\core\services\commands\CommandBus'                                                             => [
513
-                'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
514
-            ],
515
-            'EventEspresso\services\commands\CommandHandler'                                                              => [
516
-                'EE_Registry'         => EE_Dependency_Map::load_from_cache,
517
-                'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
518
-            ],
519
-            'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => [
520
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
521
-            ],
522
-            'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => [
523
-                'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
524
-                'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
525
-            ],
526
-            'EventEspresso\core\services\commands\CommandFactory'                                                         => [
527
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
528
-            ],
529
-            'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => [
530
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
531
-            ],
532
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => [
533
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
534
-            ],
535
-            'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => [
536
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
537
-            ],
538
-            'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => [
539
-                'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
540
-            ],
541
-            'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => [
542
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
543
-            ],
544
-            'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => [
545
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
546
-            ],
547
-            'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => [
548
-                'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
549
-            ],
550
-            'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [
551
-                'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
552
-            ],
553
-            'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => [
554
-                'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
555
-            ],
556
-            'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => [
557
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
558
-            ],
559
-            'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => [
560
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
561
-            ],
562
-            'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => [
563
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
564
-            ],
565
-            'EventEspresso\core\services\database\TableManager'                                                           => [
566
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
567
-            ],
568
-            'EE_Data_Migration_Class_Base'                                                                                => [
569
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
570
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
571
-            ],
572
-            'EE_DMS_Core_4_1_0'                                                                                           => [
573
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
574
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
575
-            ],
576
-            'EE_DMS_Core_4_2_0'                                                                                           => [
577
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
578
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
579
-            ],
580
-            'EE_DMS_Core_4_3_0'                                                                                           => [
581
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
582
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
583
-            ],
584
-            'EE_DMS_Core_4_4_0'                                                                                           => [
585
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
586
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
587
-            ],
588
-            'EE_DMS_Core_4_5_0'                                                                                           => [
589
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
590
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
591
-            ],
592
-            'EE_DMS_Core_4_6_0'                                                                                           => [
593
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
594
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
595
-            ],
596
-            'EE_DMS_Core_4_7_0'                                                                                           => [
597
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
598
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
599
-            ],
600
-            'EE_DMS_Core_4_8_0'                                                                                           => [
601
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
602
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
603
-            ],
604
-            'EE_DMS_Core_4_9_0'                                                                                           => [
605
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
606
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
607
-            ],
608
-            'EE_DMS_Core_4_10_0'                                                                                          => [
609
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
610
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
611
-                'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
612
-            ],
613
-            'EventEspresso\core\services\assets\Registry'                                                                 => [
614
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
615
-                'EventEspresso\core\services\assets\AssetManifest'   => EE_Dependency_Map::load_from_cache,
616
-            ],
617
-            'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
618
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
619
-            ],
620
-            'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
621
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
622
-            ],
623
-            'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
624
-                'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
625
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
626
-            ],
627
-            'EventEspresso\core\domain\values\EmailAddress'                                                               => [
628
-                null,
629
-                'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
630
-            ],
631
-            'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
632
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
633
-            ],
634
-            'LEGACY_MODELS'                                                                                               => [
635
-                null,
636
-                'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
637
-            ],
638
-            'EE_Module_Request_Router'                                                                                    => [
639
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
640
-            ],
641
-            'EE_Registration_Processor'                                                                                   => [
642
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
643
-            ],
644
-            'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
645
-                null,
646
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
647
-                'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
648
-            ],
649
-            'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
650
-                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
651
-                'EE_Session'             => EE_Dependency_Map::load_from_cache,
652
-            ],
653
-            'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
654
-                'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
655
-                'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
656
-                'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
657
-                'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
658
-                'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
659
-            ],
660
-            'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
661
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
662
-            ],
663
-            'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
664
-                'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
665
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
666
-            ],
667
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
668
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
669
-            ],
670
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
671
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
672
-            ],
673
-            'EE_CPT_Strategy'                                                                                             => [
674
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
675
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
676
-            ],
677
-            'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
678
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
679
-            ],
680
-            'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
681
-                null,
682
-                null,
683
-                null,
684
-                'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
685
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
686
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
687
-            ],
688
-            'EventEspresso\core\services\dependencies\DependencyResolver'                                                 => [
689
-                'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
690
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
691
-                'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
692
-            ],
693
-            'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver'                               => [
694
-                'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
695
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
696
-                'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
697
-            ],
698
-            'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'                                          => [
699
-                'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
700
-                'EventEspresso\core\services\loaders\Loader'                                    => EE_Dependency_Map::load_from_cache,
701
-            ],
702
-            'EventEspresso\core\services\routing\RouteMatchSpecificationManager'                                          => [
703
-                'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
704
-                'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
705
-            ],
706
-            'EE_URL_Validation_Strategy'                                                                                  => [
707
-                null,
708
-                null,
709
-                'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
710
-            ],
711
-            'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
712
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
713
-            ],
714
-            'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
715
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
716
-            ],
717
-            'EventEspresso\core\domain\services\converters\RestApiSpoofer'                                                => [
718
-                'WP_REST_Server'                                               => EE_Dependency_Map::load_from_cache,
719
-                'EED_Core_Rest_Api'                                            => EE_Dependency_Map::load_from_cache,
720
-                'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
721
-                null,
722
-            ],
723
-            'EventEspresso\core\services\routing\RouteHandler'                                                            => [
724
-                'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache,
725
-                'EventEspresso\core\services\loaders\Loader'           => EE_Dependency_Map::load_from_cache,
726
-                'EventEspresso\core\services\request\Request'          => EE_Dependency_Map::load_from_cache,
727
-                'EventEspresso\core\services\routing\RouteCollection'  => EE_Dependency_Map::load_from_cache,
728
-            ],
729
-            'EventEspresso\core\services\json\JsonDataNodeHandler'                                                        => [
730
-                'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
731
-            ],
732
-            'EventEspresso\core\services\routing\Router'                                                                  => [
733
-                'EE_Dependency_Map'                                => EE_Dependency_Map::load_from_cache,
734
-                'EventEspresso\core\services\loaders\Loader'       => EE_Dependency_Map::load_from_cache,
735
-                'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache,
736
-            ],
737
-            'EventEspresso\core\services\assets\AssetManifest' => [
738
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
739
-            ],
740
-            'EventEspresso\core\services\assets\AssetManifestFactory' => [
741
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
742
-            ],
743
-            'EventEspresso\core\services\assets\BaristaFactory' => [
744
-                'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache,
745
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
746
-            ],
747
-        ];
748
-    }
749
-
750
-
751
-    /**
752
-     * Registers how core classes are loaded.
753
-     * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
754
-     *        'EE_Request_Handler' => 'load_core'
755
-     *        'EE_Messages_Queue'  => 'load_lib'
756
-     *        'EEH_Debug_Tools'    => 'load_helper'
757
-     * or, if greater control is required, by providing a custom closure. For example:
758
-     *        'Some_Class' => function () {
759
-     *            return new Some_Class();
760
-     *        },
761
-     * This is required for instantiating dependencies
762
-     * where an interface has been type hinted in a class constructor. For example:
763
-     *        'Required_Interface' => function () {
764
-     *            return new A_Class_That_Implements_Required_Interface();
765
-     *        },
766
-     */
767
-    protected function _register_core_class_loaders()
768
-    {
769
-        $this->_class_loaders = [
770
-            // load_core
771
-            'EE_Dependency_Map'                            => function () {
772
-                return $this;
773
-            },
774
-            'EE_Capabilities'                              => 'load_core',
775
-            'EE_Encryption'                                => 'load_core',
776
-            'EE_Front_Controller'                          => 'load_core',
777
-            'EE_Module_Request_Router'                     => 'load_core',
778
-            'EE_Registry'                                  => 'load_core',
779
-            'EE_Request'                                   => function () {
780
-                return $this->legacy_request;
781
-            },
782
-            'EventEspresso\core\services\request\Request'  => function () {
783
-                return $this->request;
784
-            },
785
-            'EventEspresso\core\services\request\Response' => function () {
786
-                return $this->response;
787
-            },
788
-            'EE_Base'                                      => 'load_core',
789
-            'EE_Request_Handler'                           => 'load_core',
790
-            'EE_Session'                                   => 'load_core',
791
-            'EE_Cron_Tasks'                                => 'load_core',
792
-            'EE_System'                                    => 'load_core',
793
-            'EE_Maintenance_Mode'                          => 'load_core',
794
-            'EE_Register_CPTs'                             => 'load_core',
795
-            'EE_Admin'                                     => 'load_core',
796
-            'EE_CPT_Strategy'                              => 'load_core',
797
-            // load_class
798
-            'EE_Registration_Processor'                    => 'load_class',
799
-            // load_lib
800
-            'EE_Message_Resource_Manager'                  => 'load_lib',
801
-            'EE_Message_Type_Collection'                   => 'load_lib',
802
-            'EE_Message_Type_Collection_Loader'            => 'load_lib',
803
-            'EE_Messenger_Collection'                      => 'load_lib',
804
-            'EE_Messenger_Collection_Loader'               => 'load_lib',
805
-            'EE_Messages_Processor'                        => 'load_lib',
806
-            'EE_Message_Repository'                        => 'load_lib',
807
-            'EE_Messages_Queue'                            => 'load_lib',
808
-            'EE_Messages_Data_Handler_Collection'          => 'load_lib',
809
-            'EE_Message_Template_Group_Collection'         => 'load_lib',
810
-            'EE_Payment_Method_Manager'                    => 'load_lib',
811
-            'EE_DMS_Core_4_1_0'                            => 'load_dms',
812
-            'EE_DMS_Core_4_2_0'                            => 'load_dms',
813
-            'EE_DMS_Core_4_3_0'                            => 'load_dms',
814
-            'EE_DMS_Core_4_5_0'                            => 'load_dms',
815
-            'EE_DMS_Core_4_6_0'                            => 'load_dms',
816
-            'EE_DMS_Core_4_7_0'                            => 'load_dms',
817
-            'EE_DMS_Core_4_8_0'                            => 'load_dms',
818
-            'EE_DMS_Core_4_9_0'                            => 'load_dms',
819
-            'EE_DMS_Core_4_10_0'                           => 'load_dms',
820
-            'EE_Messages_Generator'                        => static function () {
821
-                return EE_Registry::instance()->load_lib(
822
-                    'Messages_Generator',
823
-                    [],
824
-                    false,
825
-                    false
826
-                );
827
-            },
828
-            'EE_Messages_Template_Defaults'                => static function ($arguments = []) {
829
-                return EE_Registry::instance()->load_lib(
830
-                    'Messages_Template_Defaults',
831
-                    $arguments,
832
-                    false,
833
-                    false
834
-                );
835
-            },
836
-            // load_helper
837
-            'EEH_Parse_Shortcodes'                         => static function () {
838
-                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
839
-                    return new EEH_Parse_Shortcodes();
840
-                }
841
-                return null;
842
-            },
843
-            'EE_Template_Config'                           => static function () {
844
-                return EE_Config::instance()->template_settings;
845
-            },
846
-            'EE_Currency_Config'                           => static function () {
847
-                return EE_Config::instance()->currency;
848
-            },
849
-            'EE_Registration_Config'                       => static function () {
850
-                return EE_Config::instance()->registration;
851
-            },
852
-            'EE_Core_Config'                               => static function () {
853
-                return EE_Config::instance()->core;
854
-            },
855
-            'EventEspresso\core\services\loaders\Loader'   => static function () {
856
-                return LoaderFactory::getLoader();
857
-            },
858
-            'EE_Network_Config'                            => static function () {
859
-                return EE_Network_Config::instance();
860
-            },
861
-            'EE_Config'                                    => static function () {
862
-                return EE_Config::instance();
863
-            },
864
-            'EventEspresso\core\domain\Domain'             => static function () {
865
-                return DomainFactory::getEventEspressoCoreDomain();
866
-            },
867
-            'EE_Admin_Config'                              => static function () {
868
-                return EE_Config::instance()->admin;
869
-            },
870
-            'EE_Organization_Config'                       => static function () {
871
-                return EE_Config::instance()->organization;
872
-            },
873
-            'EE_Network_Core_Config'                       => static function () {
874
-                return EE_Network_Config::instance()->core;
875
-            },
876
-            'EE_Environment_Config'                        => static function () {
877
-                return EE_Config::instance()->environment;
878
-            },
879
-            'EED_Core_Rest_Api'                            => static function () {
880
-                return EED_Core_Rest_Api::instance();
881
-            },
882
-            'WP_REST_Server'                               => static function () {
883
-                return rest_get_server();
884
-            },
885
-        ];
886
-    }
887
-
888
-
889
-    /**
890
-     * can be used for supplying alternate names for classes,
891
-     * or for connecting interface names to instantiable classes
892
-     *
893
-     * @throws InvalidAliasException
894
-     */
895
-    protected function _register_core_aliases()
896
-    {
897
-        $aliases = [
898
-            'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
899
-            'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
900
-            'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
901
-            'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
902
-            'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
903
-            'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
904
-            'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
905
-            'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
906
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
907
-            'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
908
-            'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
909
-            'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
910
-            'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
911
-            'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
912
-            'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
913
-            'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
914
-            'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
915
-            'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
916
-            'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
917
-            'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
918
-            'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
919
-            'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
920
-            'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
921
-            'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
922
-            'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
923
-            'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
924
-            'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
925
-            'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
926
-            'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
927
-            'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
928
-            'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
929
-            'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
930
-            'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
931
-            'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
932
-            'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
933
-            'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
934
-            'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
935
-            'Registration_Processor'                                                       => 'EE_Registration_Processor',
936
-            'EventEspresso\core\services\assets\AssetManifestInterface'                    => 'EventEspresso\core\services\assets\AssetManifest',
937
-        ];
938
-        foreach ($aliases as $alias => $fqn) {
939
-            if (is_array($fqn)) {
940
-                foreach ($fqn as $class => $for_class) {
941
-                    $this->class_cache->addAlias($class, $alias, $for_class);
942
-                }
943
-                continue;
944
-            }
945
-            $this->class_cache->addAlias($fqn, $alias);
946
-        }
947
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
948
-            $this->class_cache->addAlias(
949
-                'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
950
-                'EventEspresso\core\services\notices\NoticeConverterInterface'
951
-            );
952
-        }
953
-    }
954
-
955
-
956
-    /**
957
-     * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
958
-     * request Primarily used by unit tests.
959
-     */
960
-    public function reset()
961
-    {
962
-        $this->_register_core_class_loaders();
963
-        $this->_register_core_dependencies();
964
-    }
965
-
966
-
967
-    /**
968
-     * PLZ NOTE: a better name for this method would be is_alias()
969
-     * because it returns TRUE if the provided fully qualified name IS an alias
970
-     * WHY?
971
-     * Because if a class is type hinting for a concretion,
972
-     * then why would we need to find another class to supply it?
973
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
974
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
975
-     * Don't go looking for some substitute.
976
-     * Whereas if a class is type hinting for an interface...
977
-     * then we need to find an actual class to use.
978
-     * So the interface IS the alias for some other FQN,
979
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
980
-     * represents some other class.
981
-     *
982
-     * @param string $fqn
983
-     * @param string $for_class
984
-     * @return bool
985
-     * @deprecated 4.9.62.p
986
-     */
987
-    public function has_alias($fqn = '', $for_class = '')
988
-    {
989
-        return $this->isAlias($fqn, $for_class);
990
-    }
991
-
992
-
993
-    /**
994
-     * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
995
-     * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
996
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
997
-     *  for example:
998
-     *      if the following two entries were added to the _aliases array:
999
-     *          array(
1000
-     *              'interface_alias'           => 'some\namespace\interface'
1001
-     *              'some\namespace\interface'  => 'some\namespace\classname'
1002
-     *          )
1003
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1004
-     *      to load an instance of 'some\namespace\classname'
1005
-     *
1006
-     * @param string $alias
1007
-     * @param string $for_class
1008
-     * @return string
1009
-     * @deprecated 4.9.62.p
1010
-     */
1011
-    public function get_alias($alias = '', $for_class = '')
1012
-    {
1013
-        return $this->getFqnForAlias($alias, $for_class);
1014
-    }
24
+	/**
25
+	 * This means that the requested class dependency is not present in the dependency map
26
+	 */
27
+	const not_registered = 0;
28
+
29
+	/**
30
+	 * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.
31
+	 */
32
+	const load_new_object = 1;
33
+
34
+	/**
35
+	 * This instructs class loaders to return a previously instantiated and cached object for the requested class.
36
+	 * IF a previously instantiated object does not exist, a new one will be created and added to the cache.
37
+	 */
38
+	const load_from_cache = 2;
39
+
40
+	/**
41
+	 * When registering a dependency,
42
+	 * this indicates to keep any existing dependencies that already exist,
43
+	 * and simply discard any new dependencies declared in the incoming data
44
+	 */
45
+	const KEEP_EXISTING_DEPENDENCIES = 0;
46
+
47
+	/**
48
+	 * When registering a dependency,
49
+	 * this indicates to overwrite any existing dependencies that already exist using the incoming data
50
+	 */
51
+	const OVERWRITE_DEPENDENCIES = 1;
52
+
53
+	/**
54
+	 * @type EE_Dependency_Map $_instance
55
+	 */
56
+	protected static $_instance;
57
+
58
+	/**
59
+	 * @var ClassInterfaceCache $class_cache
60
+	 */
61
+	private $class_cache;
62
+
63
+	/**
64
+	 * @type RequestInterface $request
65
+	 */
66
+	protected $request;
67
+
68
+	/**
69
+	 * @type LegacyRequestInterface $legacy_request
70
+	 */
71
+	protected $legacy_request;
72
+
73
+	/**
74
+	 * @type ResponseInterface $response
75
+	 */
76
+	protected $response;
77
+
78
+	/**
79
+	 * @type LoaderInterface $loader
80
+	 */
81
+	protected $loader;
82
+
83
+	/**
84
+	 * @type array $_dependency_map
85
+	 */
86
+	protected $_dependency_map = [];
87
+
88
+	/**
89
+	 * @type array $_class_loaders
90
+	 */
91
+	protected $_class_loaders = [];
92
+
93
+
94
+	/**
95
+	 * EE_Dependency_Map constructor.
96
+	 *
97
+	 * @param ClassInterfaceCache $class_cache
98
+	 */
99
+	protected function __construct(ClassInterfaceCache $class_cache)
100
+	{
101
+		$this->class_cache = $class_cache;
102
+		do_action('EE_Dependency_Map____construct', $this);
103
+	}
104
+
105
+
106
+	/**
107
+	 * @return void
108
+	 * @throws InvalidAliasException
109
+	 */
110
+	public function initialize()
111
+	{
112
+		$this->_register_core_dependencies();
113
+		$this->_register_core_class_loaders();
114
+		$this->_register_core_aliases();
115
+	}
116
+
117
+
118
+	/**
119
+	 * @singleton method used to instantiate class object
120
+	 * @param ClassInterfaceCache|null $class_cache
121
+	 * @return EE_Dependency_Map
122
+	 */
123
+	public static function instance(ClassInterfaceCache $class_cache = null)
124
+	{
125
+		// check if class object is instantiated, and instantiated properly
126
+		if (! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map
127
+			&& $class_cache instanceof ClassInterfaceCache
128
+		) {
129
+			EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache);
130
+		}
131
+		return EE_Dependency_Map::$_instance;
132
+	}
133
+
134
+
135
+	/**
136
+	 * @param RequestInterface $request
137
+	 */
138
+	public function setRequest(RequestInterface $request)
139
+	{
140
+		$this->request = $request;
141
+	}
142
+
143
+
144
+	/**
145
+	 * @param LegacyRequestInterface $legacy_request
146
+	 */
147
+	public function setLegacyRequest(LegacyRequestInterface $legacy_request)
148
+	{
149
+		$this->legacy_request = $legacy_request;
150
+	}
151
+
152
+
153
+	/**
154
+	 * @param ResponseInterface $response
155
+	 */
156
+	public function setResponse(ResponseInterface $response)
157
+	{
158
+		$this->response = $response;
159
+	}
160
+
161
+
162
+	/**
163
+	 * @param LoaderInterface $loader
164
+	 */
165
+	public function setLoader(LoaderInterface $loader)
166
+	{
167
+		$this->loader = $loader;
168
+	}
169
+
170
+
171
+	/**
172
+	 * @param string $class
173
+	 * @param array  $dependencies
174
+	 * @param int    $overwrite
175
+	 * @return bool
176
+	 */
177
+	public static function register_dependencies(
178
+		$class,
179
+		array $dependencies,
180
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
181
+	) {
182
+		return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite);
183
+	}
184
+
185
+
186
+	/**
187
+	 * Assigns an array of class names and corresponding load sources (new or cached)
188
+	 * to the class specified by the first parameter.
189
+	 * IMPORTANT !!!
190
+	 * The order of elements in the incoming $dependencies array MUST match
191
+	 * the order of the constructor parameters for the class in question.
192
+	 * This is especially important when overriding any existing dependencies that are registered.
193
+	 * the third parameter controls whether any duplicate dependencies are overwritten or not.
194
+	 *
195
+	 * @param string $class
196
+	 * @param array  $dependencies
197
+	 * @param int    $overwrite
198
+	 * @return bool
199
+	 */
200
+	public function registerDependencies(
201
+		$class,
202
+		array $dependencies,
203
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
204
+	) {
205
+		$class = trim($class, '\\');
206
+		$registered = false;
207
+		if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) {
208
+			EE_Dependency_Map::$_instance->_dependency_map[ $class ] = [];
209
+		}
210
+		// we need to make sure that any aliases used when registering a dependency
211
+		// get resolved to the correct class name
212
+		foreach ($dependencies as $dependency => $load_source) {
213
+			$alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency);
214
+			if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
215
+				|| ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ])
216
+			) {
217
+				unset($dependencies[ $dependency ]);
218
+				$dependencies[ $alias ] = $load_source;
219
+				$registered = true;
220
+			}
221
+		}
222
+		// now add our two lists of dependencies together.
223
+		// using Union (+=) favours the arrays in precedence from left to right,
224
+		// so $dependencies is NOT overwritten because it is listed first
225
+		// ie: with A = B + C, entries in B take precedence over duplicate entries in C
226
+		// Union is way faster than array_merge() but should be used with caution...
227
+		// especially with numerically indexed arrays
228
+		$dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ];
229
+		// now we need to ensure that the resulting dependencies
230
+		// array only has the entries that are required for the class
231
+		// so first count how many dependencies were originally registered for the class
232
+		$dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]);
233
+		// if that count is non-zero (meaning dependencies were already registered)
234
+		EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count
235
+			// then truncate the  final array to match that count
236
+			? array_slice($dependencies, 0, $dependency_count)
237
+			// otherwise just take the incoming array because nothing previously existed
238
+			: $dependencies;
239
+		return $registered;
240
+	}
241
+
242
+
243
+	/**
244
+	 * @param string $class_name
245
+	 * @param string $loader
246
+	 * @return bool
247
+	 * @throws DomainException
248
+	 */
249
+	public static function register_class_loader($class_name, $loader = 'load_core')
250
+	{
251
+		return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader);
252
+	}
253
+
254
+
255
+	/**
256
+	 * @param string $class_name
257
+	 * @param string $loader
258
+	 * @return bool
259
+	 * @throws DomainException
260
+	 */
261
+	public function registerClassLoader($class_name, $loader = 'load_core')
262
+	{
263
+		if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
264
+			throw new DomainException(
265
+				esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
266
+			);
267
+		}
268
+		// check that loader is callable or method starts with "load_" and exists in EE_Registry
269
+		if (! is_callable($loader)
270
+			&& (
271
+				strpos($loader, 'load_') !== 0
272
+				|| ! method_exists('EE_Registry', $loader)
273
+			)
274
+		) {
275
+			throw new DomainException(
276
+				sprintf(
277
+					esc_html__(
278
+						'"%1$s" is not a valid loader method on EE_Registry.',
279
+						'event_espresso'
280
+					),
281
+					$loader
282
+				)
283
+			);
284
+		}
285
+		$class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name);
286
+		if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) {
287
+			EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader;
288
+			return true;
289
+		}
290
+		return false;
291
+	}
292
+
293
+
294
+	/**
295
+	 * @return array
296
+	 */
297
+	public function dependency_map()
298
+	{
299
+		return $this->_dependency_map;
300
+	}
301
+
302
+
303
+	/**
304
+	 * returns TRUE if dependency map contains a listing for the provided class name
305
+	 *
306
+	 * @param string $class_name
307
+	 * @return boolean
308
+	 */
309
+	public function has($class_name = '')
310
+	{
311
+		// all legacy models have the same dependencies
312
+		if (strpos($class_name, 'EEM_') === 0) {
313
+			$class_name = 'LEGACY_MODELS';
314
+		}
315
+		return isset($this->_dependency_map[ $class_name ]);
316
+	}
317
+
318
+
319
+	/**
320
+	 * returns TRUE if dependency map contains a listing for the provided class name AND dependency
321
+	 *
322
+	 * @param string $class_name
323
+	 * @param string $dependency
324
+	 * @return bool
325
+	 */
326
+	public function has_dependency_for_class($class_name = '', $dependency = '')
327
+	{
328
+		// all legacy models have the same dependencies
329
+		if (strpos($class_name, 'EEM_') === 0) {
330
+			$class_name = 'LEGACY_MODELS';
331
+		}
332
+		$dependency = $this->getFqnForAlias($dependency, $class_name);
333
+		return isset($this->_dependency_map[ $class_name ][ $dependency ]);
334
+	}
335
+
336
+
337
+	/**
338
+	 * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
339
+	 *
340
+	 * @param string $class_name
341
+	 * @param string $dependency
342
+	 * @return int
343
+	 */
344
+	public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
345
+	{
346
+		// all legacy models have the same dependencies
347
+		if (strpos($class_name, 'EEM_') === 0) {
348
+			$class_name = 'LEGACY_MODELS';
349
+		}
350
+		$dependency = $this->getFqnForAlias($dependency);
351
+		return $this->has_dependency_for_class($class_name, $dependency)
352
+			? $this->_dependency_map[ $class_name ][ $dependency ]
353
+			: EE_Dependency_Map::not_registered;
354
+	}
355
+
356
+
357
+	/**
358
+	 * @param string $class_name
359
+	 * @return string | Closure
360
+	 */
361
+	public function class_loader($class_name)
362
+	{
363
+		// all legacy models use load_model()
364
+		if (strpos($class_name, 'EEM_') === 0) {
365
+			return 'load_model';
366
+		}
367
+		// EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
368
+		// perform strpos() first to avoid loading regex every time we load a class
369
+		if (strpos($class_name, 'EE_CPT_') === 0
370
+			&& preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
371
+		) {
372
+			return 'load_core';
373
+		}
374
+		$class_name = $this->getFqnForAlias($class_name);
375
+		return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
376
+	}
377
+
378
+
379
+	/**
380
+	 * @return array
381
+	 */
382
+	public function class_loaders()
383
+	{
384
+		return $this->_class_loaders;
385
+	}
386
+
387
+
388
+	/**
389
+	 * adds an alias for a classname
390
+	 *
391
+	 * @param string $fqcn      the class name that should be used (concrete class to replace interface)
392
+	 * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
393
+	 * @param string $for_class the class that has the dependency (is type hinting for the interface)
394
+	 * @throws InvalidAliasException
395
+	 */
396
+	public function add_alias($fqcn, $alias, $for_class = '')
397
+	{
398
+		$this->class_cache->addAlias($fqcn, $alias, $for_class);
399
+	}
400
+
401
+
402
+	/**
403
+	 * Returns TRUE if the provided fully qualified name IS an alias
404
+	 * WHY?
405
+	 * Because if a class is type hinting for a concretion,
406
+	 * then why would we need to find another class to supply it?
407
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
408
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
409
+	 * Don't go looking for some substitute.
410
+	 * Whereas if a class is type hinting for an interface...
411
+	 * then we need to find an actual class to use.
412
+	 * So the interface IS the alias for some other FQN,
413
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
414
+	 * represents some other class.
415
+	 *
416
+	 * @param string $fqn
417
+	 * @param string $for_class
418
+	 * @return bool
419
+	 */
420
+	public function isAlias($fqn = '', $for_class = '')
421
+	{
422
+		return $this->class_cache->isAlias($fqn, $for_class);
423
+	}
424
+
425
+
426
+	/**
427
+	 * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
428
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
429
+	 *  for example:
430
+	 *      if the following two entries were added to the _aliases array:
431
+	 *          array(
432
+	 *              'interface_alias'           => 'some\namespace\interface'
433
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
434
+	 *          )
435
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
436
+	 *      to load an instance of 'some\namespace\classname'
437
+	 *
438
+	 * @param string $alias
439
+	 * @param string $for_class
440
+	 * @return string
441
+	 */
442
+	public function getFqnForAlias($alias = '', $for_class = '')
443
+	{
444
+		return (string) $this->class_cache->getFqnForAlias($alias, $for_class);
445
+	}
446
+
447
+
448
+	/**
449
+	 * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
450
+	 * if one exists, or whether a new object should be generated every time the requested class is loaded.
451
+	 * This is done by using the following class constants:
452
+	 *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
453
+	 *        EE_Dependency_Map::load_new_object - generates a new object every time
454
+	 */
455
+	protected function _register_core_dependencies()
456
+	{
457
+		$this->_dependency_map = [
458
+			'EE_Request_Handler'                                                                                          => [
459
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
460
+			],
461
+			'EE_System'                                                                                                   => [
462
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
463
+				'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
464
+				'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
465
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
466
+				'EventEspresso\core\services\routing\Router'  => EE_Dependency_Map::load_from_cache,
467
+			],
468
+			'EE_Admin'                                                                                                    => [
469
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
470
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
471
+			],
472
+			'EE_Cart'                                                                                                     => [
473
+				'EE_Session' => EE_Dependency_Map::load_from_cache,
474
+			],
475
+			'EE_Messenger_Collection_Loader'                                                                              => [
476
+				'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
477
+			],
478
+			'EE_Message_Type_Collection_Loader'                                                                           => [
479
+				'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
480
+			],
481
+			'EE_Message_Resource_Manager'                                                                                 => [
482
+				'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
483
+				'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
484
+				'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
485
+			],
486
+			'EE_Message_Factory'                                                                                          => [
487
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
488
+			],
489
+			'EE_messages'                                                                                                 => [
490
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
491
+			],
492
+			'EE_Messages_Generator'                                                                                       => [
493
+				'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
494
+				'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
495
+				'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
496
+				'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
497
+			],
498
+			'EE_Messages_Processor'                                                                                       => [
499
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
500
+			],
501
+			'EE_Messages_Queue'                                                                                           => [
502
+				'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
503
+			],
504
+			'EE_Messages_Template_Defaults'                                                                               => [
505
+				'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
506
+				'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
507
+			],
508
+			'EE_Message_To_Generate_From_Request'                                                                         => [
509
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
510
+				'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
511
+			],
512
+			'EventEspresso\core\services\commands\CommandBus'                                                             => [
513
+				'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
514
+			],
515
+			'EventEspresso\services\commands\CommandHandler'                                                              => [
516
+				'EE_Registry'         => EE_Dependency_Map::load_from_cache,
517
+				'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
518
+			],
519
+			'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => [
520
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
521
+			],
522
+			'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => [
523
+				'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
524
+				'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
525
+			],
526
+			'EventEspresso\core\services\commands\CommandFactory'                                                         => [
527
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
528
+			],
529
+			'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => [
530
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
531
+			],
532
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => [
533
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
534
+			],
535
+			'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => [
536
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
537
+			],
538
+			'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => [
539
+				'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
540
+			],
541
+			'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => [
542
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
543
+			],
544
+			'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => [
545
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
546
+			],
547
+			'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => [
548
+				'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
549
+			],
550
+			'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [
551
+				'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
552
+			],
553
+			'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => [
554
+				'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
555
+			],
556
+			'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => [
557
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
558
+			],
559
+			'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => [
560
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
561
+			],
562
+			'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => [
563
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
564
+			],
565
+			'EventEspresso\core\services\database\TableManager'                                                           => [
566
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
567
+			],
568
+			'EE_Data_Migration_Class_Base'                                                                                => [
569
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
570
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
571
+			],
572
+			'EE_DMS_Core_4_1_0'                                                                                           => [
573
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
574
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
575
+			],
576
+			'EE_DMS_Core_4_2_0'                                                                                           => [
577
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
578
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
579
+			],
580
+			'EE_DMS_Core_4_3_0'                                                                                           => [
581
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
582
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
583
+			],
584
+			'EE_DMS_Core_4_4_0'                                                                                           => [
585
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
586
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
587
+			],
588
+			'EE_DMS_Core_4_5_0'                                                                                           => [
589
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
590
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
591
+			],
592
+			'EE_DMS_Core_4_6_0'                                                                                           => [
593
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
594
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
595
+			],
596
+			'EE_DMS_Core_4_7_0'                                                                                           => [
597
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
598
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
599
+			],
600
+			'EE_DMS_Core_4_8_0'                                                                                           => [
601
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
602
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
603
+			],
604
+			'EE_DMS_Core_4_9_0'                                                                                           => [
605
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
606
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
607
+			],
608
+			'EE_DMS_Core_4_10_0'                                                                                          => [
609
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
610
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
611
+				'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
612
+			],
613
+			'EventEspresso\core\services\assets\Registry'                                                                 => [
614
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
615
+				'EventEspresso\core\services\assets\AssetManifest'   => EE_Dependency_Map::load_from_cache,
616
+			],
617
+			'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
618
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
619
+			],
620
+			'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
621
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
622
+			],
623
+			'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
624
+				'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
625
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
626
+			],
627
+			'EventEspresso\core\domain\values\EmailAddress'                                                               => [
628
+				null,
629
+				'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
630
+			],
631
+			'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
632
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
633
+			],
634
+			'LEGACY_MODELS'                                                                                               => [
635
+				null,
636
+				'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
637
+			],
638
+			'EE_Module_Request_Router'                                                                                    => [
639
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
640
+			],
641
+			'EE_Registration_Processor'                                                                                   => [
642
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
643
+			],
644
+			'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
645
+				null,
646
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
647
+				'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
648
+			],
649
+			'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
650
+				'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
651
+				'EE_Session'             => EE_Dependency_Map::load_from_cache,
652
+			],
653
+			'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
654
+				'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
655
+				'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
656
+				'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
657
+				'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
658
+				'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
659
+			],
660
+			'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
661
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
662
+			],
663
+			'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
664
+				'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
665
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
666
+			],
667
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
668
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
669
+			],
670
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
671
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
672
+			],
673
+			'EE_CPT_Strategy'                                                                                             => [
674
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
675
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
676
+			],
677
+			'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
678
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
679
+			],
680
+			'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
681
+				null,
682
+				null,
683
+				null,
684
+				'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
685
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
686
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
687
+			],
688
+			'EventEspresso\core\services\dependencies\DependencyResolver'                                                 => [
689
+				'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
690
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
691
+				'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
692
+			],
693
+			'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver'                               => [
694
+				'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
695
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
696
+				'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
697
+			],
698
+			'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'                                          => [
699
+				'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
700
+				'EventEspresso\core\services\loaders\Loader'                                    => EE_Dependency_Map::load_from_cache,
701
+			],
702
+			'EventEspresso\core\services\routing\RouteMatchSpecificationManager'                                          => [
703
+				'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
704
+				'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
705
+			],
706
+			'EE_URL_Validation_Strategy'                                                                                  => [
707
+				null,
708
+				null,
709
+				'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
710
+			],
711
+			'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
712
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
713
+			],
714
+			'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
715
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
716
+			],
717
+			'EventEspresso\core\domain\services\converters\RestApiSpoofer'                                                => [
718
+				'WP_REST_Server'                                               => EE_Dependency_Map::load_from_cache,
719
+				'EED_Core_Rest_Api'                                            => EE_Dependency_Map::load_from_cache,
720
+				'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
721
+				null,
722
+			],
723
+			'EventEspresso\core\services\routing\RouteHandler'                                                            => [
724
+				'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache,
725
+				'EventEspresso\core\services\loaders\Loader'           => EE_Dependency_Map::load_from_cache,
726
+				'EventEspresso\core\services\request\Request'          => EE_Dependency_Map::load_from_cache,
727
+				'EventEspresso\core\services\routing\RouteCollection'  => EE_Dependency_Map::load_from_cache,
728
+			],
729
+			'EventEspresso\core\services\json\JsonDataNodeHandler'                                                        => [
730
+				'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
731
+			],
732
+			'EventEspresso\core\services\routing\Router'                                                                  => [
733
+				'EE_Dependency_Map'                                => EE_Dependency_Map::load_from_cache,
734
+				'EventEspresso\core\services\loaders\Loader'       => EE_Dependency_Map::load_from_cache,
735
+				'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache,
736
+			],
737
+			'EventEspresso\core\services\assets\AssetManifest' => [
738
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
739
+			],
740
+			'EventEspresso\core\services\assets\AssetManifestFactory' => [
741
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
742
+			],
743
+			'EventEspresso\core\services\assets\BaristaFactory' => [
744
+				'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache,
745
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
746
+			],
747
+		];
748
+	}
749
+
750
+
751
+	/**
752
+	 * Registers how core classes are loaded.
753
+	 * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
754
+	 *        'EE_Request_Handler' => 'load_core'
755
+	 *        'EE_Messages_Queue'  => 'load_lib'
756
+	 *        'EEH_Debug_Tools'    => 'load_helper'
757
+	 * or, if greater control is required, by providing a custom closure. For example:
758
+	 *        'Some_Class' => function () {
759
+	 *            return new Some_Class();
760
+	 *        },
761
+	 * This is required for instantiating dependencies
762
+	 * where an interface has been type hinted in a class constructor. For example:
763
+	 *        'Required_Interface' => function () {
764
+	 *            return new A_Class_That_Implements_Required_Interface();
765
+	 *        },
766
+	 */
767
+	protected function _register_core_class_loaders()
768
+	{
769
+		$this->_class_loaders = [
770
+			// load_core
771
+			'EE_Dependency_Map'                            => function () {
772
+				return $this;
773
+			},
774
+			'EE_Capabilities'                              => 'load_core',
775
+			'EE_Encryption'                                => 'load_core',
776
+			'EE_Front_Controller'                          => 'load_core',
777
+			'EE_Module_Request_Router'                     => 'load_core',
778
+			'EE_Registry'                                  => 'load_core',
779
+			'EE_Request'                                   => function () {
780
+				return $this->legacy_request;
781
+			},
782
+			'EventEspresso\core\services\request\Request'  => function () {
783
+				return $this->request;
784
+			},
785
+			'EventEspresso\core\services\request\Response' => function () {
786
+				return $this->response;
787
+			},
788
+			'EE_Base'                                      => 'load_core',
789
+			'EE_Request_Handler'                           => 'load_core',
790
+			'EE_Session'                                   => 'load_core',
791
+			'EE_Cron_Tasks'                                => 'load_core',
792
+			'EE_System'                                    => 'load_core',
793
+			'EE_Maintenance_Mode'                          => 'load_core',
794
+			'EE_Register_CPTs'                             => 'load_core',
795
+			'EE_Admin'                                     => 'load_core',
796
+			'EE_CPT_Strategy'                              => 'load_core',
797
+			// load_class
798
+			'EE_Registration_Processor'                    => 'load_class',
799
+			// load_lib
800
+			'EE_Message_Resource_Manager'                  => 'load_lib',
801
+			'EE_Message_Type_Collection'                   => 'load_lib',
802
+			'EE_Message_Type_Collection_Loader'            => 'load_lib',
803
+			'EE_Messenger_Collection'                      => 'load_lib',
804
+			'EE_Messenger_Collection_Loader'               => 'load_lib',
805
+			'EE_Messages_Processor'                        => 'load_lib',
806
+			'EE_Message_Repository'                        => 'load_lib',
807
+			'EE_Messages_Queue'                            => 'load_lib',
808
+			'EE_Messages_Data_Handler_Collection'          => 'load_lib',
809
+			'EE_Message_Template_Group_Collection'         => 'load_lib',
810
+			'EE_Payment_Method_Manager'                    => 'load_lib',
811
+			'EE_DMS_Core_4_1_0'                            => 'load_dms',
812
+			'EE_DMS_Core_4_2_0'                            => 'load_dms',
813
+			'EE_DMS_Core_4_3_0'                            => 'load_dms',
814
+			'EE_DMS_Core_4_5_0'                            => 'load_dms',
815
+			'EE_DMS_Core_4_6_0'                            => 'load_dms',
816
+			'EE_DMS_Core_4_7_0'                            => 'load_dms',
817
+			'EE_DMS_Core_4_8_0'                            => 'load_dms',
818
+			'EE_DMS_Core_4_9_0'                            => 'load_dms',
819
+			'EE_DMS_Core_4_10_0'                           => 'load_dms',
820
+			'EE_Messages_Generator'                        => static function () {
821
+				return EE_Registry::instance()->load_lib(
822
+					'Messages_Generator',
823
+					[],
824
+					false,
825
+					false
826
+				);
827
+			},
828
+			'EE_Messages_Template_Defaults'                => static function ($arguments = []) {
829
+				return EE_Registry::instance()->load_lib(
830
+					'Messages_Template_Defaults',
831
+					$arguments,
832
+					false,
833
+					false
834
+				);
835
+			},
836
+			// load_helper
837
+			'EEH_Parse_Shortcodes'                         => static function () {
838
+				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
839
+					return new EEH_Parse_Shortcodes();
840
+				}
841
+				return null;
842
+			},
843
+			'EE_Template_Config'                           => static function () {
844
+				return EE_Config::instance()->template_settings;
845
+			},
846
+			'EE_Currency_Config'                           => static function () {
847
+				return EE_Config::instance()->currency;
848
+			},
849
+			'EE_Registration_Config'                       => static function () {
850
+				return EE_Config::instance()->registration;
851
+			},
852
+			'EE_Core_Config'                               => static function () {
853
+				return EE_Config::instance()->core;
854
+			},
855
+			'EventEspresso\core\services\loaders\Loader'   => static function () {
856
+				return LoaderFactory::getLoader();
857
+			},
858
+			'EE_Network_Config'                            => static function () {
859
+				return EE_Network_Config::instance();
860
+			},
861
+			'EE_Config'                                    => static function () {
862
+				return EE_Config::instance();
863
+			},
864
+			'EventEspresso\core\domain\Domain'             => static function () {
865
+				return DomainFactory::getEventEspressoCoreDomain();
866
+			},
867
+			'EE_Admin_Config'                              => static function () {
868
+				return EE_Config::instance()->admin;
869
+			},
870
+			'EE_Organization_Config'                       => static function () {
871
+				return EE_Config::instance()->organization;
872
+			},
873
+			'EE_Network_Core_Config'                       => static function () {
874
+				return EE_Network_Config::instance()->core;
875
+			},
876
+			'EE_Environment_Config'                        => static function () {
877
+				return EE_Config::instance()->environment;
878
+			},
879
+			'EED_Core_Rest_Api'                            => static function () {
880
+				return EED_Core_Rest_Api::instance();
881
+			},
882
+			'WP_REST_Server'                               => static function () {
883
+				return rest_get_server();
884
+			},
885
+		];
886
+	}
887
+
888
+
889
+	/**
890
+	 * can be used for supplying alternate names for classes,
891
+	 * or for connecting interface names to instantiable classes
892
+	 *
893
+	 * @throws InvalidAliasException
894
+	 */
895
+	protected function _register_core_aliases()
896
+	{
897
+		$aliases = [
898
+			'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
899
+			'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
900
+			'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
901
+			'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
902
+			'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
903
+			'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
904
+			'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
905
+			'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
906
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
907
+			'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
908
+			'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
909
+			'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
910
+			'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
911
+			'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
912
+			'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
913
+			'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
914
+			'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
915
+			'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
916
+			'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
917
+			'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
918
+			'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
919
+			'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
920
+			'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
921
+			'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
922
+			'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
923
+			'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
924
+			'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
925
+			'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
926
+			'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
927
+			'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
928
+			'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
929
+			'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
930
+			'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
931
+			'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
932
+			'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
933
+			'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
934
+			'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
935
+			'Registration_Processor'                                                       => 'EE_Registration_Processor',
936
+			'EventEspresso\core\services\assets\AssetManifestInterface'                    => 'EventEspresso\core\services\assets\AssetManifest',
937
+		];
938
+		foreach ($aliases as $alias => $fqn) {
939
+			if (is_array($fqn)) {
940
+				foreach ($fqn as $class => $for_class) {
941
+					$this->class_cache->addAlias($class, $alias, $for_class);
942
+				}
943
+				continue;
944
+			}
945
+			$this->class_cache->addAlias($fqn, $alias);
946
+		}
947
+		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
948
+			$this->class_cache->addAlias(
949
+				'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
950
+				'EventEspresso\core\services\notices\NoticeConverterInterface'
951
+			);
952
+		}
953
+	}
954
+
955
+
956
+	/**
957
+	 * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
958
+	 * request Primarily used by unit tests.
959
+	 */
960
+	public function reset()
961
+	{
962
+		$this->_register_core_class_loaders();
963
+		$this->_register_core_dependencies();
964
+	}
965
+
966
+
967
+	/**
968
+	 * PLZ NOTE: a better name for this method would be is_alias()
969
+	 * because it returns TRUE if the provided fully qualified name IS an alias
970
+	 * WHY?
971
+	 * Because if a class is type hinting for a concretion,
972
+	 * then why would we need to find another class to supply it?
973
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
974
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
975
+	 * Don't go looking for some substitute.
976
+	 * Whereas if a class is type hinting for an interface...
977
+	 * then we need to find an actual class to use.
978
+	 * So the interface IS the alias for some other FQN,
979
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
980
+	 * represents some other class.
981
+	 *
982
+	 * @param string $fqn
983
+	 * @param string $for_class
984
+	 * @return bool
985
+	 * @deprecated 4.9.62.p
986
+	 */
987
+	public function has_alias($fqn = '', $for_class = '')
988
+	{
989
+		return $this->isAlias($fqn, $for_class);
990
+	}
991
+
992
+
993
+	/**
994
+	 * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
995
+	 * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
996
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
997
+	 *  for example:
998
+	 *      if the following two entries were added to the _aliases array:
999
+	 *          array(
1000
+	 *              'interface_alias'           => 'some\namespace\interface'
1001
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
1002
+	 *          )
1003
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1004
+	 *      to load an instance of 'some\namespace\classname'
1005
+	 *
1006
+	 * @param string $alias
1007
+	 * @param string $for_class
1008
+	 * @return string
1009
+	 * @deprecated 4.9.62.p
1010
+	 */
1011
+	public function get_alias($alias = '', $for_class = '')
1012
+	{
1013
+		return $this->getFqnForAlias($alias, $for_class);
1014
+	}
1015 1015
 }
Please login to merge, or discard this patch.
core/domain/entities/editor/CoreBlocksAssetManager.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -16,30 +16,30 @@
 block discarded – undo
16 16
  */
17 17
 class CoreBlocksAssetManager extends BlockAssetManager
18 18
 {
19
-    const DOMAIN = 'blocks';
20
-
21
-    const ASSET_HANDLE_CORE_BLOCKS = Domain::ASSET_NAMESPACE . '-' . CoreBlocksAssetManager::DOMAIN;
22
-
23
-
24
-    /**
25
-     * @since  $VID:$
26
-     * @throws DomainException
27
-     */
28
-    public function enqueueEventEditor()
29
-    {
30
-        if ($this->verifyAssetIsRegistered(CoreBlocksAssetManager::ASSET_HANDLE_CORE_BLOCKS)) {
31
-            wp_enqueue_script(CoreBlocksAssetManager::ASSET_HANDLE_CORE_BLOCKS);
32
-            wp_enqueue_style(CoreBlocksAssetManager::ASSET_HANDLE_CORE_BLOCKS);
33
-        }
34
-    }
35
-
36
-
37
-    /**
38
-     * @since 4.9.71.p
39
-     */
40
-    public function setAssetHandles()
41
-    {
42
-        $this->setEditorScriptHandle(CoreBlocksAssetManager::ASSET_HANDLE_CORE_BLOCKS);
43
-        $this->setScriptHandle(CoreBlocksAssetManager::ASSET_HANDLE_CORE_BLOCKS);
44
-    }
19
+	const DOMAIN = 'blocks';
20
+
21
+	const ASSET_HANDLE_CORE_BLOCKS = Domain::ASSET_NAMESPACE . '-' . CoreBlocksAssetManager::DOMAIN;
22
+
23
+
24
+	/**
25
+	 * @since  $VID:$
26
+	 * @throws DomainException
27
+	 */
28
+	public function enqueueEventEditor()
29
+	{
30
+		if ($this->verifyAssetIsRegistered(CoreBlocksAssetManager::ASSET_HANDLE_CORE_BLOCKS)) {
31
+			wp_enqueue_script(CoreBlocksAssetManager::ASSET_HANDLE_CORE_BLOCKS);
32
+			wp_enqueue_style(CoreBlocksAssetManager::ASSET_HANDLE_CORE_BLOCKS);
33
+		}
34
+	}
35
+
36
+
37
+	/**
38
+	 * @since 4.9.71.p
39
+	 */
40
+	public function setAssetHandles()
41
+	{
42
+		$this->setEditorScriptHandle(CoreBlocksAssetManager::ASSET_HANDLE_CORE_BLOCKS);
43
+		$this->setScriptHandle(CoreBlocksAssetManager::ASSET_HANDLE_CORE_BLOCKS);
44
+	}
45 45
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 {
19 19
     const DOMAIN = 'blocks';
20 20
 
21
-    const ASSET_HANDLE_CORE_BLOCKS = Domain::ASSET_NAMESPACE . '-' . CoreBlocksAssetManager::DOMAIN;
21
+    const ASSET_HANDLE_CORE_BLOCKS = Domain::ASSET_NAMESPACE.'-'.CoreBlocksAssetManager::DOMAIN;
22 22
 
23 23
 
24 24
     /**
Please login to merge, or discard this patch.