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