Completed
Branch barista-dev (941eb2)
by
unknown
34:53 queued 25:36
created
core/domain/entities/routing/handlers/shared/AssetRequests.php 1 patch
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -17,128 +17,128 @@
 block discarded – undo
17 17
 class AssetRequests extends Route
18 18
 {
19 19
 
20
-    /**
21
-     * returns true if the current request matches this route
22
-     *
23
-     * @return bool
24
-     * @since   $VID:$
25
-     */
26
-    public function matchesCurrentRequest()
27
-    {
28
-        return $this->request->isAdmin()
29
-               || $this->request->isFrontend()
30
-               || $this->request->isIframe()
31
-               || $this->request->isWordPressApi();
32
-    }
20
+	/**
21
+	 * returns true if the current request matches this route
22
+	 *
23
+	 * @return bool
24
+	 * @since   $VID:$
25
+	 */
26
+	public function matchesCurrentRequest()
27
+	{
28
+		return $this->request->isAdmin()
29
+			   || $this->request->isFrontend()
30
+			   || $this->request->isIframe()
31
+			   || $this->request->isWordPressApi();
32
+	}
33 33
 
34 34
 
35
-    /**
36
-     * @since $VID:$
37
-     */
38
-    protected function registerDependencies()
39
-    {
40
-        $default_dependencies = [
41
-            'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
42
-            'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
43
-            'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
44
-        ];
45
-        $this->dependency_map->registerDependencies(
46
-            'EventEspresso\core\domain\services\assets\ReactAssetManager',
47
-            $default_dependencies
48
-        );
49
-        $this->dependency_map->registerDependencies(
50
-            'EventEspresso\core\domain\services\assets\CoreAssetManager',
51
-            [
52
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
53
-                'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
54
-                'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
55
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
56
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
57
-            ]
58
-        );
59
-        $this->dependency_map->registerDependencies(
60
-            'EventEspresso\core\services\editor\BlockRegistrationManager',
61
-            [
62
-                'EventEspresso\core\services\assets\BlockAssetManagerCollection'     => EE_Dependency_Map::load_from_cache,
63
-                'EventEspresso\core\domain\entities\editor\BlockCollection'          => EE_Dependency_Map::load_from_cache,
64
-                'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
65
-                'EventEspresso\core\services\request\Request'                        => EE_Dependency_Map::load_from_cache,
66
-            ]
67
-        );
68
-        $this->dependency_map->registerDependencies(
69
-            'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager',
70
-            [
71
-                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
72
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
73
-                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
74
-            ]
75
-        );
76
-        $this->dependency_map->registerDependencies(
77
-            'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer',
78
-            [
79
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
80
-                'EEM_Attendee'                     => EE_Dependency_Map::load_from_cache,
81
-            ]
82
-        );
83
-        $this->dependency_map->registerDependencies(
84
-            'EventEspresso\core\domain\entities\editor\blocks\EventAttendees',
85
-            [
86
-                'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'      => EE_Dependency_Map::load_from_cache,
87
-                'EventEspresso\core\services\request\Request'                           => EE_Dependency_Map::load_from_cache,
88
-                'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => EE_Dependency_Map::load_from_cache,
89
-            ]
90
-        );
91
-        if (apply_filters(
92
-            'FHEE__EventEspresso_core_domain_entities_routing_handlers_shared_AssetRequests__load_Barista',
93
-            true
94
-        )) {
95
-            $this->dependency_map->registerDependencies(
96
-                'EventEspresso\core\services\assets\Barista',
97
-                ['EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache]
98
-            );
99
-        }
100
-    }
35
+	/**
36
+	 * @since $VID:$
37
+	 */
38
+	protected function registerDependencies()
39
+	{
40
+		$default_dependencies = [
41
+			'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
42
+			'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
43
+			'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
44
+		];
45
+		$this->dependency_map->registerDependencies(
46
+			'EventEspresso\core\domain\services\assets\ReactAssetManager',
47
+			$default_dependencies
48
+		);
49
+		$this->dependency_map->registerDependencies(
50
+			'EventEspresso\core\domain\services\assets\CoreAssetManager',
51
+			[
52
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
53
+				'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
54
+				'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
55
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
56
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
57
+			]
58
+		);
59
+		$this->dependency_map->registerDependencies(
60
+			'EventEspresso\core\services\editor\BlockRegistrationManager',
61
+			[
62
+				'EventEspresso\core\services\assets\BlockAssetManagerCollection'     => EE_Dependency_Map::load_from_cache,
63
+				'EventEspresso\core\domain\entities\editor\BlockCollection'          => EE_Dependency_Map::load_from_cache,
64
+				'EventEspresso\core\services\routing\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
65
+				'EventEspresso\core\services\request\Request'                        => EE_Dependency_Map::load_from_cache,
66
+			]
67
+		);
68
+		$this->dependency_map->registerDependencies(
69
+			'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager',
70
+			[
71
+				'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
72
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
73
+				'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
74
+			]
75
+		);
76
+		$this->dependency_map->registerDependencies(
77
+			'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer',
78
+			[
79
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
80
+				'EEM_Attendee'                     => EE_Dependency_Map::load_from_cache,
81
+			]
82
+		);
83
+		$this->dependency_map->registerDependencies(
84
+			'EventEspresso\core\domain\entities\editor\blocks\EventAttendees',
85
+			[
86
+				'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager'      => EE_Dependency_Map::load_from_cache,
87
+				'EventEspresso\core\services\request\Request'                           => EE_Dependency_Map::load_from_cache,
88
+				'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => EE_Dependency_Map::load_from_cache,
89
+			]
90
+		);
91
+		if (apply_filters(
92
+			'FHEE__EventEspresso_core_domain_entities_routing_handlers_shared_AssetRequests__load_Barista',
93
+			true
94
+		)) {
95
+			$this->dependency_map->registerDependencies(
96
+				'EventEspresso\core\services\assets\Barista',
97
+				['EventEspresso\core\services\assets\AssetManifest' => EE_Dependency_Map::load_from_cache]
98
+			);
99
+		}
100
+	}
101 101
 
102 102
 
103
-    /**
104
-     * implements logic required to run during request
105
-     *
106
-     * @return bool
107
-     * @since   $VID:$
108
-     */
109
-    protected function requestHandler()
110
-    {
111
-        if (apply_filters(
112
-            'FHEE__EventEspresso_core_domain_entities_routing_handlers_shared_AssetRequests__load_Barista',
113
-            true
114
-        )) {
115
-            /** @var Barista $barista */
116
-            $barista = $this->loader->getShared('EventEspresso\core\services\assets\Barista');
117
-            $barista->initialize();
118
-            $this->loader->getShared('EventEspresso\core\services\assets\Registry');
119
-        }
120
-        $this->loader->getShared('EventEspresso\core\domain\services\assets\CoreAssetManager');
121
-        if ($this->canLoadBlocks()) {
122
-            $this->loader->getShared(
123
-                'EventEspresso\core\services\editor\BlockRegistrationManager'
124
-            );
125
-        }
126
-        return true;
127
-    }
103
+	/**
104
+	 * implements logic required to run during request
105
+	 *
106
+	 * @return bool
107
+	 * @since   $VID:$
108
+	 */
109
+	protected function requestHandler()
110
+	{
111
+		if (apply_filters(
112
+			'FHEE__EventEspresso_core_domain_entities_routing_handlers_shared_AssetRequests__load_Barista',
113
+			true
114
+		)) {
115
+			/** @var Barista $barista */
116
+			$barista = $this->loader->getShared('EventEspresso\core\services\assets\Barista');
117
+			$barista->initialize();
118
+			$this->loader->getShared('EventEspresso\core\services\assets\Registry');
119
+		}
120
+		$this->loader->getShared('EventEspresso\core\domain\services\assets\CoreAssetManager');
121
+		if ($this->canLoadBlocks()) {
122
+			$this->loader->getShared(
123
+				'EventEspresso\core\services\editor\BlockRegistrationManager'
124
+			);
125
+		}
126
+		return true;
127
+	}
128 128
 
129 129
 
130
-    /**
131
-     * Return whether blocks can be registered/loaded or not.
132
-     *
133
-     * @return bool
134
-     * @since $VID:$
135
-     */
136
-    private function canLoadBlocks()
137
-    {
138
-        return apply_filters('FHEE__EE_System__canLoadBlocks', true)
139
-               && function_exists('register_block_type')
140
-               // don't load blocks if in the Divi page builder editor context
141
-               // @see https://github.com/eventespresso/event-espresso-core/issues/814
142
-               && ! $this->request->getRequestParam('et_fb', false);
143
-    }
130
+	/**
131
+	 * Return whether blocks can be registered/loaded or not.
132
+	 *
133
+	 * @return bool
134
+	 * @since $VID:$
135
+	 */
136
+	private function canLoadBlocks()
137
+	{
138
+		return apply_filters('FHEE__EE_System__canLoadBlocks', true)
139
+			   && function_exists('register_block_type')
140
+			   // don't load blocks if in the Divi page builder editor context
141
+			   // @see https://github.com/eventespresso/event-espresso-core/issues/814
142
+			   && ! $this->request->getRequestParam('et_fb', false);
143
+	}
144 144
 }
Please login to merge, or discard this patch.
core/services/assets/AssetManager.php 1 patch
Indentation   +323 added lines, -323 removed lines patch added patch discarded remove patch
@@ -23,332 +23,332 @@
 block discarded – undo
23 23
 abstract class AssetManager implements AssetManagerInterface
24 24
 {
25 25
 
26
-    /**
27
-     * @var AssetCollection|Asset[] $assets
28
-     */
29
-    protected $assets;
30
-
31
-    /**
32
-     * @var DomainInterface
33
-     */
34
-    protected $domain;
35
-
36
-    /**
37
-     * @var Registry $registry
38
-     */
39
-    protected $registry;
40
-
41
-
42
-    /**
43
-     * AssetRegister constructor.
44
-     *
45
-     * @param DomainInterface $domain
46
-     * @param AssetCollection $assets
47
-     * @param Registry        $registry
48
-     */
49
-    public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry)
50
-    {
51
-        $this->domain = $domain;
52
-        $this->assets = $assets;
53
-        $this->registry = $registry;
54
-        $this->registry->addAssetCollection($assets);
55
-        add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2);
56
-        add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2);
57
-    }
58
-
59
-
60
-    /**
61
-     * @return AssetCollection
62
-     */
63
-    public function getAssets()
64
-    {
65
-        return $this->assets;
66
-    }
67
-
68
-
69
-    /**
70
-     * @since 4.9.71.p
71
-     * @return string
72
-     */
73
-    public function assetNamespace()
74
-    {
75
-        return $this->domain->assetNamespace();
76
-    }
77
-
78
-
79
-    /**
80
-     * @param string $handle
81
-     * @param string $source
82
-     * @param array  $dependencies
83
-     * @param bool   $load_in_footer
84
-     * @param string $version
85
-     * @return JavascriptAsset
86
-     * @throws DuplicateCollectionIdentifierException
87
-     * @throws InvalidDataTypeException
88
-     * @throws InvalidEntityException
89
-     * @throws DomainException
90
-     * @since 4.9.62.p
91
-     */
92
-    public function addJavascript(
93
-        $handle,
94
-        $source,
95
-        array $dependencies = array(),
96
-        $load_in_footer = true,
97
-        $version = ''
98
-    ) {
99
-        $asset = new JavascriptAsset(
100
-            $handle,
101
-            $source,
102
-            array_unique($dependencies),
103
-            $load_in_footer,
104
-            $this->domain,
105
-            $version
106
-        );
107
-        $this->assets->add($asset, $handle);
108
-        return $asset;
109
-    }
110
-
111
-
112
-    /**
113
-     * Used to register a javascript asset where everything is dynamically derived from the given handle.
114
-     *
115
-     * @param string       $handle
116
-     * @param string|array $extra_dependencies
117
-     * @return JavascriptAsset
118
-     * @throws DuplicateCollectionIdentifierException
119
-     * @throws InvalidDataTypeException
120
-     * @throws InvalidEntityException
121
-     * @throws DomainException
122
-     */
123
-    public function addJs($handle, $extra_dependencies = [])
124
-    {
125
-        $details = $this->getAssetDetails(
126
-            Asset::TYPE_JS,
127
-            $handle,
128
-            $extra_dependencies
129
-        );
130
-        $source = $this->registry->getJsUrl($this->domain->assetNamespace(), $handle);
131
-        return $this->addJavascript(
132
-            $handle,
133
-            $source,
134
-            $details['dependencies'],
135
-            true,
136
-            $details['version']
137
-        );
138
-    }
139
-
140
-
141
-    /**
142
-     * @param string $handle
143
-     * @param array  $dependencies
144
-     * @param bool   $load_in_footer
145
-     * @param string $version
146
-     * @return JavascriptAsset
147
-     * @throws DomainException
148
-     * @throws DuplicateCollectionIdentifierException
149
-     * @throws InvalidDataTypeException
150
-     * @throws InvalidEntityException
151
-     * @since 4.9.71.p
152
-     */
153
-    public function addVendorJavascript(
154
-        $handle,
155
-        array $dependencies = array(),
156
-        $load_in_footer = true,
157
-        $version = ''
158
-    ) {
159
-        $dev_suffix = wp_scripts_get_suffix('dev');
160
-        $vendor_path = $this->domain->pluginUrl() . 'assets/vendor/';
161
-        return $this->addJavascript(
162
-            $handle,
163
-            "{$vendor_path}{$handle}{$dev_suffix}.js",
164
-            $dependencies,
165
-            $load_in_footer,
166
-            $version
167
-        );
168
-    }
169
-
170
-
171
-    /**
172
-     * @param string $handle
173
-     * @param string $source
174
-     * @param array  $dependencies
175
-     * @param string $media
176
-     * @param string $version
177
-     * @return StylesheetAsset
178
-     * @throws DomainException
179
-     * @throws DuplicateCollectionIdentifierException
180
-     * @throws InvalidDataTypeException
181
-     * @throws InvalidEntityException
182
-     * @since 4.9.62.p
183
-     */
184
-    public function addStylesheet(
185
-        $handle,
186
-        $source,
187
-        array $dependencies = array(),
188
-        $media = 'all',
189
-        $version = ''
190
-    ) {
191
-        $asset = new StylesheetAsset(
192
-            $handle,
193
-            $source,
194
-            array_unique($dependencies),
195
-            $this->domain,
196
-            $media,
197
-            $version
198
-        );
199
-        $this->assets->add($asset, $handle);
200
-        return $asset;
201
-    }
202
-
203
-
204
-    /**
205
-     * Used to register a css asset where everything is dynamically derived from the given handle.
206
-     *
207
-     * @param string       $handle
208
-     * @param string|array $extra_dependencies
209
-     * @return StylesheetAsset
210
-     * @throws DuplicateCollectionIdentifierException
211
-     * @throws InvalidDataTypeException
212
-     * @throws InvalidEntityException
213
-     * @throws DomainException
214
-     */
215
-    public function addCss($handle, $extra_dependencies = [])
216
-    {
217
-        $details = $this->getAssetDetails(
218
-            Asset::TYPE_CSS,
219
-            $handle,
220
-            $extra_dependencies
221
-        );
222
-        return $this->addStylesheet(
223
-            $handle,
224
-            $this->registry->getCssUrl($this->domain->assetNamespace(), $handle),
225
-            $details['dependencies'],
226
-            'all',
227
-            $details['version']
228
-        );
229
-    }
230
-
231
-
232
-    /**
233
-     * @param string $handle
234
-     * @return bool
235
-     * @since 4.9.62.p
236
-     */
237
-    public function enqueueAsset($handle)
238
-    {
239
-        if ($this->assets->has($handle)) {
240
-            /** @var Asset $asset */
241
-            $asset = $this->assets->get($handle);
242
-            if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
243
-                $asset->enqueueAsset();
244
-                return true;
245
-            }
246
-        }
247
-        return false;
248
-    }
249
-
250
-
251
-    /**
252
-     * @return  void
253
-     * @since   $VID:$
254
-     */
255
-    public function enqueueBrowserAssets()
256
-    {
257
-        foreach ($this->assets as $asset) {
258
-            if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
259
-                $asset->enqueueAsset();
260
-            }
261
-        }
262
-    }
263
-
264
-
265
-    /**
266
-     * @param string $asset_type
267
-     * @param string $handle
268
-     * @param array  $extra_dependencies
269
-     * @return array
270
-     * @since 4.10.2.p
271
-     */
272
-    private function getAssetDetails($asset_type, $handle, $extra_dependencies = [])
273
-    {
274
-        $getAssetDetails = '';
275
-        switch ($asset_type) {
276
-            case Asset::TYPE_JS :
277
-                $getAssetDetails = 'getJsAssetDetails';
278
-                break;
279
-            case Asset::TYPE_CSS :
280
-                $getAssetDetails = 'getCssAssetDetails';
281
-                break;
282
-        }
283
-        if ($getAssetDetails === '') {
284
-            return ['dependencies' => [], 'version' => ''];
285
-        }
286
-        $details = $this->registry->$getAssetDetails(
287
-            $this->domain->assetNamespace(),
288
-            $handle
289
-        );
290
-        $details['dependencies'] = isset($details['dependencies'])
291
-            ? $details['dependencies']
292
-            : [];
293
-        $details['version'] = isset($details['version'])
294
-            ? $details['version']
295
-            : '';
296
-        $details['dependencies'] = ! empty($extra_dependencies)
297
-            ? array_merge($details['dependencies'], (array) $extra_dependencies)
298
-            : $details['dependencies'];
299
-        return $details;
300
-
301
-    }
302
-
303
-
304
-    /**
305
-     * @param string $handle
306
-     * @return bool
307
-     * @throws DomainException
308
-     */
309
-    public function verifyAssetIsRegistered($handle)
310
-    {
311
-        if (wp_script_is($handle, 'registered')) {
312
-            return true;
313
-        }
314
-        if (WP_DEBUG) {
315
-            throw new DomainException(
316
-                sprintf(
317
-                    esc_html__(
318
-                        'The "%1$s" script is not registered when it should be!%2$s
26
+	/**
27
+	 * @var AssetCollection|Asset[] $assets
28
+	 */
29
+	protected $assets;
30
+
31
+	/**
32
+	 * @var DomainInterface
33
+	 */
34
+	protected $domain;
35
+
36
+	/**
37
+	 * @var Registry $registry
38
+	 */
39
+	protected $registry;
40
+
41
+
42
+	/**
43
+	 * AssetRegister constructor.
44
+	 *
45
+	 * @param DomainInterface $domain
46
+	 * @param AssetCollection $assets
47
+	 * @param Registry        $registry
48
+	 */
49
+	public function __construct(DomainInterface $domain, AssetCollection $assets, Registry $registry)
50
+	{
51
+		$this->domain = $domain;
52
+		$this->assets = $assets;
53
+		$this->registry = $registry;
54
+		$this->registry->addAssetCollection($assets);
55
+		add_action('wp_enqueue_scripts', array($this, 'addAssets'), 2);
56
+		add_action('admin_enqueue_scripts', array($this, 'addAssets'), 2);
57
+	}
58
+
59
+
60
+	/**
61
+	 * @return AssetCollection
62
+	 */
63
+	public function getAssets()
64
+	{
65
+		return $this->assets;
66
+	}
67
+
68
+
69
+	/**
70
+	 * @since 4.9.71.p
71
+	 * @return string
72
+	 */
73
+	public function assetNamespace()
74
+	{
75
+		return $this->domain->assetNamespace();
76
+	}
77
+
78
+
79
+	/**
80
+	 * @param string $handle
81
+	 * @param string $source
82
+	 * @param array  $dependencies
83
+	 * @param bool   $load_in_footer
84
+	 * @param string $version
85
+	 * @return JavascriptAsset
86
+	 * @throws DuplicateCollectionIdentifierException
87
+	 * @throws InvalidDataTypeException
88
+	 * @throws InvalidEntityException
89
+	 * @throws DomainException
90
+	 * @since 4.9.62.p
91
+	 */
92
+	public function addJavascript(
93
+		$handle,
94
+		$source,
95
+		array $dependencies = array(),
96
+		$load_in_footer = true,
97
+		$version = ''
98
+	) {
99
+		$asset = new JavascriptAsset(
100
+			$handle,
101
+			$source,
102
+			array_unique($dependencies),
103
+			$load_in_footer,
104
+			$this->domain,
105
+			$version
106
+		);
107
+		$this->assets->add($asset, $handle);
108
+		return $asset;
109
+	}
110
+
111
+
112
+	/**
113
+	 * Used to register a javascript asset where everything is dynamically derived from the given handle.
114
+	 *
115
+	 * @param string       $handle
116
+	 * @param string|array $extra_dependencies
117
+	 * @return JavascriptAsset
118
+	 * @throws DuplicateCollectionIdentifierException
119
+	 * @throws InvalidDataTypeException
120
+	 * @throws InvalidEntityException
121
+	 * @throws DomainException
122
+	 */
123
+	public function addJs($handle, $extra_dependencies = [])
124
+	{
125
+		$details = $this->getAssetDetails(
126
+			Asset::TYPE_JS,
127
+			$handle,
128
+			$extra_dependencies
129
+		);
130
+		$source = $this->registry->getJsUrl($this->domain->assetNamespace(), $handle);
131
+		return $this->addJavascript(
132
+			$handle,
133
+			$source,
134
+			$details['dependencies'],
135
+			true,
136
+			$details['version']
137
+		);
138
+	}
139
+
140
+
141
+	/**
142
+	 * @param string $handle
143
+	 * @param array  $dependencies
144
+	 * @param bool   $load_in_footer
145
+	 * @param string $version
146
+	 * @return JavascriptAsset
147
+	 * @throws DomainException
148
+	 * @throws DuplicateCollectionIdentifierException
149
+	 * @throws InvalidDataTypeException
150
+	 * @throws InvalidEntityException
151
+	 * @since 4.9.71.p
152
+	 */
153
+	public function addVendorJavascript(
154
+		$handle,
155
+		array $dependencies = array(),
156
+		$load_in_footer = true,
157
+		$version = ''
158
+	) {
159
+		$dev_suffix = wp_scripts_get_suffix('dev');
160
+		$vendor_path = $this->domain->pluginUrl() . 'assets/vendor/';
161
+		return $this->addJavascript(
162
+			$handle,
163
+			"{$vendor_path}{$handle}{$dev_suffix}.js",
164
+			$dependencies,
165
+			$load_in_footer,
166
+			$version
167
+		);
168
+	}
169
+
170
+
171
+	/**
172
+	 * @param string $handle
173
+	 * @param string $source
174
+	 * @param array  $dependencies
175
+	 * @param string $media
176
+	 * @param string $version
177
+	 * @return StylesheetAsset
178
+	 * @throws DomainException
179
+	 * @throws DuplicateCollectionIdentifierException
180
+	 * @throws InvalidDataTypeException
181
+	 * @throws InvalidEntityException
182
+	 * @since 4.9.62.p
183
+	 */
184
+	public function addStylesheet(
185
+		$handle,
186
+		$source,
187
+		array $dependencies = array(),
188
+		$media = 'all',
189
+		$version = ''
190
+	) {
191
+		$asset = new StylesheetAsset(
192
+			$handle,
193
+			$source,
194
+			array_unique($dependencies),
195
+			$this->domain,
196
+			$media,
197
+			$version
198
+		);
199
+		$this->assets->add($asset, $handle);
200
+		return $asset;
201
+	}
202
+
203
+
204
+	/**
205
+	 * Used to register a css asset where everything is dynamically derived from the given handle.
206
+	 *
207
+	 * @param string       $handle
208
+	 * @param string|array $extra_dependencies
209
+	 * @return StylesheetAsset
210
+	 * @throws DuplicateCollectionIdentifierException
211
+	 * @throws InvalidDataTypeException
212
+	 * @throws InvalidEntityException
213
+	 * @throws DomainException
214
+	 */
215
+	public function addCss($handle, $extra_dependencies = [])
216
+	{
217
+		$details = $this->getAssetDetails(
218
+			Asset::TYPE_CSS,
219
+			$handle,
220
+			$extra_dependencies
221
+		);
222
+		return $this->addStylesheet(
223
+			$handle,
224
+			$this->registry->getCssUrl($this->domain->assetNamespace(), $handle),
225
+			$details['dependencies'],
226
+			'all',
227
+			$details['version']
228
+		);
229
+	}
230
+
231
+
232
+	/**
233
+	 * @param string $handle
234
+	 * @return bool
235
+	 * @since 4.9.62.p
236
+	 */
237
+	public function enqueueAsset($handle)
238
+	{
239
+		if ($this->assets->has($handle)) {
240
+			/** @var Asset $asset */
241
+			$asset = $this->assets->get($handle);
242
+			if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
243
+				$asset->enqueueAsset();
244
+				return true;
245
+			}
246
+		}
247
+		return false;
248
+	}
249
+
250
+
251
+	/**
252
+	 * @return  void
253
+	 * @since   $VID:$
254
+	 */
255
+	public function enqueueBrowserAssets()
256
+	{
257
+		foreach ($this->assets as $asset) {
258
+			if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
259
+				$asset->enqueueAsset();
260
+			}
261
+		}
262
+	}
263
+
264
+
265
+	/**
266
+	 * @param string $asset_type
267
+	 * @param string $handle
268
+	 * @param array  $extra_dependencies
269
+	 * @return array
270
+	 * @since 4.10.2.p
271
+	 */
272
+	private function getAssetDetails($asset_type, $handle, $extra_dependencies = [])
273
+	{
274
+		$getAssetDetails = '';
275
+		switch ($asset_type) {
276
+			case Asset::TYPE_JS :
277
+				$getAssetDetails = 'getJsAssetDetails';
278
+				break;
279
+			case Asset::TYPE_CSS :
280
+				$getAssetDetails = 'getCssAssetDetails';
281
+				break;
282
+		}
283
+		if ($getAssetDetails === '') {
284
+			return ['dependencies' => [], 'version' => ''];
285
+		}
286
+		$details = $this->registry->$getAssetDetails(
287
+			$this->domain->assetNamespace(),
288
+			$handle
289
+		);
290
+		$details['dependencies'] = isset($details['dependencies'])
291
+			? $details['dependencies']
292
+			: [];
293
+		$details['version'] = isset($details['version'])
294
+			? $details['version']
295
+			: '';
296
+		$details['dependencies'] = ! empty($extra_dependencies)
297
+			? array_merge($details['dependencies'], (array) $extra_dependencies)
298
+			: $details['dependencies'];
299
+		return $details;
300
+
301
+	}
302
+
303
+
304
+	/**
305
+	 * @param string $handle
306
+	 * @return bool
307
+	 * @throws DomainException
308
+	 */
309
+	public function verifyAssetIsRegistered($handle)
310
+	{
311
+		if (wp_script_is($handle, 'registered')) {
312
+			return true;
313
+		}
314
+		if (WP_DEBUG) {
315
+			throw new DomainException(
316
+				sprintf(
317
+					esc_html__(
318
+						'The "%1$s" script is not registered when it should be!%2$s
319 319
                         Are you running the Barista plugin for development purposes? 
320 320
                         If so, then you need to build the appropriate assets for this domain.%2$s
321 321
                         If you are seeing this error on a live website, then you should not have 
322 322
                         the WP_DEBUG constant in your wp-config.php file set to "true". 
323 323
                         Please contact Event Espresso support for more information.',
324
-                        'event_espresso'
325
-                    ),
326
-                    $handle,
327
-                    '<br />'
328
-                )
329
-            );
330
-        }
331
-        return false;
332
-    }
333
-
334
-
335
-    /**************** deprecated ****************/
336
-
337
-
338
-    /**
339
-     * @return void
340
-     * @deprecated $VID:$
341
-     */
342
-    public function addManifestFile()
343
-    {
344
-    }
345
-
346
-
347
-    /**
348
-     * @return void
349
-     * @deprecated $VID:$
350
-     */
351
-    public function getManifestFile()
352
-    {
353
-    }
324
+						'event_espresso'
325
+					),
326
+					$handle,
327
+					'<br />'
328
+				)
329
+			);
330
+		}
331
+		return false;
332
+	}
333
+
334
+
335
+	/**************** deprecated ****************/
336
+
337
+
338
+	/**
339
+	 * @return void
340
+	 * @deprecated $VID:$
341
+	 */
342
+	public function addManifestFile()
343
+	{
344
+	}
345
+
346
+
347
+	/**
348
+	 * @return void
349
+	 * @deprecated $VID:$
350
+	 */
351
+	public function getManifestFile()
352
+	{
353
+	}
354 354
 }
Please login to merge, or discard this patch.
core/EE_Dependency_Map.core.php 1 patch
Indentation   +989 added lines, -989 removed lines patch added patch discarded remove patch
@@ -21,993 +21,993 @@
 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\I18nRegistry'                                                             => [
614
-                'EventEspresso\core\domain\Domain'                 => EE_Dependency_Map::load_from_cache,
615
-                'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache,
616
-                [],
617
-            ],
618
-            'EventEspresso\core\services\assets\Registry'                                                                 => [
619
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
620
-                'EventEspresso\core\services\assets\AssetManifest'   => EE_Dependency_Map::load_from_cache,
621
-                'EventEspresso\core\services\assets\I18nRegistry'    => EE_Dependency_Map::load_from_cache,
622
-            ],
623
-            'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
624
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
625
-            ],
626
-            'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
627
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
628
-            ],
629
-            'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
630
-                'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
631
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
632
-            ],
633
-            'EventEspresso\core\domain\values\EmailAddress'                                                               => [
634
-                null,
635
-                'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
636
-            ],
637
-            'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
638
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
639
-            ],
640
-            'LEGACY_MODELS'                                                                                               => [
641
-                null,
642
-                'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
643
-            ],
644
-            'EE_Module_Request_Router'                                                                                    => [
645
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
646
-            ],
647
-            'EE_Registration_Processor'                                                                                   => [
648
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
649
-            ],
650
-            'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
651
-                null,
652
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
653
-                'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
654
-            ],
655
-            'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
656
-                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
657
-                'EE_Session'             => EE_Dependency_Map::load_from_cache,
658
-            ],
659
-            'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
660
-                'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
661
-                'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
662
-                'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
663
-                'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
664
-                'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
665
-            ],
666
-            'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
667
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
668
-            ],
669
-            'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
670
-                'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
671
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
672
-            ],
673
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
674
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
675
-            ],
676
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
677
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
678
-            ],
679
-            'EE_CPT_Strategy'                                                                                             => [
680
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
681
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
682
-            ],
683
-            'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
684
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
685
-            ],
686
-            'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
687
-                null,
688
-                null,
689
-                null,
690
-                'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
691
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
692
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
693
-            ],
694
-            'EventEspresso\core\services\dependencies\DependencyResolver'                                                 => [
695
-                'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
696
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
697
-                'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
698
-            ],
699
-            'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver'                               => [
700
-                'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
701
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
702
-                'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
703
-            ],
704
-            'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'                                          => [
705
-                'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
706
-                'EventEspresso\core\services\loaders\Loader'                                    => EE_Dependency_Map::load_from_cache,
707
-            ],
708
-            'EventEspresso\core\services\routing\RouteMatchSpecificationManager'                                          => [
709
-                'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
710
-                'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
711
-            ],
712
-            'EE_URL_Validation_Strategy'                                                                                  => [
713
-                null,
714
-                null,
715
-                'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
716
-            ],
717
-            'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
718
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
719
-            ],
720
-            'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
721
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
722
-            ],
723
-            'EventEspresso\core\domain\services\converters\RestApiSpoofer'                                                => [
724
-                'WP_REST_Server'                                               => EE_Dependency_Map::load_from_cache,
725
-                'EED_Core_Rest_Api'                                            => EE_Dependency_Map::load_from_cache,
726
-                'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
727
-                null,
728
-            ],
729
-            'EventEspresso\core\services\routing\RouteHandler'                                                            => [
730
-                'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache,
731
-                'EventEspresso\core\services\loaders\Loader'           => EE_Dependency_Map::load_from_cache,
732
-                'EventEspresso\core\services\request\Request'          => EE_Dependency_Map::load_from_cache,
733
-                'EventEspresso\core\services\routing\RouteCollection'  => EE_Dependency_Map::load_from_cache,
734
-            ],
735
-            'EventEspresso\core\services\json\JsonDataNodeHandler'                                                        => [
736
-                'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
737
-            ],
738
-            'EventEspresso\core\services\routing\Router'                                                                  => [
739
-                'EE_Dependency_Map'                                => EE_Dependency_Map::load_from_cache,
740
-                'EventEspresso\core\services\loaders\Loader'       => EE_Dependency_Map::load_from_cache,
741
-                'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache,
742
-            ],
743
-            'EventEspresso\core\services\assets\AssetManifest' => [
744
-                'EventEspresso\core\domain\Domain'                 => EE_Dependency_Map::load_from_cache,
745
-            ],
746
-        ];
747
-    }
748
-
749
-
750
-    /**
751
-     * Registers how core classes are loaded.
752
-     * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
753
-     *        'EE_Request_Handler' => 'load_core'
754
-     *        'EE_Messages_Queue'  => 'load_lib'
755
-     *        'EEH_Debug_Tools'    => 'load_helper'
756
-     * or, if greater control is required, by providing a custom closure. For example:
757
-     *        'Some_Class' => function () {
758
-     *            return new Some_Class();
759
-     *        },
760
-     * This is required for instantiating dependencies
761
-     * where an interface has been type hinted in a class constructor. For example:
762
-     *        'Required_Interface' => function () {
763
-     *            return new A_Class_That_Implements_Required_Interface();
764
-     *        },
765
-     */
766
-    protected function _register_core_class_loaders()
767
-    {
768
-        $this->_class_loaders = [
769
-            // load_core
770
-            'EE_Dependency_Map'                            => function () {
771
-                return $this;
772
-            },
773
-            'EE_Capabilities'                              => 'load_core',
774
-            'EE_Encryption'                                => 'load_core',
775
-            'EE_Front_Controller'                          => 'load_core',
776
-            'EE_Module_Request_Router'                     => 'load_core',
777
-            'EE_Registry'                                  => 'load_core',
778
-            'EE_Request'                                   => function () {
779
-                return $this->legacy_request;
780
-            },
781
-            'EventEspresso\core\services\request\Request'  => function () {
782
-                return $this->request;
783
-            },
784
-            'EventEspresso\core\services\request\Response' => function () {
785
-                return $this->response;
786
-            },
787
-            'EE_Base'                                      => 'load_core',
788
-            'EE_Request_Handler'                           => 'load_core',
789
-            'EE_Session'                                   => 'load_core',
790
-            'EE_Cron_Tasks'                                => 'load_core',
791
-            'EE_System'                                    => 'load_core',
792
-            'EE_Maintenance_Mode'                          => 'load_core',
793
-            'EE_Register_CPTs'                             => 'load_core',
794
-            'EE_Admin'                                     => 'load_core',
795
-            'EE_CPT_Strategy'                              => 'load_core',
796
-            // load_class
797
-            'EE_Registration_Processor'                    => 'load_class',
798
-            // load_lib
799
-            'EE_Message_Resource_Manager'                  => 'load_lib',
800
-            'EE_Message_Type_Collection'                   => 'load_lib',
801
-            'EE_Message_Type_Collection_Loader'            => 'load_lib',
802
-            'EE_Messenger_Collection'                      => 'load_lib',
803
-            'EE_Messenger_Collection_Loader'               => 'load_lib',
804
-            'EE_Messages_Processor'                        => 'load_lib',
805
-            'EE_Message_Repository'                        => 'load_lib',
806
-            'EE_Messages_Queue'                            => 'load_lib',
807
-            'EE_Messages_Data_Handler_Collection'          => 'load_lib',
808
-            'EE_Message_Template_Group_Collection'         => 'load_lib',
809
-            'EE_Payment_Method_Manager'                    => 'load_lib',
810
-            'EE_DMS_Core_4_1_0'                            => 'load_dms',
811
-            'EE_DMS_Core_4_2_0'                            => 'load_dms',
812
-            'EE_DMS_Core_4_3_0'                            => 'load_dms',
813
-            'EE_DMS_Core_4_5_0'                            => 'load_dms',
814
-            'EE_DMS_Core_4_6_0'                            => 'load_dms',
815
-            'EE_DMS_Core_4_7_0'                            => 'load_dms',
816
-            'EE_DMS_Core_4_8_0'                            => 'load_dms',
817
-            'EE_DMS_Core_4_9_0'                            => 'load_dms',
818
-            'EE_DMS_Core_4_10_0'                           => 'load_dms',
819
-            'EE_Messages_Generator'                        => static function () {
820
-                return EE_Registry::instance()->load_lib(
821
-                    'Messages_Generator',
822
-                    [],
823
-                    false,
824
-                    false
825
-                );
826
-            },
827
-            'EE_Messages_Template_Defaults'                => static function ($arguments = []) {
828
-                return EE_Registry::instance()->load_lib(
829
-                    'Messages_Template_Defaults',
830
-                    $arguments,
831
-                    false,
832
-                    false
833
-                );
834
-            },
835
-            // load_helper
836
-            'EEH_Parse_Shortcodes'                         => static function () {
837
-                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
838
-                    return new EEH_Parse_Shortcodes();
839
-                }
840
-                return null;
841
-            },
842
-            'EE_Template_Config'                           => static function () {
843
-                return EE_Config::instance()->template_settings;
844
-            },
845
-            'EE_Currency_Config'                           => static function () {
846
-                return EE_Config::instance()->currency;
847
-            },
848
-            'EE_Registration_Config'                       => static function () {
849
-                return EE_Config::instance()->registration;
850
-            },
851
-            'EE_Core_Config'                               => static function () {
852
-                return EE_Config::instance()->core;
853
-            },
854
-            'EventEspresso\core\services\loaders\Loader'   => static function () {
855
-                return LoaderFactory::getLoader();
856
-            },
857
-            'EE_Network_Config'                            => static function () {
858
-                return EE_Network_Config::instance();
859
-            },
860
-            'EE_Config'                                    => static function () {
861
-                return EE_Config::instance();
862
-            },
863
-            'EventEspresso\core\domain\Domain'             => static function () {
864
-                return DomainFactory::getEventEspressoCoreDomain();
865
-            },
866
-            'EE_Admin_Config'                              => static function () {
867
-                return EE_Config::instance()->admin;
868
-            },
869
-            'EE_Organization_Config'                       => static function () {
870
-                return EE_Config::instance()->organization;
871
-            },
872
-            'EE_Network_Core_Config'                       => static function () {
873
-                return EE_Network_Config::instance()->core;
874
-            },
875
-            'EE_Environment_Config'                        => static function () {
876
-                return EE_Config::instance()->environment;
877
-            },
878
-            'EED_Core_Rest_Api'                            => static function () {
879
-                return EED_Core_Rest_Api::instance();
880
-            },
881
-            'WP_REST_Server'                               => static function () {
882
-                return rest_get_server();
883
-            },
884
-        ];
885
-    }
886
-
887
-
888
-    /**
889
-     * can be used for supplying alternate names for classes,
890
-     * or for connecting interface names to instantiable classes
891
-     *
892
-     * @throws InvalidAliasException
893
-     */
894
-    protected function _register_core_aliases()
895
-    {
896
-        $aliases = [
897
-            'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
898
-            'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
899
-            'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
900
-            'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
901
-            'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
902
-            'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
903
-            'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
904
-            'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
905
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
906
-            'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
907
-            'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
908
-            'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
909
-            'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
910
-            'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
911
-            'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
912
-            'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
913
-            'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
914
-            'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
915
-            'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
916
-            'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
917
-            'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
918
-            'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
919
-            'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
920
-            'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
921
-            'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
922
-            'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
923
-            'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
924
-            'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
925
-            'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
926
-            'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
927
-            'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
928
-            'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
929
-            'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
930
-            'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
931
-            'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
932
-            'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
933
-            'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
934
-            'Registration_Processor'                                                       => 'EE_Registration_Processor',
935
-        ];
936
-        foreach ($aliases as $alias => $fqn) {
937
-            if (is_array($fqn)) {
938
-                foreach ($fqn as $class => $for_class) {
939
-                    $this->class_cache->addAlias($class, $alias, $for_class);
940
-                }
941
-                continue;
942
-            }
943
-            $this->class_cache->addAlias($fqn, $alias);
944
-        }
945
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
946
-            $this->class_cache->addAlias(
947
-                'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
948
-                'EventEspresso\core\services\notices\NoticeConverterInterface'
949
-            );
950
-        }
951
-    }
952
-
953
-
954
-    /**
955
-     * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
956
-     * request Primarily used by unit tests.
957
-     */
958
-    public function reset()
959
-    {
960
-        $this->_register_core_class_loaders();
961
-        $this->_register_core_dependencies();
962
-    }
963
-
964
-
965
-    /**
966
-     * PLZ NOTE: a better name for this method would be is_alias()
967
-     * because it returns TRUE if the provided fully qualified name IS an alias
968
-     * WHY?
969
-     * Because if a class is type hinting for a concretion,
970
-     * then why would we need to find another class to supply it?
971
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
972
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
973
-     * Don't go looking for some substitute.
974
-     * Whereas if a class is type hinting for an interface...
975
-     * then we need to find an actual class to use.
976
-     * So the interface IS the alias for some other FQN,
977
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
978
-     * represents some other class.
979
-     *
980
-     * @param string $fqn
981
-     * @param string $for_class
982
-     * @return bool
983
-     * @deprecated 4.9.62.p
984
-     */
985
-    public function has_alias($fqn = '', $for_class = '')
986
-    {
987
-        return $this->isAlias($fqn, $for_class);
988
-    }
989
-
990
-
991
-    /**
992
-     * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
993
-     * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
994
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
995
-     *  for example:
996
-     *      if the following two entries were added to the _aliases array:
997
-     *          array(
998
-     *              'interface_alias'           => 'some\namespace\interface'
999
-     *              'some\namespace\interface'  => 'some\namespace\classname'
1000
-     *          )
1001
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1002
-     *      to load an instance of 'some\namespace\classname'
1003
-     *
1004
-     * @param string $alias
1005
-     * @param string $for_class
1006
-     * @return string
1007
-     * @deprecated 4.9.62.p
1008
-     */
1009
-    public function get_alias($alias = '', $for_class = '')
1010
-    {
1011
-        return $this->getFqnForAlias($alias, $for_class);
1012
-    }
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\I18nRegistry'                                                             => [
614
+				'EventEspresso\core\domain\Domain'                 => EE_Dependency_Map::load_from_cache,
615
+				'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache,
616
+				[],
617
+			],
618
+			'EventEspresso\core\services\assets\Registry'                                                                 => [
619
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
620
+				'EventEspresso\core\services\assets\AssetManifest'   => EE_Dependency_Map::load_from_cache,
621
+				'EventEspresso\core\services\assets\I18nRegistry'    => EE_Dependency_Map::load_from_cache,
622
+			],
623
+			'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
624
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
625
+			],
626
+			'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
627
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
628
+			],
629
+			'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
630
+				'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
631
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
632
+			],
633
+			'EventEspresso\core\domain\values\EmailAddress'                                                               => [
634
+				null,
635
+				'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
636
+			],
637
+			'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
638
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
639
+			],
640
+			'LEGACY_MODELS'                                                                                               => [
641
+				null,
642
+				'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
643
+			],
644
+			'EE_Module_Request_Router'                                                                                    => [
645
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
646
+			],
647
+			'EE_Registration_Processor'                                                                                   => [
648
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
649
+			],
650
+			'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
651
+				null,
652
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
653
+				'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
654
+			],
655
+			'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
656
+				'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
657
+				'EE_Session'             => EE_Dependency_Map::load_from_cache,
658
+			],
659
+			'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
660
+				'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
661
+				'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
662
+				'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
663
+				'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
664
+				'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
665
+			],
666
+			'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
667
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
668
+			],
669
+			'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
670
+				'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
671
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
672
+			],
673
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
674
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
675
+			],
676
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
677
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
678
+			],
679
+			'EE_CPT_Strategy'                                                                                             => [
680
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
681
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
682
+			],
683
+			'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
684
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
685
+			],
686
+			'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
687
+				null,
688
+				null,
689
+				null,
690
+				'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
691
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
692
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
693
+			],
694
+			'EventEspresso\core\services\dependencies\DependencyResolver'                                                 => [
695
+				'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
696
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
697
+				'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
698
+			],
699
+			'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver'                               => [
700
+				'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
701
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
702
+				'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
703
+			],
704
+			'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'                                          => [
705
+				'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
706
+				'EventEspresso\core\services\loaders\Loader'                                    => EE_Dependency_Map::load_from_cache,
707
+			],
708
+			'EventEspresso\core\services\routing\RouteMatchSpecificationManager'                                          => [
709
+				'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
710
+				'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
711
+			],
712
+			'EE_URL_Validation_Strategy'                                                                                  => [
713
+				null,
714
+				null,
715
+				'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
716
+			],
717
+			'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
718
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
719
+			],
720
+			'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
721
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
722
+			],
723
+			'EventEspresso\core\domain\services\converters\RestApiSpoofer'                                                => [
724
+				'WP_REST_Server'                                               => EE_Dependency_Map::load_from_cache,
725
+				'EED_Core_Rest_Api'                                            => EE_Dependency_Map::load_from_cache,
726
+				'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
727
+				null,
728
+			],
729
+			'EventEspresso\core\services\routing\RouteHandler'                                                            => [
730
+				'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache,
731
+				'EventEspresso\core\services\loaders\Loader'           => EE_Dependency_Map::load_from_cache,
732
+				'EventEspresso\core\services\request\Request'          => EE_Dependency_Map::load_from_cache,
733
+				'EventEspresso\core\services\routing\RouteCollection'  => EE_Dependency_Map::load_from_cache,
734
+			],
735
+			'EventEspresso\core\services\json\JsonDataNodeHandler'                                                        => [
736
+				'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
737
+			],
738
+			'EventEspresso\core\services\routing\Router'                                                                  => [
739
+				'EE_Dependency_Map'                                => EE_Dependency_Map::load_from_cache,
740
+				'EventEspresso\core\services\loaders\Loader'       => EE_Dependency_Map::load_from_cache,
741
+				'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache,
742
+			],
743
+			'EventEspresso\core\services\assets\AssetManifest' => [
744
+				'EventEspresso\core\domain\Domain'                 => EE_Dependency_Map::load_from_cache,
745
+			],
746
+		];
747
+	}
748
+
749
+
750
+	/**
751
+	 * Registers how core classes are loaded.
752
+	 * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
753
+	 *        'EE_Request_Handler' => 'load_core'
754
+	 *        'EE_Messages_Queue'  => 'load_lib'
755
+	 *        'EEH_Debug_Tools'    => 'load_helper'
756
+	 * or, if greater control is required, by providing a custom closure. For example:
757
+	 *        'Some_Class' => function () {
758
+	 *            return new Some_Class();
759
+	 *        },
760
+	 * This is required for instantiating dependencies
761
+	 * where an interface has been type hinted in a class constructor. For example:
762
+	 *        'Required_Interface' => function () {
763
+	 *            return new A_Class_That_Implements_Required_Interface();
764
+	 *        },
765
+	 */
766
+	protected function _register_core_class_loaders()
767
+	{
768
+		$this->_class_loaders = [
769
+			// load_core
770
+			'EE_Dependency_Map'                            => function () {
771
+				return $this;
772
+			},
773
+			'EE_Capabilities'                              => 'load_core',
774
+			'EE_Encryption'                                => 'load_core',
775
+			'EE_Front_Controller'                          => 'load_core',
776
+			'EE_Module_Request_Router'                     => 'load_core',
777
+			'EE_Registry'                                  => 'load_core',
778
+			'EE_Request'                                   => function () {
779
+				return $this->legacy_request;
780
+			},
781
+			'EventEspresso\core\services\request\Request'  => function () {
782
+				return $this->request;
783
+			},
784
+			'EventEspresso\core\services\request\Response' => function () {
785
+				return $this->response;
786
+			},
787
+			'EE_Base'                                      => 'load_core',
788
+			'EE_Request_Handler'                           => 'load_core',
789
+			'EE_Session'                                   => 'load_core',
790
+			'EE_Cron_Tasks'                                => 'load_core',
791
+			'EE_System'                                    => 'load_core',
792
+			'EE_Maintenance_Mode'                          => 'load_core',
793
+			'EE_Register_CPTs'                             => 'load_core',
794
+			'EE_Admin'                                     => 'load_core',
795
+			'EE_CPT_Strategy'                              => 'load_core',
796
+			// load_class
797
+			'EE_Registration_Processor'                    => 'load_class',
798
+			// load_lib
799
+			'EE_Message_Resource_Manager'                  => 'load_lib',
800
+			'EE_Message_Type_Collection'                   => 'load_lib',
801
+			'EE_Message_Type_Collection_Loader'            => 'load_lib',
802
+			'EE_Messenger_Collection'                      => 'load_lib',
803
+			'EE_Messenger_Collection_Loader'               => 'load_lib',
804
+			'EE_Messages_Processor'                        => 'load_lib',
805
+			'EE_Message_Repository'                        => 'load_lib',
806
+			'EE_Messages_Queue'                            => 'load_lib',
807
+			'EE_Messages_Data_Handler_Collection'          => 'load_lib',
808
+			'EE_Message_Template_Group_Collection'         => 'load_lib',
809
+			'EE_Payment_Method_Manager'                    => 'load_lib',
810
+			'EE_DMS_Core_4_1_0'                            => 'load_dms',
811
+			'EE_DMS_Core_4_2_0'                            => 'load_dms',
812
+			'EE_DMS_Core_4_3_0'                            => 'load_dms',
813
+			'EE_DMS_Core_4_5_0'                            => 'load_dms',
814
+			'EE_DMS_Core_4_6_0'                            => 'load_dms',
815
+			'EE_DMS_Core_4_7_0'                            => 'load_dms',
816
+			'EE_DMS_Core_4_8_0'                            => 'load_dms',
817
+			'EE_DMS_Core_4_9_0'                            => 'load_dms',
818
+			'EE_DMS_Core_4_10_0'                           => 'load_dms',
819
+			'EE_Messages_Generator'                        => static function () {
820
+				return EE_Registry::instance()->load_lib(
821
+					'Messages_Generator',
822
+					[],
823
+					false,
824
+					false
825
+				);
826
+			},
827
+			'EE_Messages_Template_Defaults'                => static function ($arguments = []) {
828
+				return EE_Registry::instance()->load_lib(
829
+					'Messages_Template_Defaults',
830
+					$arguments,
831
+					false,
832
+					false
833
+				);
834
+			},
835
+			// load_helper
836
+			'EEH_Parse_Shortcodes'                         => static function () {
837
+				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
838
+					return new EEH_Parse_Shortcodes();
839
+				}
840
+				return null;
841
+			},
842
+			'EE_Template_Config'                           => static function () {
843
+				return EE_Config::instance()->template_settings;
844
+			},
845
+			'EE_Currency_Config'                           => static function () {
846
+				return EE_Config::instance()->currency;
847
+			},
848
+			'EE_Registration_Config'                       => static function () {
849
+				return EE_Config::instance()->registration;
850
+			},
851
+			'EE_Core_Config'                               => static function () {
852
+				return EE_Config::instance()->core;
853
+			},
854
+			'EventEspresso\core\services\loaders\Loader'   => static function () {
855
+				return LoaderFactory::getLoader();
856
+			},
857
+			'EE_Network_Config'                            => static function () {
858
+				return EE_Network_Config::instance();
859
+			},
860
+			'EE_Config'                                    => static function () {
861
+				return EE_Config::instance();
862
+			},
863
+			'EventEspresso\core\domain\Domain'             => static function () {
864
+				return DomainFactory::getEventEspressoCoreDomain();
865
+			},
866
+			'EE_Admin_Config'                              => static function () {
867
+				return EE_Config::instance()->admin;
868
+			},
869
+			'EE_Organization_Config'                       => static function () {
870
+				return EE_Config::instance()->organization;
871
+			},
872
+			'EE_Network_Core_Config'                       => static function () {
873
+				return EE_Network_Config::instance()->core;
874
+			},
875
+			'EE_Environment_Config'                        => static function () {
876
+				return EE_Config::instance()->environment;
877
+			},
878
+			'EED_Core_Rest_Api'                            => static function () {
879
+				return EED_Core_Rest_Api::instance();
880
+			},
881
+			'WP_REST_Server'                               => static function () {
882
+				return rest_get_server();
883
+			},
884
+		];
885
+	}
886
+
887
+
888
+	/**
889
+	 * can be used for supplying alternate names for classes,
890
+	 * or for connecting interface names to instantiable classes
891
+	 *
892
+	 * @throws InvalidAliasException
893
+	 */
894
+	protected function _register_core_aliases()
895
+	{
896
+		$aliases = [
897
+			'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
898
+			'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
899
+			'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
900
+			'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
901
+			'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
902
+			'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
903
+			'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
904
+			'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
905
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
906
+			'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
907
+			'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
908
+			'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
909
+			'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
910
+			'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
911
+			'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
912
+			'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
913
+			'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
914
+			'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
915
+			'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
916
+			'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
917
+			'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
918
+			'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
919
+			'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
920
+			'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
921
+			'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
922
+			'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
923
+			'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
924
+			'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
925
+			'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
926
+			'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
927
+			'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
928
+			'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
929
+			'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
930
+			'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
931
+			'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
932
+			'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
933
+			'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
934
+			'Registration_Processor'                                                       => 'EE_Registration_Processor',
935
+		];
936
+		foreach ($aliases as $alias => $fqn) {
937
+			if (is_array($fqn)) {
938
+				foreach ($fqn as $class => $for_class) {
939
+					$this->class_cache->addAlias($class, $alias, $for_class);
940
+				}
941
+				continue;
942
+			}
943
+			$this->class_cache->addAlias($fqn, $alias);
944
+		}
945
+		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
946
+			$this->class_cache->addAlias(
947
+				'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
948
+				'EventEspresso\core\services\notices\NoticeConverterInterface'
949
+			);
950
+		}
951
+	}
952
+
953
+
954
+	/**
955
+	 * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
956
+	 * request Primarily used by unit tests.
957
+	 */
958
+	public function reset()
959
+	{
960
+		$this->_register_core_class_loaders();
961
+		$this->_register_core_dependencies();
962
+	}
963
+
964
+
965
+	/**
966
+	 * PLZ NOTE: a better name for this method would be is_alias()
967
+	 * because it returns TRUE if the provided fully qualified name IS an alias
968
+	 * WHY?
969
+	 * Because if a class is type hinting for a concretion,
970
+	 * then why would we need to find another class to supply it?
971
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
972
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
973
+	 * Don't go looking for some substitute.
974
+	 * Whereas if a class is type hinting for an interface...
975
+	 * then we need to find an actual class to use.
976
+	 * So the interface IS the alias for some other FQN,
977
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
978
+	 * represents some other class.
979
+	 *
980
+	 * @param string $fqn
981
+	 * @param string $for_class
982
+	 * @return bool
983
+	 * @deprecated 4.9.62.p
984
+	 */
985
+	public function has_alias($fqn = '', $for_class = '')
986
+	{
987
+		return $this->isAlias($fqn, $for_class);
988
+	}
989
+
990
+
991
+	/**
992
+	 * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
993
+	 * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
994
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
995
+	 *  for example:
996
+	 *      if the following two entries were added to the _aliases array:
997
+	 *          array(
998
+	 *              'interface_alias'           => 'some\namespace\interface'
999
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
1000
+	 *          )
1001
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1002
+	 *      to load an instance of 'some\namespace\classname'
1003
+	 *
1004
+	 * @param string $alias
1005
+	 * @param string $for_class
1006
+	 * @return string
1007
+	 * @deprecated 4.9.62.p
1008
+	 */
1009
+	public function get_alias($alias = '', $for_class = '')
1010
+	{
1011
+		return $this->getFqnForAlias($alias, $for_class);
1012
+	}
1013 1013
 }
Please login to merge, or discard this patch.