Completed
Branch EDTR/model-constants (8a6ec8)
by
unknown
09:07 queued 37s
created

EE_Dependency_Map   D

Complexity

Total Complexity 55

Size/Duplication

Total Lines 1153
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 8

Importance

Changes 0
Metric Value
dl 0
loc 1153
rs 4.9879
c 0
b 0
f 0
wmc 55
lcom 1
cbo 8

25 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A initialize() 0 6 1
A instance() 0 10 3
A setRequest() 0 4 1
A setLegacyRequest() 0 4 1
A setResponse() 0 4 1
A setLoader() 0 4 1
A register_dependencies() 0 7 1
B registerDependencies() 0 41 6
B register_class_loader() 0 31 7
A dependency_map() 0 4 1
A has() 0 8 3
A has_dependency_for_class() 0 11 3
A loading_strategy_for_class_dependency() 0 11 3
A class_loader() 0 16 5
A class_loaders() 0 4 1
A add_alias() 0 4 1
A isAlias() 0 4 1
A getFqnForAlias() 0 4 1
B _register_core_dependencies() 0 466 1
B _register_core_class_loaders() 0 120 2
B _register_core_aliases() 0 58 7
A reset() 0 5 1
A has_alias() 0 4 1
A get_alias() 0 4 1

How to fix   Complexity   

Complex Class

Complex classes like EE_Dependency_Map often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use EE_Dependency_Map, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
use EventEspresso\core\domain\DomainFactory;
4
use EventEspresso\core\services\loaders\ClassInterfaceCache;
5
use EventEspresso\core\services\loaders\LoaderFactory;
6
use EventEspresso\core\services\loaders\LoaderInterface;
7
use EventEspresso\core\services\request\LegacyRequestInterface;
8
use EventEspresso\core\services\request\RequestInterface;
9
use EventEspresso\core\services\request\ResponseInterface;
10
11
/**
12
 * Class EE_Dependency_Map
13
 * info about how to load classes required by other classes
14
 *
15
 * @package       Event Espresso
16
 * @subpackage    core
17
 * @author        Brent Christensen
18
 * @since         4.9.0
19
 */
20
class EE_Dependency_Map
21
{
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
                'EventEspresso\core\services\session\SessionStartHandler'  => EE_Dependency_Map::load_from_cache,
460
                'EE_Encryption'                                            => EE_Dependency_Map::load_from_cache,
461
            ),
462
            'EE_Cart'                                                                                                     => array(
463
                'EE_Session' => EE_Dependency_Map::load_from_cache,
464
            ),
465
            'EE_Front_Controller'                                                                                         => array(
466
                'EE_Registry'              => EE_Dependency_Map::load_from_cache,
467
                'EE_Request_Handler'       => EE_Dependency_Map::load_from_cache,
468
                'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,
469
            ),
470
            'EE_Messenger_Collection_Loader'                                                                              => array(
471
                'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
472
            ),
473
            'EE_Message_Type_Collection_Loader'                                                                           => array(
474
                'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
475
            ),
476
            'EE_Message_Resource_Manager'                                                                                 => array(
477
                'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
478
                'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
479
                'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
480
            ),
481
            'EE_Message_Factory'                                                                                          => array(
482
                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
483
            ),
484
            'EE_messages'                                                                                                 => array(
485
                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
486
            ),
487
            'EE_Messages_Generator'                                                                                       => array(
488
                'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
489
                'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
490
                'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
491
                'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
492
            ),
493
            'EE_Messages_Processor'                                                                                       => array(
494
                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
495
            ),
496
            'EE_Messages_Queue'                                                                                           => array(
497
                'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
498
            ),
499
            'EE_Messages_Template_Defaults'                                                                               => array(
500
                'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
501
                'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
502
            ),
503
            'EE_Message_To_Generate_From_Request'                                                                         => array(
504
                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
505
                'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
506
            ),
507
            'EventEspresso\core\services\commands\CommandBus'                                                             => array(
508
                'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
509
            ),
510
            'EventEspresso\services\commands\CommandHandler'                                                              => array(
511
                'EE_Registry'         => EE_Dependency_Map::load_from_cache,
512
                'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
513
            ),
514
            'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => array(
515
                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
516
            ),
517
            'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => array(
518
                'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
519
                'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
520
            ),
521
            'EventEspresso\core\services\commands\CommandFactory'                                                         => array(
522
                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
523
            ),
524
            'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => array(
525
                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
526
            ),
527
            'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => array(
528
                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
529
            ),
530
            'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => array(
531
                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
532
            ),
533
            'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => array(
534
                'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
535
            ),
536
            'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => array(
537
                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
538
            ),
539
            'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => array(
540
                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
541
            ),
542
            'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => array(
543
                'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
544
            ),
545
            'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array(
546
                'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
547
            ),
548
            'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => array(
549
                'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
550
            ),
551
            'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => array(
552
                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
553
            ),
554
            'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => array(
555
                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
556
            ),
557
            'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => array(
558
                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
559
            ),
560
            'EventEspresso\core\services\database\TableManager'                                                           => array(
561
                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
562
            ),
563
            'EE_Data_Migration_Class_Base'                                                                                => array(
564
                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
565
                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
566
            ),
567
            'EE_DMS_Core_4_1_0'                                                                                           => array(
568
                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
569
                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
570
            ),
571
            'EE_DMS_Core_4_2_0'                                                                                           => array(
572
                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
573
                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
574
            ),
575
            'EE_DMS_Core_4_3_0'                                                                                           => array(
576
                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
577
                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
578
            ),
579
            'EE_DMS_Core_4_4_0'                                                                                           => array(
580
                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
581
                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
582
            ),
583
            'EE_DMS_Core_4_5_0'                                                                                           => array(
584
                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
585
                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
586
            ),
587
            'EE_DMS_Core_4_6_0'                                                                                           => array(
588
                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
589
                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
590
            ),
591
            'EE_DMS_Core_4_7_0'                                                                                           => array(
592
                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
593
                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
594
            ),
595
            'EE_DMS_Core_4_8_0'                                                                                           => array(
596
                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
597
                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
598
            ),
599
            'EE_DMS_Core_4_9_0' => array(
600
                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
601
                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
602
            ),
603
            'EE_DMS_Core_4_10_0' => array(
604
                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
605
                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
606
                'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
607
            ),
608
            'EventEspresso\core\services\assets\I18nRegistry'                                                             => array(
609
                array(),
610
                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
611
            ),
612
            'EventEspresso\core\services\assets\Registry'                                                                 => array(
613
                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
614
                'EventEspresso\core\services\assets\I18nRegistry'    => EE_Dependency_Map::load_from_cache,
615
            ),
616
            'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled'                                             => array(
617
                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
618
            ),
619
            'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout'                                              => array(
620
                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
621
            ),
622
            'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees'                                        => array(
623
                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
624
            ),
625
            'EventEspresso\core\domain\entities\shortcodes\EspressoEvents'                                                => array(
626
                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
627
            ),
628
            'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou'                                              => array(
629
                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
630
            ),
631
            'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector'                                        => array(
632
                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
633
            ),
634
            'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage'                                               => array(
635
                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
636
            ),
637
            'EventEspresso\core\services\cache\BasicCacheManager'                                                         => array(
638
                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
639
            ),
640
            'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => array(
641
                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
642
            ),
643
            'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => array(
644
                'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
645
                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
646
            ),
647
            'EventEspresso\core\domain\values\EmailAddress'                                                               => array(
648
                null,
649
                'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
650
            ),
651
            'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => array(
652
                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
653
            ),
654
            'LEGACY_MODELS'                                                                                               => array(
655
                null,
656
                'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
657
            ),
658
            'EE_Module_Request_Router'                                                                                    => array(
659
                'EE_Request' => EE_Dependency_Map::load_from_cache,
660
            ),
661
            'EE_Registration_Processor'                                                                                   => array(
662
                'EE_Request' => EE_Dependency_Map::load_from_cache,
663
            ),
664
            'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => array(
665
                null,
666
                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
667
                'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
668
            ),
669
            'EventEspresso\core\services\licensing\LicenseService'                                                        => array(
670
                'EventEspresso\core\domain\services\pue\Stats'  => EE_Dependency_Map::load_from_cache,
671
                'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache,
672
            ),
673
            'EE_Admin_Transactions_List_Table'                                                                            => array(
674
                null,
675
                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache,
676
            ),
677
            'EventEspresso\core\domain\services\pue\Stats'                                                                => array(
678
                'EventEspresso\core\domain\services\pue\Config'        => EE_Dependency_Map::load_from_cache,
679
                'EE_Maintenance_Mode'                                  => EE_Dependency_Map::load_from_cache,
680
                'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache,
681
            ),
682
            'EventEspresso\core\domain\services\pue\Config'                                                               => array(
683
                'EE_Network_Config' => EE_Dependency_Map::load_from_cache,
684
                'EE_Config'         => EE_Dependency_Map::load_from_cache,
685
            ),
686
            'EventEspresso\core\domain\services\pue\StatsGatherer'                                                        => array(
687
                'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
688
                'EEM_Event'          => EE_Dependency_Map::load_from_cache,
689
                'EEM_Datetime'       => EE_Dependency_Map::load_from_cache,
690
                'EEM_Ticket'         => EE_Dependency_Map::load_from_cache,
691
                'EEM_Registration'   => EE_Dependency_Map::load_from_cache,
692
                'EEM_Transaction'    => EE_Dependency_Map::load_from_cache,
693
                'EE_Config'          => EE_Dependency_Map::load_from_cache,
694
            ),
695
            'EventEspresso\core\domain\services\admin\ExitModal'                                                          => array(
696
                'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache,
697
            ),
698
            'EventEspresso\core\domain\services\admin\PluginUpsells'                                                      => array(
699
                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
700
            ),
701
            'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => array(
702
                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
703
                'EE_Session'             => EE_Dependency_Map::load_from_cache,
704
            ),
705
            'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings'                                => array(
706
                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
707
            ),
708
            'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => array(
709
                'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
710
                'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
711
                'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
712
                'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
713
                'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
714
            ),
715
            'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => array(
716
                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
717
            ),
718
            'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => array(
719
                'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
720
                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
721
            ),
722
            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => array(
723
                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
724
            ),
725
            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => array(
726
                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
727
            ),
728
            'EE_CPT_Strategy'                                                                                             => array(
729
                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
730
                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
731
            ),
732
            'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => array(
733
                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
734
            ),
735
            'EventEspresso\core\domain\services\assets\CoreAssetManager'                                                  => array(
736
                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
737
                'EE_Currency_Config'                                 => EE_Dependency_Map::load_from_cache,
738
                'EE_Template_Config'                                 => EE_Dependency_Map::load_from_cache,
739
                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
740
                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
741
            ),
742
            'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => array(
743
                'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
744
                'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache
745
            ),
746
            'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => array(
747
                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
748
            ),
749
            'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => array(
750
                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
751
                'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache
752
            ),
753
            'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => array(
754
                'EEM_Checkin' => EE_Dependency_Map::load_from_cache,
755
            ),
756
            'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => array(
757
                'EEM_Registration' => EE_Dependency_Map::load_from_cache,
758
            ),
759
            'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => array(
760
                'EEM_Transaction' => EE_Dependency_Map::load_from_cache,
761
            ),
762
            'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => array(
763
                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
764
            ),
765
            'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => array(
766
                'EEM_Answer' => EE_Dependency_Map::load_from_cache,
767
                'EEM_Question' => EE_Dependency_Map::load_from_cache,
768
            ),
769
            'EventEspresso\core\CPTs\CptQueryModifier' => array(
770
                null,
771
                null,
772
                null,
773
                'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
774
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
775
                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
776
            ),
777
            'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => array(
778
                'EE_Registry' => EE_Dependency_Map::load_from_cache,
779
                'EE_Config' => EE_Dependency_Map::load_from_cache
780
            ),
781
            'EventEspresso\core\services\editor\BlockRegistrationManager'                                                 => array(
782
                'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache,
783
                'EventEspresso\core\domain\entities\editor\BlockCollection'      => EE_Dependency_Map::load_from_cache,
784
                'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache,
785
                'EventEspresso\core\services\request\Request'                    => EE_Dependency_Map::load_from_cache,
786
            ),
787
            'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => array(
788
                'EventEspresso\core\domain\Domain'                   => EE_Dependency_Map::load_from_cache,
789
                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache,
790
                'EventEspresso\core\services\assets\Registry'        => EE_Dependency_Map::load_from_cache,
791
            ),
792
            'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => array(
793
                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
794
                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
795
            ),
796
            'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => array(
797
                'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache,
798
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
799
                'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache,
800
            ),
801
            'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => array(
802
                'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache,
803
                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
804
                'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache,
805
            ),
806
            'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => array(
807
                'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
808
                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
809
            ),
810
            'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => array(
811
                'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
812
                'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache,
813
            ),
814
            'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => array(
815
                'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache
816
            ),
817
            'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => array(
818
                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
819
            ),
820
            'EventEspresso\core\libraries\rest_api\controllers\model\Read' => array(
821
                'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache
822
            ),
823
            'EventEspresso\core\libraries\rest_api\calculations\Datetime' => array(
824
                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
825
                'EEM_Registration' => EE_Dependency_Map::load_from_cache
826
            ),
827
            'EventEspresso\core\libraries\rest_api\calculations\Event' => array(
828
                'EEM_Event' => EE_Dependency_Map::load_from_cache,
829
                'EEM_Registration' => EE_Dependency_Map::load_from_cache
830
            ),
831
            'EventEspresso\core\libraries\rest_api\calculations\Registration' => array(
832
                'EEM_Registration' => EE_Dependency_Map::load_from_cache
833
            ),
834
            'EventEspresso\core\services\session\SessionStartHandler' => array(
835
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
836
            ),
837
            'EE_URL_Validation_Strategy' => array(
838
                null,
839
                null,
840
                'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache
841
            ),
842
            'EventEspresso\admin_pages\general_settings\OrganizationSettings' => array(
843
                'EE_Registry'                                             => EE_Dependency_Map::load_from_cache,
844
                'EE_Organization_Config'                                  => EE_Dependency_Map::load_from_cache,
845
                'EE_Core_Config'                                          => EE_Dependency_Map::load_from_cache,
846
                'EE_Network_Core_Config'                                  => EE_Dependency_Map::load_from_cache,
847
                'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache,
848
            ),
849
            'EventEspresso\core\services\address\CountrySubRegionDao' => array(
850
                'EEM_State'                                            => EE_Dependency_Map::load_from_cache,
851
                'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache
852
            ),
853
            'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => array(
854
                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
855
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
856
            ),
857
            'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => array(
858
                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
859
                'EE_Environment_Config'            => EE_Dependency_Map::load_from_cache,
860
            ),
861
            'EventEspresso\core\services\request\files\FilesDataHandler' => array(
862
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
863
            ),
864
            'EventEspressoBatchRequest\BatchRequestProcessor' => [
865
                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
866
            ],
867
            'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [
868
                null,
869
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
870
                'EEM_Registration'  => EE_Dependency_Map::load_from_cache,
871
            ],
872
            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [
873
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
874
                'EEM_Attendee'  => EE_Dependency_Map::load_from_cache,
875
            ],
876
            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [
877
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
878
                'EEM_Datetime'  => EE_Dependency_Map::load_from_cache,
879
            ],
880
            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [
881
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
882
                'EEM_Event'  => EE_Dependency_Map::load_from_cache,
883
            ],
884
            'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [
885
                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
886
                'EEM_Ticket'  => EE_Dependency_Map::load_from_cache,
887
            ],
888
            'EventEspresso\core\domain\services\converters\RestApiSpoofer' => [
889
                'WP_REST_Server' => EE_Dependency_Map::load_from_cache,
890
                'EED_Core_Rest_Api' => EE_Dependency_Map::load_from_cache,
891
                'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
892
                null
893
            ],
894
            'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection'  => [
895
                'EE_Admin_Config' => EE_Dependency_Map::load_from_cache
896
            ],
897
            'EventEspresso\core\domain\services\admin\events\editor\AdvancedEditorEntityData'  => [
898
                'EventEspresso\core\domain\services\converters\RestApiSpoofer' => EE_Dependency_Map::load_from_cache,
899
                'EE_Admin_Config' => EE_Dependency_Map::load_from_cache,
900
                'EEM_Datetime'    => EE_Dependency_Map::load_from_cache,
901
                'EEM_Event'       => EE_Dependency_Map::load_from_cache,
902
                'EEM_Price'       => EE_Dependency_Map::load_from_cache,
903
                'EEM_Price_Type'  => EE_Dependency_Map::load_from_cache,
904
                'EEM_Ticket'      => EE_Dependency_Map::load_from_cache,
905
                'EEM_Venue'       => EE_Dependency_Map::load_from_cache,
906
            ],
907
        );
908
    }
909
910
911
    /**
912
     * Registers how core classes are loaded.
913
     * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
914
     *        'EE_Request_Handler' => 'load_core'
915
     *        'EE_Messages_Queue'  => 'load_lib'
916
     *        'EEH_Debug_Tools'    => 'load_helper'
917
     * or, if greater control is required, by providing a custom closure. For example:
918
     *        'Some_Class' => function () {
919
     *            return new Some_Class();
920
     *        },
921
     * This is required for instantiating dependencies
922
     * where an interface has been type hinted in a class constructor. For example:
923
     *        'Required_Interface' => function () {
924
     *            return new A_Class_That_Implements_Required_Interface();
925
     *        },
926
     */
927
    protected function _register_core_class_loaders()
928
    {
929
        $this->_class_loaders = array(
930
            // load_core
931
            'EE_Dependency_Map'                            => function () {
932
                return $this;
933
            },
934
            'EE_Capabilities'                              => 'load_core',
935
            'EE_Encryption'                                => 'load_core',
936
            'EE_Front_Controller'                          => 'load_core',
937
            'EE_Module_Request_Router'                     => 'load_core',
938
            'EE_Registry'                                  => 'load_core',
939
            'EE_Request'                                   => function () {
940
                return $this->legacy_request;
941
            },
942
            'EventEspresso\core\services\request\Request'  => function () {
943
                return $this->request;
944
            },
945
            'EventEspresso\core\services\request\Response' => function () {
946
                return $this->response;
947
            },
948
            'EE_Base'                                      => 'load_core',
949
            'EE_Request_Handler'                           => 'load_core',
950
            'EE_Session'                                   => 'load_core',
951
            'EE_Cron_Tasks'                                => 'load_core',
952
            'EE_System'                                    => 'load_core',
953
            'EE_Maintenance_Mode'                          => 'load_core',
954
            'EE_Register_CPTs'                             => 'load_core',
955
            'EE_Admin'                                     => 'load_core',
956
            'EE_CPT_Strategy'                              => 'load_core',
957
            // load_class
958
            'EE_Registration_Processor'                    => 'load_class',
959
            // load_lib
960
            'EE_Message_Resource_Manager'                  => 'load_lib',
961
            'EE_Message_Type_Collection'                   => 'load_lib',
962
            'EE_Message_Type_Collection_Loader'            => 'load_lib',
963
            'EE_Messenger_Collection'                      => 'load_lib',
964
            'EE_Messenger_Collection_Loader'               => 'load_lib',
965
            'EE_Messages_Processor'                        => 'load_lib',
966
            'EE_Message_Repository'                        => 'load_lib',
967
            'EE_Messages_Queue'                            => 'load_lib',
968
            'EE_Messages_Data_Handler_Collection'          => 'load_lib',
969
            'EE_Message_Template_Group_Collection'         => 'load_lib',
970
            'EE_Payment_Method_Manager'                    => 'load_lib',
971
            'EE_DMS_Core_4_1_0'                            => 'load_dms',
972
            'EE_DMS_Core_4_2_0'                            => 'load_dms',
973
            'EE_DMS_Core_4_3_0'                            => 'load_dms',
974
            'EE_DMS_Core_4_5_0'                            => 'load_dms',
975
            'EE_DMS_Core_4_6_0'                            => 'load_dms',
976
            'EE_DMS_Core_4_7_0'                            => 'load_dms',
977
            'EE_DMS_Core_4_8_0'                            => 'load_dms',
978
            'EE_DMS_Core_4_9_0'                            => 'load_dms',
979
            'EE_DMS_Core_4_10_0'                            => 'load_dms',
980
            'EE_Messages_Generator'                        => function () {
981
                return EE_Registry::instance()->load_lib(
982
                    'Messages_Generator',
983
                    array(),
984
                    false,
985
                    false
986
                );
987
            },
988
            'EE_Messages_Template_Defaults'                => function ($arguments = array()) {
989
                return EE_Registry::instance()->load_lib(
990
                    'Messages_Template_Defaults',
991
                    $arguments,
992
                    false,
993
                    false
994
                );
995
            },
996
            // load_helper
997
            'EEH_Parse_Shortcodes'                         => function () {
998
                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
999
                    return new EEH_Parse_Shortcodes();
1000
                }
1001
                return null;
1002
            },
1003
            'EE_Template_Config'                           => function () {
1004
                return EE_Config::instance()->template_settings;
1005
            },
1006
            'EE_Currency_Config'                           => function () {
1007
                return EE_Config::instance()->currency;
1008
            },
1009
            'EE_Registration_Config'                       => function () {
1010
                return EE_Config::instance()->registration;
1011
            },
1012
            'EE_Core_Config'                               => function () {
1013
                return EE_Config::instance()->core;
1014
            },
1015
            'EventEspresso\core\services\loaders\Loader'   => function () {
1016
                return LoaderFactory::getLoader();
1017
            },
1018
            'EE_Network_Config'                            => function () {
1019
                return EE_Network_Config::instance();
1020
            },
1021
            'EE_Config'                                    => function () {
1022
                return EE_Config::instance();
1023
            },
1024
            'EventEspresso\core\domain\Domain'             => function () {
1025
                return DomainFactory::getEventEspressoCoreDomain();
1026
            },
1027
            'EE_Admin_Config'                              => function () {
1028
                return EE_Config::instance()->admin;
1029
            },
1030
            'EE_Organization_Config'                       => function () {
1031
                return EE_Config::instance()->organization;
1032
            },
1033
            'EE_Network_Core_Config'                       => function () {
1034
                return EE_Network_Config::instance()->core;
1035
            },
1036
            'EE_Environment_Config'                        => function () {
1037
                return EE_Config::instance()->environment;
1038
            },
1039
            'EED_Core_Rest_Api'                            => static function () {
1040
                return EED_Core_Rest_Api::instance();
1041
            },
1042
            'WP_REST_Server'                            => static function () {
1043
                return rest_get_server();
1044
            },
1045
        );
1046
    }
1047
1048
1049
    /**
1050
     * can be used for supplying alternate names for classes,
1051
     * or for connecting interface names to instantiable classes
1052
     */
1053
    protected function _register_core_aliases()
1054
    {
1055
        $aliases = array(
1056
            'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
1057
            'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
1058
            'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
1059
            'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
1060
            'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
1061
            'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
1062
            'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1063
            'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
1064
            'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
1065
            'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
1066
            'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
1067
            'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
1068
            'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
1069
            'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
1070
            'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
1071
            'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
1072
            'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
1073
            'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
1074
            'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
1075
            'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
1076
            'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1077
            'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
1078
            'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
1079
            'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
1080
            'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
1081
            'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
1082
            'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
1083
            'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
1084
            'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
1085
            'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
1086
            'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
1087
            'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
1088
            'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
1089
            'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
1090
            'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
1091
            'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
1092
            'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
1093
            'Registration_Processor'                                                       => 'EE_Registration_Processor',
1094
        );
1095
        foreach ($aliases as $alias => $fqn) {
1096
            if (is_array($fqn)) {
1097
                foreach ($fqn as $class => $for_class) {
1098
                    $this->class_cache->addAlias($class, $alias, $for_class);
1099
                }
1100
                continue;
1101
            }
1102
            $this->class_cache->addAlias($fqn, $alias);
1103
        }
1104
        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
1105
            $this->class_cache->addAlias(
1106
                'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
1107
                'EventEspresso\core\services\notices\NoticeConverterInterface'
1108
            );
1109
        }
1110
    }
1111
1112
1113
    /**
1114
     * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
1115
     * request Primarily used by unit tests.
1116
     */
1117
    public function reset()
1118
    {
1119
        $this->_register_core_class_loaders();
1120
        $this->_register_core_dependencies();
1121
    }
1122
1123
1124
    /**
1125
     * PLZ NOTE: a better name for this method would be is_alias()
1126
     * because it returns TRUE if the provided fully qualified name IS an alias
1127
     * WHY?
1128
     * Because if a class is type hinting for a concretion,
1129
     * then why would we need to find another class to supply it?
1130
     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
1131
     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
1132
     * Don't go looking for some substitute.
1133
     * Whereas if a class is type hinting for an interface...
1134
     * then we need to find an actual class to use.
1135
     * So the interface IS the alias for some other FQN,
1136
     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
1137
     * represents some other class.
1138
     *
1139
     * @deprecated 4.9.62.p
1140
     * @param string $fqn
1141
     * @param string $for_class
1142
     * @return bool
1143
     */
1144
    public function has_alias($fqn = '', $for_class = '')
1145
    {
1146
        return $this->isAlias($fqn, $for_class);
1147
    }
1148
1149
1150
    /**
1151
     * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
1152
     * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
1153
     * functions recursively, so that multiple aliases can be used to drill down to a FQN
1154
     *  for example:
1155
     *      if the following two entries were added to the _aliases array:
1156
     *          array(
1157
     *              'interface_alias'           => 'some\namespace\interface'
1158
     *              'some\namespace\interface'  => 'some\namespace\classname'
1159
     *          )
1160
     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1161
     *      to load an instance of 'some\namespace\classname'
1162
     *
1163
     * @deprecated 4.9.62.p
1164
     * @param string $alias
1165
     * @param string $for_class
1166
     * @return string
1167
     */
1168
    public function get_alias($alias = '', $for_class = '')
1169
    {
1170
        return $this->getFqnForAlias($alias, $for_class);
1171
    }
1172
}
1173