Completed
Branch FET/11400/gutenberg-block-mana... (002e7d)
by
unknown
13:10
created
core/domain/entities/editor/blocks/Venue.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -20,81 +20,81 @@
 block discarded – undo
20 20
 class Venue extends EditorBlock
21 21
 {
22 22
 
23
-    const EDITOR_BLOCK_TYPE = 'ee-event-editor/venue-container';
24
-
25
-
26
-    /**
27
-     * Perform any early setup required by the block
28
-     * including setting the block type and supported post types
29
-     *
30
-     * @return void
31
-     */
32
-    public function initialize()
33
-    {
34
-        $this->setEditorBlockType(Venue::EDITOR_BLOCK_TYPE);
35
-        $this->setSupportedPostTypes(array('espresso_events', 'post', 'page'));
36
-    }
37
-
38
-
39
-    /**
40
-     * Registers the Editor Block with WP core;
41
-     * Returns the registered block type on success, or false on failure.
42
-     *
43
-     * @return WP_Block_Type|false
44
-     */
45
-    public function registerBlock()
46
-    {
47
-        $wp_block_type = register_block_type(
48
-            new WP_Block_Type(
49
-                $this->editorBlockType(),
50
-                array(
51
-                    'editor_script' => 'ee-event-editor-blocks',
52
-                    'editor_style'  => 'ee-block-styles',
53
-                    'attributes'    => array(),
54
-                )
55
-            )
56
-        );
57
-        $this->setWpBlockType($wp_block_type);
58
-        return $wp_block_type;
59
-    }
60
-
61
-
62
-    /**
63
-     * @return array
64
-     */
65
-    public function getEditorContainer()
66
-    {
67
-        return array(
68
-            $this->editorBlockType(),
69
-            array()
70
-        );
71
-    }
72
-
73
-
74
-    /**
75
-     * @return  void
76
-     */
77
-    public function registerScripts()
78
-    {
79
-    }
80
-
81
-
82
-    /**
83
-     * @return void
84
-     */
85
-    public function registerStyles()
86
-    {
87
-    }
88
-
89
-
90
-    /**
91
-     * returns the rendered HTML for the block
92
-     *
93
-     * @param array $attributes
94
-     * @return string
95
-     */
96
-    public function renderBlock(array $attributes = array())
97
-    {
98
-        return '';
99
-    }
23
+	const EDITOR_BLOCK_TYPE = 'ee-event-editor/venue-container';
24
+
25
+
26
+	/**
27
+	 * Perform any early setup required by the block
28
+	 * including setting the block type and supported post types
29
+	 *
30
+	 * @return void
31
+	 */
32
+	public function initialize()
33
+	{
34
+		$this->setEditorBlockType(Venue::EDITOR_BLOCK_TYPE);
35
+		$this->setSupportedPostTypes(array('espresso_events', 'post', 'page'));
36
+	}
37
+
38
+
39
+	/**
40
+	 * Registers the Editor Block with WP core;
41
+	 * Returns the registered block type on success, or false on failure.
42
+	 *
43
+	 * @return WP_Block_Type|false
44
+	 */
45
+	public function registerBlock()
46
+	{
47
+		$wp_block_type = register_block_type(
48
+			new WP_Block_Type(
49
+				$this->editorBlockType(),
50
+				array(
51
+					'editor_script' => 'ee-event-editor-blocks',
52
+					'editor_style'  => 'ee-block-styles',
53
+					'attributes'    => array(),
54
+				)
55
+			)
56
+		);
57
+		$this->setWpBlockType($wp_block_type);
58
+		return $wp_block_type;
59
+	}
60
+
61
+
62
+	/**
63
+	 * @return array
64
+	 */
65
+	public function getEditorContainer()
66
+	{
67
+		return array(
68
+			$this->editorBlockType(),
69
+			array()
70
+		);
71
+	}
72
+
73
+
74
+	/**
75
+	 * @return  void
76
+	 */
77
+	public function registerScripts()
78
+	{
79
+	}
80
+
81
+
82
+	/**
83
+	 * @return void
84
+	 */
85
+	public function registerStyles()
86
+	{
87
+	}
88
+
89
+
90
+	/**
91
+	 * returns the rendered HTML for the block
92
+	 *
93
+	 * @param array $attributes
94
+	 * @return string
95
+	 */
96
+	public function renderBlock(array $attributes = array())
97
+	{
98
+		return '';
99
+	}
100 100
 }
Please login to merge, or discard this patch.
core/domain/entities/editor/EditorBlock.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -26,93 +26,93 @@
 block discarded – undo
26 26
 abstract class EditorBlock implements EditorBlockInterface
27 27
 {
28 28
 
29
-    /**
30
-     * @var LoaderInterface $loader
31
-     */
32
-    protected $loader;
33
-
34
-    /**
35
-     * @var string $editor_block_type
36
-     */
37
-    private $editor_block_type;
38
-
39
-    /**
40
-     * @var WP_Block_Type $wp_block_type
41
-     */
42
-    private $wp_block_type;
43
-
44
-    /**
45
-     * @var array $supported_post_types
46
-     */
47
-    private $supported_post_types;
48
-
49
-
50
-    /**
51
-     * EditorBlockLoader constructor.
52
-     *
53
-     * @param LoaderInterface $loader
54
-     */
55
-    public function __construct(LoaderInterface $loader)
56
-    {
57
-        $this->loader = $loader;
58
-    }
59
-
60
-
61
-    /**
62
-     * @return string
63
-     */
64
-    public function editorBlockType()
65
-    {
66
-        return $this->editor_block_type;
67
-    }
68
-
69
-
70
-    /**
71
-     * @param string $editor_block_type
72
-     */
73
-    protected function setEditorBlockType($editor_block_type)
74
-    {
75
-        $this->editor_block_type = $editor_block_type;
76
-    }
77
-
78
-
79
-    /**
80
-     * @param WP_Block_Type $wp_block_type
81
-     */
82
-    protected function setWpBlockType($wp_block_type)
83
-    {
84
-        $this->wp_block_type = $wp_block_type;
85
-    }
86
-
87
-
88
-    /**
89
-     * @param array $supported_post_types
90
-     */
91
-    protected function setSupportedPostTypes(array $supported_post_types)
92
-    {
93
-        $this->supported_post_types = $supported_post_types;
94
-    }
95
-
96
-
97
-    /**
98
-     * @return WP_Block_Type|false The registered block type on success, or false on failure.
99
-     */
100
-    public function unRegisterBlock()
101
-    {
102
-        return unregister_block_type($this->editorBlockType());
103
-    }
104
-
105
-
106
-    /**
107
-     * returns true if the block type applies for the supplied post type
108
-     * and should be added to that post type's editor
109
-     *
110
-     * @param string $post_type
111
-     * @return boolean
112
-     */
113
-    public function appliesToPostType($post_type)
114
-    {
115
-        return in_array($post_type, $this->supported_post_types, true);
116
-    }
29
+	/**
30
+	 * @var LoaderInterface $loader
31
+	 */
32
+	protected $loader;
33
+
34
+	/**
35
+	 * @var string $editor_block_type
36
+	 */
37
+	private $editor_block_type;
38
+
39
+	/**
40
+	 * @var WP_Block_Type $wp_block_type
41
+	 */
42
+	private $wp_block_type;
43
+
44
+	/**
45
+	 * @var array $supported_post_types
46
+	 */
47
+	private $supported_post_types;
48
+
49
+
50
+	/**
51
+	 * EditorBlockLoader constructor.
52
+	 *
53
+	 * @param LoaderInterface $loader
54
+	 */
55
+	public function __construct(LoaderInterface $loader)
56
+	{
57
+		$this->loader = $loader;
58
+	}
59
+
60
+
61
+	/**
62
+	 * @return string
63
+	 */
64
+	public function editorBlockType()
65
+	{
66
+		return $this->editor_block_type;
67
+	}
68
+
69
+
70
+	/**
71
+	 * @param string $editor_block_type
72
+	 */
73
+	protected function setEditorBlockType($editor_block_type)
74
+	{
75
+		$this->editor_block_type = $editor_block_type;
76
+	}
77
+
78
+
79
+	/**
80
+	 * @param WP_Block_Type $wp_block_type
81
+	 */
82
+	protected function setWpBlockType($wp_block_type)
83
+	{
84
+		$this->wp_block_type = $wp_block_type;
85
+	}
86
+
87
+
88
+	/**
89
+	 * @param array $supported_post_types
90
+	 */
91
+	protected function setSupportedPostTypes(array $supported_post_types)
92
+	{
93
+		$this->supported_post_types = $supported_post_types;
94
+	}
95
+
96
+
97
+	/**
98
+	 * @return WP_Block_Type|false The registered block type on success, or false on failure.
99
+	 */
100
+	public function unRegisterBlock()
101
+	{
102
+		return unregister_block_type($this->editorBlockType());
103
+	}
104
+
105
+
106
+	/**
107
+	 * returns true if the block type applies for the supplied post type
108
+	 * and should be added to that post type's editor
109
+	 *
110
+	 * @param string $post_type
111
+	 * @return boolean
112
+	 */
113
+	public function appliesToPostType($post_type)
114
+	{
115
+		return in_array($post_type, $this->supported_post_types, true);
116
+	}
117 117
 
118 118
 }
Please login to merge, or discard this patch.
core/domain/entities/editor/EditorBlockInterface.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -25,72 +25,72 @@
 block discarded – undo
25 25
 interface EditorBlockInterface
26 26
 {
27 27
 
28
-    /**
29
-     * Perform any early setup required by the block
30
-     * including setting the block type and supported post types
31
-     *
32
-     * @return void
33
-     */
34
-    public function initialize();
35
-
36
-
37
-    /**
38
-     * @return string
39
-     */
40
-    public function editorBlockType();
41
-
42
-
43
-    /**
44
-     * Registers the Editor Block with WP core;
45
-     * Returns the registered block type on success, or false on failure.
46
-     *
47
-     * @return WP_Block_Type|false
48
-     */
49
-    public function registerBlock();
50
-
51
-
52
-    /**
53
-     * Un-registers the Editor Block with WP core;
54
-     * Returns the registered block type on success, or false on failure.
55
-     *
56
-     * @return WP_Block_Type|false
57
-     */
58
-    public function unRegisterBlock();
59
-
60
-
61
-    /**
62
-     * returns true if the block type applies for the supplied post type
63
-     * and should be added to that post type's editor
64
-     *
65
-     * @param string $post_type
66
-     * @return boolean
67
-     */
68
-    public function appliesToPostType($post_type);
69
-
70
-
71
-    /**
72
-     * @return array
73
-     */
74
-    public function getEditorContainer();
75
-
76
-
77
-    /**
78
-     * @return  void
79
-     */
80
-    public function registerScripts();
81
-
82
-
83
-    /**
84
-     * @return void
85
-     */
86
-    public function registerStyles();
87
-
88
-
89
-    /**
90
-     * returns the rendered HTML for the block
91
-     *
92
-     * @param array $attributes
93
-     * @return string
94
-     */
95
-    public function renderBlock(array $attributes = array());
28
+	/**
29
+	 * Perform any early setup required by the block
30
+	 * including setting the block type and supported post types
31
+	 *
32
+	 * @return void
33
+	 */
34
+	public function initialize();
35
+
36
+
37
+	/**
38
+	 * @return string
39
+	 */
40
+	public function editorBlockType();
41
+
42
+
43
+	/**
44
+	 * Registers the Editor Block with WP core;
45
+	 * Returns the registered block type on success, or false on failure.
46
+	 *
47
+	 * @return WP_Block_Type|false
48
+	 */
49
+	public function registerBlock();
50
+
51
+
52
+	/**
53
+	 * Un-registers the Editor Block with WP core;
54
+	 * Returns the registered block type on success, or false on failure.
55
+	 *
56
+	 * @return WP_Block_Type|false
57
+	 */
58
+	public function unRegisterBlock();
59
+
60
+
61
+	/**
62
+	 * returns true if the block type applies for the supplied post type
63
+	 * and should be added to that post type's editor
64
+	 *
65
+	 * @param string $post_type
66
+	 * @return boolean
67
+	 */
68
+	public function appliesToPostType($post_type);
69
+
70
+
71
+	/**
72
+	 * @return array
73
+	 */
74
+	public function getEditorContainer();
75
+
76
+
77
+	/**
78
+	 * @return  void
79
+	 */
80
+	public function registerScripts();
81
+
82
+
83
+	/**
84
+	 * @return void
85
+	 */
86
+	public function registerStyles();
87
+
88
+
89
+	/**
90
+	 * returns the rendered HTML for the block
91
+	 *
92
+	 * @param array $attributes
93
+	 * @return string
94
+	 */
95
+	public function renderBlock(array $attributes = array());
96 96
 }
Please login to merge, or discard this patch.
core/domain/DomainBase.php 2 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -19,126 +19,126 @@
 block discarded – undo
19 19
 abstract class DomainBase implements DomainInterface
20 20
 {
21 21
 
22
-    /**
23
-     * Equivalent to `__FILE__` for main plugin file.
24
-     *
25
-     * @var FilePath
26
-     */
27
-    private $plugin_file;
22
+	/**
23
+	 * Equivalent to `__FILE__` for main plugin file.
24
+	 *
25
+	 * @var FilePath
26
+	 */
27
+	private $plugin_file;
28 28
 
29
-    /**
30
-     * String indicating version for plugin
31
-     *
32
-     * @var string
33
-     */
34
-    private $version;
35
-
36
-    /**
37
-     * @var string $plugin_basename
38
-     */
39
-    private $plugin_basename;
40
-
41
-    /**
42
-     * @var string $plugin_path
43
-     */
44
-    private $plugin_path;
45
-
46
-    /**
47
-     * @var string $plugin_url
48
-     */
49
-    private $plugin_url;
50
-
51
-
52
-
53
-    /**
54
-     * Initializes internal properties.
55
-     *
56
-     * @param FilePath $plugin_file
57
-     * @param Version  $version
58
-     */
59
-    public function __construct(FilePath $plugin_file, Version $version)
60
-    {
61
-        $this->plugin_file = $plugin_file;
62
-        $this->version = $version;
63
-        $this->plugin_basename = plugin_basename($this->pluginFile());
64
-        $this->plugin_path = plugin_dir_path($this->pluginFile());
65
-        $this->plugin_url = plugin_dir_url($this->pluginFile());
66
-    }
67
-
68
-
69
-    /**
70
-     * @return string
71
-     */
72
-    public function pluginFile()
73
-    {
74
-        return (string) $this->plugin_file;
75
-    }
76
-
77
-
78
-
79
-    /**
80
-     * @return string
81
-     */
82
-    public function pluginBasename()
83
-    {
84
-        return $this->plugin_basename;
85
-    }
86
-
87
-
88
-
89
-    /**
90
-     * @return string
91
-     */
92
-    public function pluginPath()
93
-    {
94
-        return $this->plugin_path;
95
-    }
96
-
97
-
98
-
99
-    /**
100
-     * @return string
101
-     */
102
-    public function pluginUrl()
103
-    {
104
-        return $this->plugin_url;
105
-    }
106
-
107
-
108
-
109
-    /**
110
-     * @return string
111
-     */
112
-    public function version()
113
-    {
114
-        return (string) $this->version;
115
-    }
116
-
117
-
118
-
119
-    /**
120
-     * @return Version
121
-     */
122
-    public function versionValueObject()
123
-    {
124
-        return $this->version;
125
-    }
126
-
127
-
128
-    /**
129
-     * @return string
130
-     */
131
-    public function distributionAssetsPath()
132
-    {
133
-        return $this->pluginPath() . 'src/assets/dist/';
134
-    }
29
+	/**
30
+	 * String indicating version for plugin
31
+	 *
32
+	 * @var string
33
+	 */
34
+	private $version;
35
+
36
+	/**
37
+	 * @var string $plugin_basename
38
+	 */
39
+	private $plugin_basename;
40
+
41
+	/**
42
+	 * @var string $plugin_path
43
+	 */
44
+	private $plugin_path;
45
+
46
+	/**
47
+	 * @var string $plugin_url
48
+	 */
49
+	private $plugin_url;
50
+
51
+
52
+
53
+	/**
54
+	 * Initializes internal properties.
55
+	 *
56
+	 * @param FilePath $plugin_file
57
+	 * @param Version  $version
58
+	 */
59
+	public function __construct(FilePath $plugin_file, Version $version)
60
+	{
61
+		$this->plugin_file = $plugin_file;
62
+		$this->version = $version;
63
+		$this->plugin_basename = plugin_basename($this->pluginFile());
64
+		$this->plugin_path = plugin_dir_path($this->pluginFile());
65
+		$this->plugin_url = plugin_dir_url($this->pluginFile());
66
+	}
67
+
68
+
69
+	/**
70
+	 * @return string
71
+	 */
72
+	public function pluginFile()
73
+	{
74
+		return (string) $this->plugin_file;
75
+	}
76
+
77
+
78
+
79
+	/**
80
+	 * @return string
81
+	 */
82
+	public function pluginBasename()
83
+	{
84
+		return $this->plugin_basename;
85
+	}
86
+
87
+
88
+
89
+	/**
90
+	 * @return string
91
+	 */
92
+	public function pluginPath()
93
+	{
94
+		return $this->plugin_path;
95
+	}
96
+
97
+
98
+
99
+	/**
100
+	 * @return string
101
+	 */
102
+	public function pluginUrl()
103
+	{
104
+		return $this->plugin_url;
105
+	}
106
+
107
+
108
+
109
+	/**
110
+	 * @return string
111
+	 */
112
+	public function version()
113
+	{
114
+		return (string) $this->version;
115
+	}
116
+
117
+
118
+
119
+	/**
120
+	 * @return Version
121
+	 */
122
+	public function versionValueObject()
123
+	{
124
+		return $this->version;
125
+	}
126
+
127
+
128
+	/**
129
+	 * @return string
130
+	 */
131
+	public function distributionAssetsPath()
132
+	{
133
+		return $this->pluginPath() . 'src/assets/dist/';
134
+	}
135 135
 
136
-
137
-    /**
138
-     * @return string
139
-     */
140
-    public function distributionAssetsUrl()
141
-    {
142
-        return $this->pluginUrl() . 'src/assets/dist/';
143
-    }
136
+
137
+	/**
138
+	 * @return string
139
+	 */
140
+	public function distributionAssetsUrl()
141
+	{
142
+		return $this->pluginUrl() . 'src/assets/dist/';
143
+	}
144 144
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function distributionAssetsPath()
132 132
     {
133
-        return $this->pluginPath() . 'src/assets/dist/';
133
+        return $this->pluginPath().'src/assets/dist/';
134 134
     }
135 135
 
136 136
 
@@ -139,6 +139,6 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function distributionAssetsUrl()
141 141
     {
142
-        return $this->pluginUrl() . 'src/assets/dist/';
142
+        return $this->pluginUrl().'src/assets/dist/';
143 143
     }
144 144
 }
Please login to merge, or discard this patch.
core/EE_Dependency_Map.core.php 2 patches
Indentation   +848 added lines, -848 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use EventEspresso\core\services\request\ResponseInterface;
9 9
 
10 10
 if (! defined('EVENT_ESPRESSO_VERSION')) {
11
-    exit('No direct script access allowed');
11
+	exit('No direct script access allowed');
12 12
 }
13 13
 
14 14
 
@@ -25,853 +25,853 @@  discard block
 block discarded – undo
25 25
 class EE_Dependency_Map
26 26
 {
27 27
 
28
-    /**
29
-     * This means that the requested class dependency is not present in the dependency map
30
-     */
31
-    const not_registered = 0;
32
-
33
-    /**
34
-     * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.
35
-     */
36
-    const load_new_object = 1;
37
-
38
-    /**
39
-     * This instructs class loaders to return a previously instantiated and cached object for the requested class.
40
-     * IF a previously instantiated object does not exist, a new one will be created and added to the cache.
41
-     */
42
-    const load_from_cache = 2;
43
-
44
-    /**
45
-     * When registering a dependency,
46
-     * this indicates to keep any existing dependencies that already exist,
47
-     * and simply discard any new dependencies declared in the incoming data
48
-     */
49
-    const KEEP_EXISTING_DEPENDENCIES = 0;
50
-
51
-    /**
52
-     * When registering a dependency,
53
-     * this indicates to overwrite any existing dependencies that already exist using the incoming data
54
-     */
55
-    const OVERWRITE_DEPENDENCIES = 1;
56
-
57
-
58
-
59
-    /**
60
-     * @type EE_Dependency_Map $_instance
61
-     */
62
-    protected static $_instance;
63
-
64
-    /**
65
-     * @type RequestInterface $request
66
-     */
67
-    protected $request;
68
-
69
-    /**
70
-     * @type LegacyRequestInterface $legacy_request
71
-     */
72
-    protected $legacy_request;
73
-
74
-    /**
75
-     * @type ResponseInterface $response
76
-     */
77
-    protected $response;
78
-
79
-    /**
80
-     * @type LoaderInterface $loader
81
-     */
82
-    protected $loader;
83
-
84
-    /**
85
-     * @type array $_dependency_map
86
-     */
87
-    protected $_dependency_map = array();
88
-
89
-    /**
90
-     * @type array $_class_loaders
91
-     */
92
-    protected $_class_loaders = array();
93
-
94
-    /**
95
-     * @type array $_aliases
96
-     */
97
-    protected $_aliases = array();
98
-
99
-
100
-
101
-    /**
102
-     * EE_Dependency_Map constructor.
103
-     */
104
-    protected function __construct()
105
-    {
106
-        // add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize'));
107
-        do_action('EE_Dependency_Map____construct');
108
-    }
109
-
110
-
111
-
112
-    /**
113
-     * @throws InvalidDataTypeException
114
-     * @throws InvalidInterfaceException
115
-     * @throws InvalidArgumentException
116
-     */
117
-    public function initialize()
118
-    {
119
-        $this->_register_core_dependencies();
120
-        $this->_register_core_class_loaders();
121
-        $this->_register_core_aliases();
122
-    }
123
-
124
-
125
-
126
-    /**
127
-     * @singleton method used to instantiate class object
128
-     * @return EE_Dependency_Map
129
-     */
130
-    public static function instance() {
131
-        // check if class object is instantiated, and instantiated properly
132
-        if (! self::$_instance instanceof EE_Dependency_Map) {
133
-            self::$_instance = new EE_Dependency_Map(/*$request, $response, $legacy_request*/);
134
-        }
135
-        return self::$_instance;
136
-    }
137
-
138
-
139
-    /**
140
-     * @param RequestInterface $request
141
-     */
142
-    public function setRequest(RequestInterface $request)
143
-    {
144
-        $this->request = $request;
145
-    }
146
-
147
-
148
-    /**
149
-     * @param LegacyRequestInterface $legacy_request
150
-     */
151
-    public function setLegacyRequest(LegacyRequestInterface $legacy_request)
152
-    {
153
-        $this->legacy_request = $legacy_request;
154
-    }
155
-
156
-
157
-    /**
158
-     * @param ResponseInterface $response
159
-     */
160
-    public function setResponse(ResponseInterface $response)
161
-    {
162
-        $this->response = $response;
163
-    }
164
-
165
-
166
-
167
-    /**
168
-     * @param LoaderInterface $loader
169
-     */
170
-    public function setLoader(LoaderInterface $loader)
171
-    {
172
-        $this->loader = $loader;
173
-    }
174
-
175
-
176
-
177
-    /**
178
-     * @param string $class
179
-     * @param array  $dependencies
180
-     * @param int    $overwrite
181
-     * @return bool
182
-     */
183
-    public static function register_dependencies(
184
-        $class,
185
-        array $dependencies,
186
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
187
-    ) {
188
-        return self::$_instance->registerDependencies($class, $dependencies, $overwrite);
189
-    }
190
-
191
-
192
-
193
-    /**
194
-     * Assigns an array of class names and corresponding load sources (new or cached)
195
-     * to the class specified by the first parameter.
196
-     * IMPORTANT !!!
197
-     * The order of elements in the incoming $dependencies array MUST match
198
-     * the order of the constructor parameters for the class in question.
199
-     * This is especially important when overriding any existing dependencies that are registered.
200
-     * the third parameter controls whether any duplicate dependencies are overwritten or not.
201
-     *
202
-     * @param string $class
203
-     * @param array  $dependencies
204
-     * @param int    $overwrite
205
-     * @return bool
206
-     */
207
-    public function registerDependencies(
208
-        $class,
209
-        array $dependencies,
210
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
211
-    ) {
212
-        $class = trim($class, '\\');
213
-        $registered = false;
214
-        if (empty(self::$_instance->_dependency_map[ $class ])) {
215
-            self::$_instance->_dependency_map[ $class ] = array();
216
-        }
217
-        // we need to make sure that any aliases used when registering a dependency
218
-        // get resolved to the correct class name
219
-        foreach ($dependencies as $dependency => $load_source) {
220
-            $alias = self::$_instance->get_alias($dependency);
221
-            if (
222
-                $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
223
-                || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])
224
-            ) {
225
-                unset($dependencies[$dependency]);
226
-                $dependencies[$alias] = $load_source;
227
-                $registered = true;
228
-            }
229
-        }
230
-        // now add our two lists of dependencies together.
231
-        // using Union (+=) favours the arrays in precedence from left to right,
232
-        // so $dependencies is NOT overwritten because it is listed first
233
-        // ie: with A = B + C, entries in B take precedence over duplicate entries in C
234
-        // Union is way faster than array_merge() but should be used with caution...
235
-        // especially with numerically indexed arrays
236
-        $dependencies += self::$_instance->_dependency_map[ $class ];
237
-        // now we need to ensure that the resulting dependencies
238
-        // array only has the entries that are required for the class
239
-        // so first count how many dependencies were originally registered for the class
240
-        $dependency_count = count(self::$_instance->_dependency_map[ $class ]);
241
-        // if that count is non-zero (meaning dependencies were already registered)
242
-        self::$_instance->_dependency_map[ $class ] = $dependency_count
243
-            // then truncate the  final array to match that count
244
-            ? array_slice($dependencies, 0, $dependency_count)
245
-            // otherwise just take the incoming array because nothing previously existed
246
-            : $dependencies;
247
-        return $registered;
248
-    }
249
-
250
-
251
-
252
-    /**
253
-     * @param string $class_name
254
-     * @param string $loader
255
-     * @return bool
256
-     * @throws DomainException
257
-     */
258
-    public static function register_class_loader($class_name, $loader = 'load_core')
259
-    {
260
-        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
261
-            throw new DomainException(
262
-                esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
263
-            );
264
-        }
265
-        // check that loader is callable or method starts with "load_" and exists in EE_Registry
266
-        if (
267
-            ! is_callable($loader)
268
-            && (
269
-                strpos($loader, 'load_') !== 0
270
-                || ! method_exists('EE_Registry', $loader)
271
-            )
272
-        ) {
273
-            throw new DomainException(
274
-                sprintf(
275
-                    esc_html__(
276
-                        '"%1$s" is not a valid loader method on EE_Registry.',
277
-                        'event_espresso'
278
-                    ),
279
-                    $loader
280
-                )
281
-            );
282
-        }
283
-        $class_name = self::$_instance->get_alias($class_name);
284
-        if (! isset(self::$_instance->_class_loaders[$class_name])) {
285
-            self::$_instance->_class_loaders[$class_name] = $loader;
286
-            return true;
287
-        }
288
-        return false;
289
-    }
290
-
291
-
292
-
293
-    /**
294
-     * @return array
295
-     */
296
-    public function dependency_map()
297
-    {
298
-        return $this->_dependency_map;
299
-    }
300
-
301
-
302
-
303
-    /**
304
-     * returns TRUE if dependency map contains a listing for the provided class name
305
-     *
306
-     * @param string $class_name
307
-     * @return boolean
308
-     */
309
-    public function has($class_name = '')
310
-    {
311
-        // all legacy models have the same dependencies
312
-        if (strpos($class_name, 'EEM_') === 0) {
313
-            $class_name = 'LEGACY_MODELS';
314
-        }
315
-        return isset($this->_dependency_map[$class_name]) ? true : false;
316
-    }
317
-
318
-
319
-
320
-    /**
321
-     * returns TRUE if dependency map contains a listing for the provided class name AND dependency
322
-     *
323
-     * @param string $class_name
324
-     * @param string $dependency
325
-     * @return bool
326
-     */
327
-    public function has_dependency_for_class($class_name = '', $dependency = '')
328
-    {
329
-        // all legacy models have the same dependencies
330
-        if (strpos($class_name, 'EEM_') === 0) {
331
-            $class_name = 'LEGACY_MODELS';
332
-        }
333
-        $dependency = $this->get_alias($dependency);
334
-        return isset($this->_dependency_map[$class_name][$dependency])
335
-            ? true
336
-            : false;
337
-    }
338
-
339
-
340
-
341
-    /**
342
-     * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
343
-     *
344
-     * @param string $class_name
345
-     * @param string $dependency
346
-     * @return int
347
-     */
348
-    public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
349
-    {
350
-        // all legacy models have the same dependencies
351
-        if (strpos($class_name, 'EEM_') === 0) {
352
-            $class_name = 'LEGACY_MODELS';
353
-        }
354
-        $dependency = $this->get_alias($dependency);
355
-        return $this->has_dependency_for_class($class_name, $dependency)
356
-            ? $this->_dependency_map[$class_name][$dependency]
357
-            : EE_Dependency_Map::not_registered;
358
-    }
359
-
360
-
361
-
362
-    /**
363
-     * @param string $class_name
364
-     * @return string | Closure
365
-     */
366
-    public function class_loader($class_name)
367
-    {
368
-        // all legacy models use load_model()
369
-        if(strpos($class_name, 'EEM_') === 0){
370
-            return 'load_model';
371
-        }
372
-        $class_name = $this->get_alias($class_name);
373
-        return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : '';
374
-    }
375
-
376
-
377
-
378
-    /**
379
-     * @return array
380
-     */
381
-    public function class_loaders()
382
-    {
383
-        return $this->_class_loaders;
384
-    }
385
-
386
-
387
-
388
-    /**
389
-     * adds an alias for a classname
390
-     *
391
-     * @param string $class_name the class name that should be used (concrete class to replace interface)
392
-     * @param string $alias      the class name that would be type hinted for (abstract parent or interface)
393
-     * @param string $for_class  the class that has the dependency (is type hinting for the interface)
394
-     */
395
-    public function add_alias($class_name, $alias, $for_class = '')
396
-    {
397
-        if ($for_class !== '') {
398
-            if (! isset($this->_aliases[$for_class])) {
399
-                $this->_aliases[$for_class] = array();
400
-            }
401
-            $this->_aliases[$for_class][$class_name] = $alias;
402
-        }
403
-        $this->_aliases[$class_name] = $alias;
404
-    }
405
-
406
-
407
-
408
-    /**
409
-     * returns TRUE if the provided class name has an alias
410
-     *
411
-     * @param string $class_name
412
-     * @param string $for_class
413
-     * @return bool
414
-     */
415
-    public function has_alias($class_name = '', $for_class = '')
416
-    {
417
-        return isset($this->_aliases[$for_class][$class_name])
418
-               || (
419
-                   isset($this->_aliases[$class_name])
420
-                   && ! is_array($this->_aliases[$class_name])
421
-               );
422
-    }
423
-
424
-
425
-
426
-    /**
427
-     * returns alias for class name if one exists, otherwise returns the original classname
428
-     * functions recursively, so that multiple aliases can be used to drill down to a classname
429
-     *  for example:
430
-     *      if the following two entries were added to the _aliases array:
431
-     *          array(
432
-     *              'interface_alias'           => 'some\namespace\interface'
433
-     *              'some\namespace\interface'  => 'some\namespace\classname'
434
-     *          )
435
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
436
-     *      to load an instance of 'some\namespace\classname'
437
-     *
438
-     * @param string $class_name
439
-     * @param string $for_class
440
-     * @return string
441
-     */
442
-    public function get_alias($class_name = '', $for_class = '')
443
-    {
444
-        if (! $this->has_alias($class_name, $for_class)) {
445
-            return $class_name;
446
-        }
447
-        if ($for_class !== '' && isset($this->_aliases[ $for_class ][ $class_name ])) {
448
-            return $this->get_alias($this->_aliases[$for_class][$class_name], $for_class);
449
-        }
450
-        return $this->get_alias($this->_aliases[$class_name]);
451
-    }
452
-
453
-
454
-
455
-    /**
456
-     * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
457
-     * if one exists, or whether a new object should be generated every time the requested class is loaded.
458
-     * This is done by using the following class constants:
459
-     *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
460
-     *        EE_Dependency_Map::load_new_object - generates a new object every time
461
-     */
462
-    protected function _register_core_dependencies()
463
-    {
464
-        $this->_dependency_map = array(
465
-            'EE_Request_Handler'                                                                                          => array(
466
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
467
-            ),
468
-            'EE_System'                                                                                                   => array(
469
-                'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
470
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
471
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
472
-                'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
473
-            ),
474
-            'EE_Session'                                                                                                  => array(
475
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
476
-                'EventEspresso\core\services\request\Request'             => EE_Dependency_Map::load_from_cache,
477
-                'EE_Encryption'                                           => EE_Dependency_Map::load_from_cache,
478
-            ),
479
-            'EE_Cart'                                                                                                     => array(
480
-                'EE_Session' => EE_Dependency_Map::load_from_cache,
481
-            ),
482
-            'EE_Front_Controller'                                                                                         => array(
483
-                'EE_Registry'              => EE_Dependency_Map::load_from_cache,
484
-                'EE_Request_Handler'       => EE_Dependency_Map::load_from_cache,
485
-                'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,
486
-            ),
487
-            'EE_Messenger_Collection_Loader'                                                                              => array(
488
-                'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
489
-            ),
490
-            'EE_Message_Type_Collection_Loader'                                                                           => array(
491
-                'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
492
-            ),
493
-            'EE_Message_Resource_Manager'                                                                                 => array(
494
-                'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
495
-                'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
496
-                'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
497
-            ),
498
-            'EE_Message_Factory'                                                                                          => array(
499
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
500
-            ),
501
-            'EE_messages'                                                                                                 => array(
502
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
503
-            ),
504
-            'EE_Messages_Generator'                                                                                       => array(
505
-                'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
506
-                'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
507
-                'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
508
-                'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
509
-            ),
510
-            'EE_Messages_Processor'                                                                                       => array(
511
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
512
-            ),
513
-            'EE_Messages_Queue'                                                                                           => array(
514
-                'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
515
-            ),
516
-            'EE_Messages_Template_Defaults'                                                                               => array(
517
-                'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
518
-                'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
519
-            ),
520
-            'EE_Message_To_Generate_From_Request'                                                                         => array(
521
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
522
-                'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
523
-            ),
524
-            'EventEspresso\core\services\commands\CommandBus'                                                             => array(
525
-                'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
526
-            ),
527
-            'EventEspresso\services\commands\CommandHandler'                                                              => array(
528
-                'EE_Registry'         => EE_Dependency_Map::load_from_cache,
529
-                'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
530
-            ),
531
-            'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => array(
532
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
533
-            ),
534
-            'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => array(
535
-                'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
536
-                'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
537
-            ),
538
-            'EventEspresso\core\services\commands\CommandFactory'                                                         => array(
539
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
540
-            ),
541
-            'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => array(
542
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
543
-            ),
544
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => array(
545
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
546
-            ),
547
-            'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => array(
548
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
549
-            ),
550
-            'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => array(
551
-                'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
552
-            ),
553
-            'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => array(
554
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
555
-            ),
556
-            'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => array(
557
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
558
-            ),
559
-            'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => array(
560
-                'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
561
-            ),
562
-            'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array(
563
-                'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
564
-            ),
565
-            'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => array(
566
-                'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
567
-            ),
568
-            'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => array(
569
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
570
-            ),
571
-            'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => array(
572
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
573
-            ),
574
-            'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => array(
575
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
576
-            ),
577
-            'EventEspresso\core\services\database\TableManager'                                                           => array(
578
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
579
-            ),
580
-            'EE_Data_Migration_Class_Base'                                                                                => array(
581
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
582
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
583
-            ),
584
-            'EE_DMS_Core_4_1_0'                                                                                           => array(
585
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
586
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
587
-            ),
588
-            'EE_DMS_Core_4_2_0'                                                                                           => array(
589
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
590
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
591
-            ),
592
-            'EE_DMS_Core_4_3_0'                                                                                           => array(
593
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
594
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
595
-            ),
596
-            'EE_DMS_Core_4_4_0'                                                                                           => array(
597
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
598
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
599
-            ),
600
-            'EE_DMS_Core_4_5_0'                                                                                           => array(
601
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
602
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
603
-            ),
604
-            'EE_DMS_Core_4_6_0'                                                                                           => array(
605
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
606
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
607
-            ),
608
-            'EE_DMS_Core_4_7_0'                                                                                           => array(
609
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
610
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
611
-            ),
612
-            'EE_DMS_Core_4_8_0'                                                                                           => array(
613
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
614
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
615
-            ),
616
-            'EE_DMS_Core_4_9_0'                                                                                           => array(
617
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
618
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
619
-            ),
620
-            'EventEspresso\core\services\assets\Registry'                                                                 => array(
621
-                'EE_Template_Config' => EE_Dependency_Map::load_from_cache,
622
-                'EE_Currency_Config' => EE_Dependency_Map::load_from_cache,
623
-            ),
624
-            'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled'                                             => array(
625
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
626
-            ),
627
-            'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout'                                              => array(
628
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
629
-            ),
630
-            'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees'                                        => array(
631
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
632
-            ),
633
-            'EventEspresso\core\domain\entities\shortcodes\EspressoEvents'                                                => array(
634
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
635
-            ),
636
-            'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou'                                              => array(
637
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
638
-            ),
639
-            'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector'                                        => array(
640
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
641
-            ),
642
-            'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage'                                               => array(
643
-                'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
644
-            ),
645
-            'EventEspresso\core\services\cache\BasicCacheManager'                        => array(
646
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
647
-            ),
648
-            'EventEspresso\core\services\cache\PostRelatedCacheManager'                  => array(
649
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
650
-            ),
651
-            'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array(
652
-                'EE_Registration_Config'                                  => EE_Dependency_Map::load_from_cache,
653
-                'EventEspresso\core\services\loaders\Loader'              => EE_Dependency_Map::load_from_cache,
654
-            ),
655
-            'EventEspresso\core\domain\values\EmailAddress'                              => array(
656
-                null,
657
-                'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
658
-            ),
659
-            'EventEspresso\core\services\orm\ModelFieldFactory' => array(
660
-                'EventEspresso\core\services\loaders\Loader'              => EE_Dependency_Map::load_from_cache,
661
-            ),
662
-            'LEGACY_MODELS'                                                   => array(
663
-                null,
664
-                'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
665
-            ),
666
-            'EE_Module_Request_Router'                                               => array(
667
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
668
-            ),
669
-            'EE_Registration_Processor'                                              => array(
670
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
671
-            ),
672
-            'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array(
673
-                null,
674
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
675
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
676
-            ),
677
-            'EventEspresso\core\services\editor\EditorBlockRegistrationManager'      => array(
678
-                'EventEspresso\core\domain\entities\editor\EditorBlockCollection' => EE_Dependency_Map::load_from_cache,
679
-                'EE_Request'                                                      => EE_Dependency_Map::load_from_cache,
680
-                'EventEspresso\core\domain\Domain'                                => EE_Dependency_Map::load_from_cache,
681
-            ),
682
-            'EventEspresso\core\services\editor\EditorBlockAdminManager'             => array(
683
-                'EE_Request'                       => EE_Dependency_Map::load_from_cache,
684
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
685
-            ),
686
-            'EventEspresso\core\domain\entities\editor\blocks\EventsList' => array(
687
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
688
-            ),
689
-            'EventEspresso\core\domain\entities\editor\blocks\TicketSelector' => array(
690
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
691
-            ),
692
-            'EventEspresso\core\domain\entities\editor\blocks\Venue' => array(
693
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
694
-            ),
695
-        );
696
-    }
697
-
698
-
699
-
700
-    /**
701
-     * Registers how core classes are loaded.
702
-     * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
703
-     *        'EE_Request_Handler' => 'load_core'
704
-     *        'EE_Messages_Queue'  => 'load_lib'
705
-     *        'EEH_Debug_Tools'    => 'load_helper'
706
-     * or, if greater control is required, by providing a custom closure. For example:
707
-     *        'Some_Class' => function () {
708
-     *            return new Some_Class();
709
-     *        },
710
-     * This is required for instantiating dependencies
711
-     * where an interface has been type hinted in a class constructor. For example:
712
-     *        'Required_Interface' => function () {
713
-     *            return new A_Class_That_Implements_Required_Interface();
714
-     *        },
715
-     *
716
-     * @throws InvalidInterfaceException
717
-     * @throws InvalidDataTypeException
718
-     * @throws InvalidArgumentException
719
-     */
720
-    protected function _register_core_class_loaders()
721
-    {
722
-        //for PHP5.3 compat, we need to register any properties called here in a variable because `$this` cannot
723
-        //be used in a closure.
724
-        $request = &$this->request;
725
-        $response = &$this->response;
726
-        $legacy_request = &$this->legacy_request;
727
-        // $loader = &$this->loader;
728
-        $this->_class_loaders = array(
729
-            //load_core
730
-            'EE_Capabilities'          => 'load_core',
731
-            'EE_Encryption'            => 'load_core',
732
-            'EE_Front_Controller'      => 'load_core',
733
-            'EE_Module_Request_Router' => 'load_core',
734
-            'EE_Registry'              => 'load_core',
735
-            'EE_Request'               => function () use (&$legacy_request) {
736
-                return $legacy_request;
737
-            },
738
-            'EventEspresso\core\services\request\Request' => function () use (&$request) {
739
-                return $request;
740
-            },
741
-            'EventEspresso\core\services\request\Response' => function () use (&$response) {
742
-                return $response;
743
-            },
744
-            'EE_Request_Handler'       => 'load_core',
745
-            'EE_Session'               => 'load_core',
746
-            'EE_Cron_Tasks'            => 'load_core',
747
-            'EE_System'                => 'load_core',
748
-            'EE_Maintenance_Mode'      => 'load_core',
749
-            'EE_Register_CPTs'         => 'load_core',
750
-            'EE_Admin'                 => 'load_core',
751
-            //load_lib
752
-            'EE_Message_Resource_Manager'          => 'load_lib',
753
-            'EE_Message_Type_Collection'           => 'load_lib',
754
-            'EE_Message_Type_Collection_Loader'    => 'load_lib',
755
-            'EE_Messenger_Collection'              => 'load_lib',
756
-            'EE_Messenger_Collection_Loader'       => 'load_lib',
757
-            'EE_Messages_Processor'                => 'load_lib',
758
-            'EE_Message_Repository'                => 'load_lib',
759
-            'EE_Messages_Queue'                    => 'load_lib',
760
-            'EE_Messages_Data_Handler_Collection'  => 'load_lib',
761
-            'EE_Message_Template_Group_Collection' => 'load_lib',
762
-            'EE_Payment_Method_Manager'            => 'load_lib',
763
-            'EE_Messages_Generator'                => function () {
764
-                return EE_Registry::instance()->load_lib(
765
-                    'Messages_Generator',
766
-                    array(),
767
-                    false,
768
-                    false
769
-                );
770
-            },
771
-            'EE_Messages_Template_Defaults'        => function ($arguments = array()) {
772
-                return EE_Registry::instance()->load_lib(
773
-                    'Messages_Template_Defaults',
774
-                    $arguments,
775
-                    false,
776
-                    false
777
-                );
778
-            },
779
-            //load_model
780
-            // 'EEM_Attendee'                         => 'load_model',
781
-            // 'EEM_Message_Template_Group'           => 'load_model',
782
-            // 'EEM_Message_Template'                 => 'load_model',
783
-            //load_helper
784
-            'EEH_Parse_Shortcodes'                 => function () {
785
-                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
786
-                    return new EEH_Parse_Shortcodes();
787
-                }
788
-                return null;
789
-            },
790
-            'EE_Template_Config'                   => function () {
791
-                return EE_Config::instance()->template_settings;
792
-            },
793
-            'EE_Currency_Config'                   => function () {
794
-                return EE_Config::instance()->currency;
795
-            },
796
-            'EE_Registration_Config'                   => function () {
797
-                return EE_Config::instance()->registration;
798
-            },
799
-            'EventEspresso\core\services\loaders\Loader' => function () {
800
-                return LoaderFactory::getLoader();
801
-            },
802
-        );
803
-    }
804
-
805
-
806
-
807
-    /**
808
-     * can be used for supplying alternate names for classes,
809
-     * or for connecting interface names to instantiable classes
810
-     */
811
-    protected function _register_core_aliases()
812
-    {
813
-        $this->_aliases = array(
814
-            'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
815
-            'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
816
-            'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
817
-            'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
818
-            'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
819
-            'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
820
-            'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
821
-            'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
822
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
823
-            'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
824
-            'CreateRegCodeCommandHandler'                                                  => 'EventEspresso\core\services\commands\registration\CreateRegCodeCommand',
825
-            'CreateRegUrlLinkCommandHandler'                                               => 'EventEspresso\core\services\commands\registration\CreateRegUrlLinkCommand',
826
-            'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
827
-            'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
828
-            'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
829
-            'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
830
-            'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
831
-            'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
832
-            'CreateTransactionCommandHandler'                                     => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
833
-            'CreateAttendeeCommandHandler'                                        => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
834
-            'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
835
-            'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
836
-            'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
837
-            'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
838
-            'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
839
-            'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
840
-            'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
841
-            'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
842
-            'CommandFactoryInterface'                                                     => 'EventEspresso\core\services\commands\CommandFactoryInterface',
843
-            'EventEspresso\core\services\commands\CommandFactoryInterface'                => 'EventEspresso\core\services\commands\CommandFactory',
844
-            'EventEspresso\core\domain\services\session\SessionIdentifierInterface'       => 'EE_Session',
845
-            'EmailValidatorInterface'                                                     => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
846
-            'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
847
-            'NoticeConverterInterface'                                            => 'EventEspresso\core\services\notices\NoticeConverterInterface',
848
-            'EventEspresso\core\services\notices\NoticeConverterInterface'        => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
849
-            'NoticesContainerInterface'                                           => 'EventEspresso\core\services\notices\NoticesContainerInterface',
850
-            'EventEspresso\core\services\notices\NoticesContainerInterface'       => 'EventEspresso\core\services\notices\NoticesContainer',
851
-            'EventEspresso\core\services\request\RequestInterface'                => 'EventEspresso\core\services\request\Request',
852
-            'EventEspresso\core\services\request\ResponseInterface'               => 'EventEspresso\core\services\request\Response',
853
-            'EventEspresso\core\domain\DomainInterface'                             => 'EventEspresso\core\domain\Domain',
854
-        );
855
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
856
-            $this->_aliases['EventEspresso\core\services\notices\NoticeConverterInterface'] = 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices';
857
-        }
858
-    }
859
-
860
-
861
-
862
-    /**
863
-     * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
864
-     * request Primarily used by unit tests.
865
-     *
866
-     * @throws InvalidDataTypeException
867
-     * @throws InvalidInterfaceException
868
-     * @throws InvalidArgumentException
869
-     */
870
-    public function reset()
871
-    {
872
-        $this->_register_core_class_loaders();
873
-        $this->_register_core_dependencies();
874
-    }
28
+	/**
29
+	 * This means that the requested class dependency is not present in the dependency map
30
+	 */
31
+	const not_registered = 0;
32
+
33
+	/**
34
+	 * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.
35
+	 */
36
+	const load_new_object = 1;
37
+
38
+	/**
39
+	 * This instructs class loaders to return a previously instantiated and cached object for the requested class.
40
+	 * IF a previously instantiated object does not exist, a new one will be created and added to the cache.
41
+	 */
42
+	const load_from_cache = 2;
43
+
44
+	/**
45
+	 * When registering a dependency,
46
+	 * this indicates to keep any existing dependencies that already exist,
47
+	 * and simply discard any new dependencies declared in the incoming data
48
+	 */
49
+	const KEEP_EXISTING_DEPENDENCIES = 0;
50
+
51
+	/**
52
+	 * When registering a dependency,
53
+	 * this indicates to overwrite any existing dependencies that already exist using the incoming data
54
+	 */
55
+	const OVERWRITE_DEPENDENCIES = 1;
56
+
57
+
58
+
59
+	/**
60
+	 * @type EE_Dependency_Map $_instance
61
+	 */
62
+	protected static $_instance;
63
+
64
+	/**
65
+	 * @type RequestInterface $request
66
+	 */
67
+	protected $request;
68
+
69
+	/**
70
+	 * @type LegacyRequestInterface $legacy_request
71
+	 */
72
+	protected $legacy_request;
73
+
74
+	/**
75
+	 * @type ResponseInterface $response
76
+	 */
77
+	protected $response;
78
+
79
+	/**
80
+	 * @type LoaderInterface $loader
81
+	 */
82
+	protected $loader;
83
+
84
+	/**
85
+	 * @type array $_dependency_map
86
+	 */
87
+	protected $_dependency_map = array();
88
+
89
+	/**
90
+	 * @type array $_class_loaders
91
+	 */
92
+	protected $_class_loaders = array();
93
+
94
+	/**
95
+	 * @type array $_aliases
96
+	 */
97
+	protected $_aliases = array();
98
+
99
+
100
+
101
+	/**
102
+	 * EE_Dependency_Map constructor.
103
+	 */
104
+	protected function __construct()
105
+	{
106
+		// add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize'));
107
+		do_action('EE_Dependency_Map____construct');
108
+	}
109
+
110
+
111
+
112
+	/**
113
+	 * @throws InvalidDataTypeException
114
+	 * @throws InvalidInterfaceException
115
+	 * @throws InvalidArgumentException
116
+	 */
117
+	public function initialize()
118
+	{
119
+		$this->_register_core_dependencies();
120
+		$this->_register_core_class_loaders();
121
+		$this->_register_core_aliases();
122
+	}
123
+
124
+
125
+
126
+	/**
127
+	 * @singleton method used to instantiate class object
128
+	 * @return EE_Dependency_Map
129
+	 */
130
+	public static function instance() {
131
+		// check if class object is instantiated, and instantiated properly
132
+		if (! self::$_instance instanceof EE_Dependency_Map) {
133
+			self::$_instance = new EE_Dependency_Map(/*$request, $response, $legacy_request*/);
134
+		}
135
+		return self::$_instance;
136
+	}
137
+
138
+
139
+	/**
140
+	 * @param RequestInterface $request
141
+	 */
142
+	public function setRequest(RequestInterface $request)
143
+	{
144
+		$this->request = $request;
145
+	}
146
+
147
+
148
+	/**
149
+	 * @param LegacyRequestInterface $legacy_request
150
+	 */
151
+	public function setLegacyRequest(LegacyRequestInterface $legacy_request)
152
+	{
153
+		$this->legacy_request = $legacy_request;
154
+	}
155
+
156
+
157
+	/**
158
+	 * @param ResponseInterface $response
159
+	 */
160
+	public function setResponse(ResponseInterface $response)
161
+	{
162
+		$this->response = $response;
163
+	}
164
+
165
+
166
+
167
+	/**
168
+	 * @param LoaderInterface $loader
169
+	 */
170
+	public function setLoader(LoaderInterface $loader)
171
+	{
172
+		$this->loader = $loader;
173
+	}
174
+
175
+
176
+
177
+	/**
178
+	 * @param string $class
179
+	 * @param array  $dependencies
180
+	 * @param int    $overwrite
181
+	 * @return bool
182
+	 */
183
+	public static function register_dependencies(
184
+		$class,
185
+		array $dependencies,
186
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
187
+	) {
188
+		return self::$_instance->registerDependencies($class, $dependencies, $overwrite);
189
+	}
190
+
191
+
192
+
193
+	/**
194
+	 * Assigns an array of class names and corresponding load sources (new or cached)
195
+	 * to the class specified by the first parameter.
196
+	 * IMPORTANT !!!
197
+	 * The order of elements in the incoming $dependencies array MUST match
198
+	 * the order of the constructor parameters for the class in question.
199
+	 * This is especially important when overriding any existing dependencies that are registered.
200
+	 * the third parameter controls whether any duplicate dependencies are overwritten or not.
201
+	 *
202
+	 * @param string $class
203
+	 * @param array  $dependencies
204
+	 * @param int    $overwrite
205
+	 * @return bool
206
+	 */
207
+	public function registerDependencies(
208
+		$class,
209
+		array $dependencies,
210
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
211
+	) {
212
+		$class = trim($class, '\\');
213
+		$registered = false;
214
+		if (empty(self::$_instance->_dependency_map[ $class ])) {
215
+			self::$_instance->_dependency_map[ $class ] = array();
216
+		}
217
+		// we need to make sure that any aliases used when registering a dependency
218
+		// get resolved to the correct class name
219
+		foreach ($dependencies as $dependency => $load_source) {
220
+			$alias = self::$_instance->get_alias($dependency);
221
+			if (
222
+				$overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
223
+				|| ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])
224
+			) {
225
+				unset($dependencies[$dependency]);
226
+				$dependencies[$alias] = $load_source;
227
+				$registered = true;
228
+			}
229
+		}
230
+		// now add our two lists of dependencies together.
231
+		// using Union (+=) favours the arrays in precedence from left to right,
232
+		// so $dependencies is NOT overwritten because it is listed first
233
+		// ie: with A = B + C, entries in B take precedence over duplicate entries in C
234
+		// Union is way faster than array_merge() but should be used with caution...
235
+		// especially with numerically indexed arrays
236
+		$dependencies += self::$_instance->_dependency_map[ $class ];
237
+		// now we need to ensure that the resulting dependencies
238
+		// array only has the entries that are required for the class
239
+		// so first count how many dependencies were originally registered for the class
240
+		$dependency_count = count(self::$_instance->_dependency_map[ $class ]);
241
+		// if that count is non-zero (meaning dependencies were already registered)
242
+		self::$_instance->_dependency_map[ $class ] = $dependency_count
243
+			// then truncate the  final array to match that count
244
+			? array_slice($dependencies, 0, $dependency_count)
245
+			// otherwise just take the incoming array because nothing previously existed
246
+			: $dependencies;
247
+		return $registered;
248
+	}
249
+
250
+
251
+
252
+	/**
253
+	 * @param string $class_name
254
+	 * @param string $loader
255
+	 * @return bool
256
+	 * @throws DomainException
257
+	 */
258
+	public static function register_class_loader($class_name, $loader = 'load_core')
259
+	{
260
+		if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
261
+			throw new DomainException(
262
+				esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
263
+			);
264
+		}
265
+		// check that loader is callable or method starts with "load_" and exists in EE_Registry
266
+		if (
267
+			! is_callable($loader)
268
+			&& (
269
+				strpos($loader, 'load_') !== 0
270
+				|| ! method_exists('EE_Registry', $loader)
271
+			)
272
+		) {
273
+			throw new DomainException(
274
+				sprintf(
275
+					esc_html__(
276
+						'"%1$s" is not a valid loader method on EE_Registry.',
277
+						'event_espresso'
278
+					),
279
+					$loader
280
+				)
281
+			);
282
+		}
283
+		$class_name = self::$_instance->get_alias($class_name);
284
+		if (! isset(self::$_instance->_class_loaders[$class_name])) {
285
+			self::$_instance->_class_loaders[$class_name] = $loader;
286
+			return true;
287
+		}
288
+		return false;
289
+	}
290
+
291
+
292
+
293
+	/**
294
+	 * @return array
295
+	 */
296
+	public function dependency_map()
297
+	{
298
+		return $this->_dependency_map;
299
+	}
300
+
301
+
302
+
303
+	/**
304
+	 * returns TRUE if dependency map contains a listing for the provided class name
305
+	 *
306
+	 * @param string $class_name
307
+	 * @return boolean
308
+	 */
309
+	public function has($class_name = '')
310
+	{
311
+		// all legacy models have the same dependencies
312
+		if (strpos($class_name, 'EEM_') === 0) {
313
+			$class_name = 'LEGACY_MODELS';
314
+		}
315
+		return isset($this->_dependency_map[$class_name]) ? true : false;
316
+	}
317
+
318
+
319
+
320
+	/**
321
+	 * returns TRUE if dependency map contains a listing for the provided class name AND dependency
322
+	 *
323
+	 * @param string $class_name
324
+	 * @param string $dependency
325
+	 * @return bool
326
+	 */
327
+	public function has_dependency_for_class($class_name = '', $dependency = '')
328
+	{
329
+		// all legacy models have the same dependencies
330
+		if (strpos($class_name, 'EEM_') === 0) {
331
+			$class_name = 'LEGACY_MODELS';
332
+		}
333
+		$dependency = $this->get_alias($dependency);
334
+		return isset($this->_dependency_map[$class_name][$dependency])
335
+			? true
336
+			: false;
337
+	}
338
+
339
+
340
+
341
+	/**
342
+	 * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
343
+	 *
344
+	 * @param string $class_name
345
+	 * @param string $dependency
346
+	 * @return int
347
+	 */
348
+	public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
349
+	{
350
+		// all legacy models have the same dependencies
351
+		if (strpos($class_name, 'EEM_') === 0) {
352
+			$class_name = 'LEGACY_MODELS';
353
+		}
354
+		$dependency = $this->get_alias($dependency);
355
+		return $this->has_dependency_for_class($class_name, $dependency)
356
+			? $this->_dependency_map[$class_name][$dependency]
357
+			: EE_Dependency_Map::not_registered;
358
+	}
359
+
360
+
361
+
362
+	/**
363
+	 * @param string $class_name
364
+	 * @return string | Closure
365
+	 */
366
+	public function class_loader($class_name)
367
+	{
368
+		// all legacy models use load_model()
369
+		if(strpos($class_name, 'EEM_') === 0){
370
+			return 'load_model';
371
+		}
372
+		$class_name = $this->get_alias($class_name);
373
+		return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : '';
374
+	}
375
+
376
+
377
+
378
+	/**
379
+	 * @return array
380
+	 */
381
+	public function class_loaders()
382
+	{
383
+		return $this->_class_loaders;
384
+	}
385
+
386
+
387
+
388
+	/**
389
+	 * adds an alias for a classname
390
+	 *
391
+	 * @param string $class_name the class name that should be used (concrete class to replace interface)
392
+	 * @param string $alias      the class name that would be type hinted for (abstract parent or interface)
393
+	 * @param string $for_class  the class that has the dependency (is type hinting for the interface)
394
+	 */
395
+	public function add_alias($class_name, $alias, $for_class = '')
396
+	{
397
+		if ($for_class !== '') {
398
+			if (! isset($this->_aliases[$for_class])) {
399
+				$this->_aliases[$for_class] = array();
400
+			}
401
+			$this->_aliases[$for_class][$class_name] = $alias;
402
+		}
403
+		$this->_aliases[$class_name] = $alias;
404
+	}
405
+
406
+
407
+
408
+	/**
409
+	 * returns TRUE if the provided class name has an alias
410
+	 *
411
+	 * @param string $class_name
412
+	 * @param string $for_class
413
+	 * @return bool
414
+	 */
415
+	public function has_alias($class_name = '', $for_class = '')
416
+	{
417
+		return isset($this->_aliases[$for_class][$class_name])
418
+			   || (
419
+				   isset($this->_aliases[$class_name])
420
+				   && ! is_array($this->_aliases[$class_name])
421
+			   );
422
+	}
423
+
424
+
425
+
426
+	/**
427
+	 * returns alias for class name if one exists, otherwise returns the original classname
428
+	 * functions recursively, so that multiple aliases can be used to drill down to a classname
429
+	 *  for example:
430
+	 *      if the following two entries were added to the _aliases array:
431
+	 *          array(
432
+	 *              'interface_alias'           => 'some\namespace\interface'
433
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
434
+	 *          )
435
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
436
+	 *      to load an instance of 'some\namespace\classname'
437
+	 *
438
+	 * @param string $class_name
439
+	 * @param string $for_class
440
+	 * @return string
441
+	 */
442
+	public function get_alias($class_name = '', $for_class = '')
443
+	{
444
+		if (! $this->has_alias($class_name, $for_class)) {
445
+			return $class_name;
446
+		}
447
+		if ($for_class !== '' && isset($this->_aliases[ $for_class ][ $class_name ])) {
448
+			return $this->get_alias($this->_aliases[$for_class][$class_name], $for_class);
449
+		}
450
+		return $this->get_alias($this->_aliases[$class_name]);
451
+	}
452
+
453
+
454
+
455
+	/**
456
+	 * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
457
+	 * if one exists, or whether a new object should be generated every time the requested class is loaded.
458
+	 * This is done by using the following class constants:
459
+	 *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
460
+	 *        EE_Dependency_Map::load_new_object - generates a new object every time
461
+	 */
462
+	protected function _register_core_dependencies()
463
+	{
464
+		$this->_dependency_map = array(
465
+			'EE_Request_Handler'                                                                                          => array(
466
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
467
+			),
468
+			'EE_System'                                                                                                   => array(
469
+				'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
470
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
471
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
472
+				'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
473
+			),
474
+			'EE_Session'                                                                                                  => array(
475
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
476
+				'EventEspresso\core\services\request\Request'             => EE_Dependency_Map::load_from_cache,
477
+				'EE_Encryption'                                           => EE_Dependency_Map::load_from_cache,
478
+			),
479
+			'EE_Cart'                                                                                                     => array(
480
+				'EE_Session' => EE_Dependency_Map::load_from_cache,
481
+			),
482
+			'EE_Front_Controller'                                                                                         => array(
483
+				'EE_Registry'              => EE_Dependency_Map::load_from_cache,
484
+				'EE_Request_Handler'       => EE_Dependency_Map::load_from_cache,
485
+				'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache,
486
+			),
487
+			'EE_Messenger_Collection_Loader'                                                                              => array(
488
+				'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
489
+			),
490
+			'EE_Message_Type_Collection_Loader'                                                                           => array(
491
+				'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
492
+			),
493
+			'EE_Message_Resource_Manager'                                                                                 => array(
494
+				'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
495
+				'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
496
+				'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
497
+			),
498
+			'EE_Message_Factory'                                                                                          => array(
499
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
500
+			),
501
+			'EE_messages'                                                                                                 => array(
502
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
503
+			),
504
+			'EE_Messages_Generator'                                                                                       => array(
505
+				'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
506
+				'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
507
+				'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
508
+				'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
509
+			),
510
+			'EE_Messages_Processor'                                                                                       => array(
511
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
512
+			),
513
+			'EE_Messages_Queue'                                                                                           => array(
514
+				'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
515
+			),
516
+			'EE_Messages_Template_Defaults'                                                                               => array(
517
+				'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
518
+				'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
519
+			),
520
+			'EE_Message_To_Generate_From_Request'                                                                         => array(
521
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
522
+				'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
523
+			),
524
+			'EventEspresso\core\services\commands\CommandBus'                                                             => array(
525
+				'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
526
+			),
527
+			'EventEspresso\services\commands\CommandHandler'                                                              => array(
528
+				'EE_Registry'         => EE_Dependency_Map::load_from_cache,
529
+				'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
530
+			),
531
+			'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => array(
532
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
533
+			),
534
+			'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => array(
535
+				'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
536
+				'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
537
+			),
538
+			'EventEspresso\core\services\commands\CommandFactory'                                                         => array(
539
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
540
+			),
541
+			'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => array(
542
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
543
+			),
544
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => array(
545
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
546
+			),
547
+			'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => array(
548
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
549
+			),
550
+			'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => array(
551
+				'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
552
+			),
553
+			'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => array(
554
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
555
+			),
556
+			'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => array(
557
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
558
+			),
559
+			'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => array(
560
+				'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
561
+			),
562
+			'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => array(
563
+				'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
564
+			),
565
+			'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => array(
566
+				'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
567
+			),
568
+			'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => array(
569
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
570
+			),
571
+			'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => array(
572
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
573
+			),
574
+			'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => array(
575
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
576
+			),
577
+			'EventEspresso\core\services\database\TableManager'                                                           => array(
578
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
579
+			),
580
+			'EE_Data_Migration_Class_Base'                                                                                => array(
581
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
582
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
583
+			),
584
+			'EE_DMS_Core_4_1_0'                                                                                           => array(
585
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
586
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
587
+			),
588
+			'EE_DMS_Core_4_2_0'                                                                                           => array(
589
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
590
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
591
+			),
592
+			'EE_DMS_Core_4_3_0'                                                                                           => array(
593
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
594
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
595
+			),
596
+			'EE_DMS_Core_4_4_0'                                                                                           => array(
597
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
598
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
599
+			),
600
+			'EE_DMS_Core_4_5_0'                                                                                           => array(
601
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
602
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
603
+			),
604
+			'EE_DMS_Core_4_6_0'                                                                                           => array(
605
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
606
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
607
+			),
608
+			'EE_DMS_Core_4_7_0'                                                                                           => array(
609
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
610
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
611
+			),
612
+			'EE_DMS_Core_4_8_0'                                                                                           => array(
613
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
614
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
615
+			),
616
+			'EE_DMS_Core_4_9_0'                                                                                           => array(
617
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
618
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
619
+			),
620
+			'EventEspresso\core\services\assets\Registry'                                                                 => array(
621
+				'EE_Template_Config' => EE_Dependency_Map::load_from_cache,
622
+				'EE_Currency_Config' => EE_Dependency_Map::load_from_cache,
623
+			),
624
+			'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled'                                             => array(
625
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
626
+			),
627
+			'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout'                                              => array(
628
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
629
+			),
630
+			'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees'                                        => array(
631
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
632
+			),
633
+			'EventEspresso\core\domain\entities\shortcodes\EspressoEvents'                                                => array(
634
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
635
+			),
636
+			'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou'                                              => array(
637
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
638
+			),
639
+			'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector'                                        => array(
640
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
641
+			),
642
+			'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage'                                               => array(
643
+				'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache,
644
+			),
645
+			'EventEspresso\core\services\cache\BasicCacheManager'                        => array(
646
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
647
+			),
648
+			'EventEspresso\core\services\cache\PostRelatedCacheManager'                  => array(
649
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
650
+			),
651
+			'EventEspresso\core\domain\services\validation\email\EmailValidationService' => array(
652
+				'EE_Registration_Config'                                  => EE_Dependency_Map::load_from_cache,
653
+				'EventEspresso\core\services\loaders\Loader'              => EE_Dependency_Map::load_from_cache,
654
+			),
655
+			'EventEspresso\core\domain\values\EmailAddress'                              => array(
656
+				null,
657
+				'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
658
+			),
659
+			'EventEspresso\core\services\orm\ModelFieldFactory' => array(
660
+				'EventEspresso\core\services\loaders\Loader'              => EE_Dependency_Map::load_from_cache,
661
+			),
662
+			'LEGACY_MODELS'                                                   => array(
663
+				null,
664
+				'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
665
+			),
666
+			'EE_Module_Request_Router'                                               => array(
667
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
668
+			),
669
+			'EE_Registration_Processor'                                              => array(
670
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
671
+			),
672
+			'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => array(
673
+				null,
674
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
675
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
676
+			),
677
+			'EventEspresso\core\services\editor\EditorBlockRegistrationManager'      => array(
678
+				'EventEspresso\core\domain\entities\editor\EditorBlockCollection' => EE_Dependency_Map::load_from_cache,
679
+				'EE_Request'                                                      => EE_Dependency_Map::load_from_cache,
680
+				'EventEspresso\core\domain\Domain'                                => EE_Dependency_Map::load_from_cache,
681
+			),
682
+			'EventEspresso\core\services\editor\EditorBlockAdminManager'             => array(
683
+				'EE_Request'                       => EE_Dependency_Map::load_from_cache,
684
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
685
+			),
686
+			'EventEspresso\core\domain\entities\editor\blocks\EventsList' => array(
687
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
688
+			),
689
+			'EventEspresso\core\domain\entities\editor\blocks\TicketSelector' => array(
690
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
691
+			),
692
+			'EventEspresso\core\domain\entities\editor\blocks\Venue' => array(
693
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
694
+			),
695
+		);
696
+	}
697
+
698
+
699
+
700
+	/**
701
+	 * Registers how core classes are loaded.
702
+	 * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
703
+	 *        'EE_Request_Handler' => 'load_core'
704
+	 *        'EE_Messages_Queue'  => 'load_lib'
705
+	 *        'EEH_Debug_Tools'    => 'load_helper'
706
+	 * or, if greater control is required, by providing a custom closure. For example:
707
+	 *        'Some_Class' => function () {
708
+	 *            return new Some_Class();
709
+	 *        },
710
+	 * This is required for instantiating dependencies
711
+	 * where an interface has been type hinted in a class constructor. For example:
712
+	 *        'Required_Interface' => function () {
713
+	 *            return new A_Class_That_Implements_Required_Interface();
714
+	 *        },
715
+	 *
716
+	 * @throws InvalidInterfaceException
717
+	 * @throws InvalidDataTypeException
718
+	 * @throws InvalidArgumentException
719
+	 */
720
+	protected function _register_core_class_loaders()
721
+	{
722
+		//for PHP5.3 compat, we need to register any properties called here in a variable because `$this` cannot
723
+		//be used in a closure.
724
+		$request = &$this->request;
725
+		$response = &$this->response;
726
+		$legacy_request = &$this->legacy_request;
727
+		// $loader = &$this->loader;
728
+		$this->_class_loaders = array(
729
+			//load_core
730
+			'EE_Capabilities'          => 'load_core',
731
+			'EE_Encryption'            => 'load_core',
732
+			'EE_Front_Controller'      => 'load_core',
733
+			'EE_Module_Request_Router' => 'load_core',
734
+			'EE_Registry'              => 'load_core',
735
+			'EE_Request'               => function () use (&$legacy_request) {
736
+				return $legacy_request;
737
+			},
738
+			'EventEspresso\core\services\request\Request' => function () use (&$request) {
739
+				return $request;
740
+			},
741
+			'EventEspresso\core\services\request\Response' => function () use (&$response) {
742
+				return $response;
743
+			},
744
+			'EE_Request_Handler'       => 'load_core',
745
+			'EE_Session'               => 'load_core',
746
+			'EE_Cron_Tasks'            => 'load_core',
747
+			'EE_System'                => 'load_core',
748
+			'EE_Maintenance_Mode'      => 'load_core',
749
+			'EE_Register_CPTs'         => 'load_core',
750
+			'EE_Admin'                 => 'load_core',
751
+			//load_lib
752
+			'EE_Message_Resource_Manager'          => 'load_lib',
753
+			'EE_Message_Type_Collection'           => 'load_lib',
754
+			'EE_Message_Type_Collection_Loader'    => 'load_lib',
755
+			'EE_Messenger_Collection'              => 'load_lib',
756
+			'EE_Messenger_Collection_Loader'       => 'load_lib',
757
+			'EE_Messages_Processor'                => 'load_lib',
758
+			'EE_Message_Repository'                => 'load_lib',
759
+			'EE_Messages_Queue'                    => 'load_lib',
760
+			'EE_Messages_Data_Handler_Collection'  => 'load_lib',
761
+			'EE_Message_Template_Group_Collection' => 'load_lib',
762
+			'EE_Payment_Method_Manager'            => 'load_lib',
763
+			'EE_Messages_Generator'                => function () {
764
+				return EE_Registry::instance()->load_lib(
765
+					'Messages_Generator',
766
+					array(),
767
+					false,
768
+					false
769
+				);
770
+			},
771
+			'EE_Messages_Template_Defaults'        => function ($arguments = array()) {
772
+				return EE_Registry::instance()->load_lib(
773
+					'Messages_Template_Defaults',
774
+					$arguments,
775
+					false,
776
+					false
777
+				);
778
+			},
779
+			//load_model
780
+			// 'EEM_Attendee'                         => 'load_model',
781
+			// 'EEM_Message_Template_Group'           => 'load_model',
782
+			// 'EEM_Message_Template'                 => 'load_model',
783
+			//load_helper
784
+			'EEH_Parse_Shortcodes'                 => function () {
785
+				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
786
+					return new EEH_Parse_Shortcodes();
787
+				}
788
+				return null;
789
+			},
790
+			'EE_Template_Config'                   => function () {
791
+				return EE_Config::instance()->template_settings;
792
+			},
793
+			'EE_Currency_Config'                   => function () {
794
+				return EE_Config::instance()->currency;
795
+			},
796
+			'EE_Registration_Config'                   => function () {
797
+				return EE_Config::instance()->registration;
798
+			},
799
+			'EventEspresso\core\services\loaders\Loader' => function () {
800
+				return LoaderFactory::getLoader();
801
+			},
802
+		);
803
+	}
804
+
805
+
806
+
807
+	/**
808
+	 * can be used for supplying alternate names for classes,
809
+	 * or for connecting interface names to instantiable classes
810
+	 */
811
+	protected function _register_core_aliases()
812
+	{
813
+		$this->_aliases = array(
814
+			'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
815
+			'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
816
+			'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
817
+			'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
818
+			'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
819
+			'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
820
+			'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
821
+			'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
822
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
823
+			'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
824
+			'CreateRegCodeCommandHandler'                                                  => 'EventEspresso\core\services\commands\registration\CreateRegCodeCommand',
825
+			'CreateRegUrlLinkCommandHandler'                                               => 'EventEspresso\core\services\commands\registration\CreateRegUrlLinkCommand',
826
+			'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
827
+			'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
828
+			'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
829
+			'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
830
+			'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
831
+			'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
832
+			'CreateTransactionCommandHandler'                                     => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
833
+			'CreateAttendeeCommandHandler'                                        => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
834
+			'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
835
+			'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
836
+			'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
837
+			'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
838
+			'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
839
+			'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
840
+			'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
841
+			'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
842
+			'CommandFactoryInterface'                                                     => 'EventEspresso\core\services\commands\CommandFactoryInterface',
843
+			'EventEspresso\core\services\commands\CommandFactoryInterface'                => 'EventEspresso\core\services\commands\CommandFactory',
844
+			'EventEspresso\core\domain\services\session\SessionIdentifierInterface'       => 'EE_Session',
845
+			'EmailValidatorInterface'                                                     => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
846
+			'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
847
+			'NoticeConverterInterface'                                            => 'EventEspresso\core\services\notices\NoticeConverterInterface',
848
+			'EventEspresso\core\services\notices\NoticeConverterInterface'        => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
849
+			'NoticesContainerInterface'                                           => 'EventEspresso\core\services\notices\NoticesContainerInterface',
850
+			'EventEspresso\core\services\notices\NoticesContainerInterface'       => 'EventEspresso\core\services\notices\NoticesContainer',
851
+			'EventEspresso\core\services\request\RequestInterface'                => 'EventEspresso\core\services\request\Request',
852
+			'EventEspresso\core\services\request\ResponseInterface'               => 'EventEspresso\core\services\request\Response',
853
+			'EventEspresso\core\domain\DomainInterface'                             => 'EventEspresso\core\domain\Domain',
854
+		);
855
+		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
856
+			$this->_aliases['EventEspresso\core\services\notices\NoticeConverterInterface'] = 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices';
857
+		}
858
+	}
859
+
860
+
861
+
862
+	/**
863
+	 * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
864
+	 * request Primarily used by unit tests.
865
+	 *
866
+	 * @throws InvalidDataTypeException
867
+	 * @throws InvalidInterfaceException
868
+	 * @throws InvalidArgumentException
869
+	 */
870
+	public function reset()
871
+	{
872
+		$this->_register_core_class_loaders();
873
+		$this->_register_core_dependencies();
874
+	}
875 875
 
876 876
 
877 877
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use EventEspresso\core\services\request\RequestInterface;
8 8
 use EventEspresso\core\services\request\ResponseInterface;
9 9
 
10
-if (! defined('EVENT_ESPRESSO_VERSION')) {
10
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
11 11
     exit('No direct script access allowed');
12 12
 }
13 13
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public static function instance() {
131 131
         // check if class object is instantiated, and instantiated properly
132
-        if (! self::$_instance instanceof EE_Dependency_Map) {
132
+        if ( ! self::$_instance instanceof EE_Dependency_Map) {
133 133
             self::$_instance = new EE_Dependency_Map(/*$request, $response, $legacy_request*/);
134 134
         }
135 135
         return self::$_instance;
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
     ) {
212 212
         $class = trim($class, '\\');
213 213
         $registered = false;
214
-        if (empty(self::$_instance->_dependency_map[ $class ])) {
215
-            self::$_instance->_dependency_map[ $class ] = array();
214
+        if (empty(self::$_instance->_dependency_map[$class])) {
215
+            self::$_instance->_dependency_map[$class] = array();
216 216
         }
217 217
         // we need to make sure that any aliases used when registering a dependency
218 218
         // get resolved to the correct class name
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             $alias = self::$_instance->get_alias($dependency);
221 221
             if (
222 222
                 $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
223
-                || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ])
223
+                || ! isset(self::$_instance->_dependency_map[$class][$alias])
224 224
             ) {
225 225
                 unset($dependencies[$dependency]);
226 226
                 $dependencies[$alias] = $load_source;
@@ -233,13 +233,13 @@  discard block
 block discarded – undo
233 233
         // ie: with A = B + C, entries in B take precedence over duplicate entries in C
234 234
         // Union is way faster than array_merge() but should be used with caution...
235 235
         // especially with numerically indexed arrays
236
-        $dependencies += self::$_instance->_dependency_map[ $class ];
236
+        $dependencies += self::$_instance->_dependency_map[$class];
237 237
         // now we need to ensure that the resulting dependencies
238 238
         // array only has the entries that are required for the class
239 239
         // so first count how many dependencies were originally registered for the class
240
-        $dependency_count = count(self::$_instance->_dependency_map[ $class ]);
240
+        $dependency_count = count(self::$_instance->_dependency_map[$class]);
241 241
         // if that count is non-zero (meaning dependencies were already registered)
242
-        self::$_instance->_dependency_map[ $class ] = $dependency_count
242
+        self::$_instance->_dependency_map[$class] = $dependency_count
243 243
             // then truncate the  final array to match that count
244 244
             ? array_slice($dependencies, 0, $dependency_count)
245 245
             // otherwise just take the incoming array because nothing previously existed
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      */
258 258
     public static function register_class_loader($class_name, $loader = 'load_core')
259 259
     {
260
-        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
260
+        if ( ! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
261 261
             throw new DomainException(
262 262
                 esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
263 263
             );
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
             );
282 282
         }
283 283
         $class_name = self::$_instance->get_alias($class_name);
284
-        if (! isset(self::$_instance->_class_loaders[$class_name])) {
284
+        if ( ! isset(self::$_instance->_class_loaders[$class_name])) {
285 285
             self::$_instance->_class_loaders[$class_name] = $loader;
286 286
             return true;
287 287
         }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
     public function class_loader($class_name)
367 367
     {
368 368
         // all legacy models use load_model()
369
-        if(strpos($class_name, 'EEM_') === 0){
369
+        if (strpos($class_name, 'EEM_') === 0) {
370 370
             return 'load_model';
371 371
         }
372 372
         $class_name = $this->get_alias($class_name);
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
     public function add_alias($class_name, $alias, $for_class = '')
396 396
     {
397 397
         if ($for_class !== '') {
398
-            if (! isset($this->_aliases[$for_class])) {
398
+            if ( ! isset($this->_aliases[$for_class])) {
399 399
                 $this->_aliases[$for_class] = array();
400 400
             }
401 401
             $this->_aliases[$for_class][$class_name] = $alias;
@@ -441,10 +441,10 @@  discard block
 block discarded – undo
441 441
      */
442 442
     public function get_alias($class_name = '', $for_class = '')
443 443
     {
444
-        if (! $this->has_alias($class_name, $for_class)) {
444
+        if ( ! $this->has_alias($class_name, $for_class)) {
445 445
             return $class_name;
446 446
         }
447
-        if ($for_class !== '' && isset($this->_aliases[ $for_class ][ $class_name ])) {
447
+        if ($for_class !== '' && isset($this->_aliases[$for_class][$class_name])) {
448 448
             return $this->get_alias($this->_aliases[$for_class][$class_name], $for_class);
449 449
         }
450 450
         return $this->get_alias($this->_aliases[$class_name]);
@@ -732,13 +732,13 @@  discard block
 block discarded – undo
732 732
             'EE_Front_Controller'      => 'load_core',
733 733
             'EE_Module_Request_Router' => 'load_core',
734 734
             'EE_Registry'              => 'load_core',
735
-            'EE_Request'               => function () use (&$legacy_request) {
735
+            'EE_Request'               => function() use (&$legacy_request) {
736 736
                 return $legacy_request;
737 737
             },
738
-            'EventEspresso\core\services\request\Request' => function () use (&$request) {
738
+            'EventEspresso\core\services\request\Request' => function() use (&$request) {
739 739
                 return $request;
740 740
             },
741
-            'EventEspresso\core\services\request\Response' => function () use (&$response) {
741
+            'EventEspresso\core\services\request\Response' => function() use (&$response) {
742 742
                 return $response;
743 743
             },
744 744
             'EE_Request_Handler'       => 'load_core',
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
             'EE_Messages_Data_Handler_Collection'  => 'load_lib',
761 761
             'EE_Message_Template_Group_Collection' => 'load_lib',
762 762
             'EE_Payment_Method_Manager'            => 'load_lib',
763
-            'EE_Messages_Generator'                => function () {
763
+            'EE_Messages_Generator'                => function() {
764 764
                 return EE_Registry::instance()->load_lib(
765 765
                     'Messages_Generator',
766 766
                     array(),
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
                     false
769 769
                 );
770 770
             },
771
-            'EE_Messages_Template_Defaults'        => function ($arguments = array()) {
771
+            'EE_Messages_Template_Defaults'        => function($arguments = array()) {
772 772
                 return EE_Registry::instance()->load_lib(
773 773
                     'Messages_Template_Defaults',
774 774
                     $arguments,
@@ -781,22 +781,22 @@  discard block
 block discarded – undo
781 781
             // 'EEM_Message_Template_Group'           => 'load_model',
782 782
             // 'EEM_Message_Template'                 => 'load_model',
783 783
             //load_helper
784
-            'EEH_Parse_Shortcodes'                 => function () {
784
+            'EEH_Parse_Shortcodes'                 => function() {
785 785
                 if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
786 786
                     return new EEH_Parse_Shortcodes();
787 787
                 }
788 788
                 return null;
789 789
             },
790
-            'EE_Template_Config'                   => function () {
790
+            'EE_Template_Config'                   => function() {
791 791
                 return EE_Config::instance()->template_settings;
792 792
             },
793
-            'EE_Currency_Config'                   => function () {
793
+            'EE_Currency_Config'                   => function() {
794 794
                 return EE_Config::instance()->currency;
795 795
             },
796
-            'EE_Registration_Config'                   => function () {
796
+            'EE_Registration_Config'                   => function() {
797 797
                 return EE_Config::instance()->registration;
798 798
             },
799
-            'EventEspresso\core\services\loaders\Loader' => function () {
799
+            'EventEspresso\core\services\loaders\Loader' => function() {
800 800
                 return LoaderFactory::getLoader();
801 801
             },
802 802
         );
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
             'EventEspresso\core\services\request\ResponseInterface'               => 'EventEspresso\core\services\request\Response',
853 853
             'EventEspresso\core\domain\DomainInterface'                             => 'EventEspresso\core\domain\Domain',
854 854
         );
855
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
855
+        if ( ! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
856 856
             $this->_aliases['EventEspresso\core\services\notices\NoticeConverterInterface'] = 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices';
857 857
         }
858 858
     }
Please login to merge, or discard this patch.
core/services/collections/Collection.php 2 patches
Indentation   +52 added lines, -53 removed lines patch added patch discarded remove patch
@@ -47,37 +47,37 @@  discard block
 block discarded – undo
47 47
 	  */
48 48
 	 public function __construct( $collection_interface ) {
49 49
 		 $this->setCollectionInterface( $collection_interface );
50
-	     $this->setCollectionIdentifier();
50
+		 $this->setCollectionIdentifier();
51 51
 	 }
52 52
 
53 53
 
54
-     /**
55
-      * @return string
56
-      */
57
-     public function collectionIdentifier()
58
-     {
59
-         return $this->collection_identifier;
60
-     }
54
+	 /**
55
+	  * @return string
56
+	  */
57
+	 public function collectionIdentifier()
58
+	 {
59
+		 return $this->collection_identifier;
60
+	 }
61 61
 
62 62
 
63 63
 
64 64
 	 /**
65
-      * creates a very readable unique 9 character identifier like:  CF2-532-DAC
66
-      * and appends it to the non-qualified class name, ex: ThingCollection-CF2-532-DAC
67
-      *
65
+	  * creates a very readable unique 9 character identifier like:  CF2-532-DAC
66
+	  * and appends it to the non-qualified class name, ex: ThingCollection-CF2-532-DAC
67
+	  *
68 68
 	  * @return void
69 69
 	  */
70 70
 	 protected function setCollectionIdentifier() {
71
-         // hash a few collection details
72
-	     $identifier = md5(spl_object_hash($this) . $this->collection_interface . time());
73
-	     // grab a few characters from the start, middle, and end of the hash
74
-	     $id = array();
75
-	     for($x=0; $x<19; $x+=9){
76
-             $id[] = substr($identifier, $x, 3);
77
-         }
78
-         $identifier = basename(str_replace('\\', '/', get_class($this)));
79
-         $identifier .= '-' . strtoupper(implode('-', $id));
80
-         $this->collection_identifier = $identifier;
71
+		 // hash a few collection details
72
+		 $identifier = md5(spl_object_hash($this) . $this->collection_interface . time());
73
+		 // grab a few characters from the start, middle, and end of the hash
74
+		 $id = array();
75
+		 for($x=0; $x<19; $x+=9){
76
+			 $id[] = substr($identifier, $x, 3);
77
+		 }
78
+		 $identifier = basename(str_replace('\\', '/', get_class($this)));
79
+		 $identifier .= '-' . strtoupper(implode('-', $id));
80
+		 $this->collection_identifier = $identifier;
81 81
 	 }
82 82
 
83 83
 
@@ -123,7 +123,6 @@  discard block
 block discarded – undo
123 123
 
124 124
 	 /**
125 125
 	  * setIdentifier
126
-
127 126
 	  * Sets the data associated with an object in the Collection
128 127
 	  * if no $identifier is supplied, then the spl_object_hash() is used
129 128
 	  *
@@ -212,9 +211,9 @@  discard block
 block discarded – undo
212 211
 
213 212
 	 /**
214 213
 	  * hasObjects
215
-      * returns true if there are objects within the Collection, and false if it is empty
216
-      *
217
-      * @access public
214
+	  * returns true if there are objects within the Collection, and false if it is empty
215
+	  *
216
+	  * @access public
218 217
 	  * @return bool
219 218
 	  */
220 219
 	 public function hasObjects() {
@@ -418,34 +417,34 @@  discard block
 block discarded – undo
418 417
 
419 418
 
420 419
 
421
-     /**
422
-      * detaches ALL objects from the Collection
423
-      */
424
-     public function detachAll()
425
-     {
426
-         $this->rewind();
427
-         while ($this->valid()) {
428
-             $object = $this->current();
429
-             $this->next();
430
-             $this->detach($object);
431
-         }
432
-     }
433
-
434
-
435
-
436
-     /**
437
-      * unsets and detaches ALL objects from the Collection
438
-      */
439
-     public function trashAndDetachAll()
440
-     {
441
-         $this->rewind();
442
-         while ($this->valid()) {
443
-             $object = $this->current();
444
-             $this->next();
445
-             $this->detach($object);
446
-             unset($object);
447
-         }
448
-     }
420
+	 /**
421
+	  * detaches ALL objects from the Collection
422
+	  */
423
+	 public function detachAll()
424
+	 {
425
+		 $this->rewind();
426
+		 while ($this->valid()) {
427
+			 $object = $this->current();
428
+			 $this->next();
429
+			 $this->detach($object);
430
+		 }
431
+	 }
432
+
433
+
434
+
435
+	 /**
436
+	  * unsets and detaches ALL objects from the Collection
437
+	  */
438
+	 public function trashAndDetachAll()
439
+	 {
440
+		 $this->rewind();
441
+		 while ($this->valid()) {
442
+			 $object = $this->current();
443
+			 $this->next();
444
+			 $this->detach($object);
445
+			 unset($object);
446
+		 }
447
+	 }
449 448
 
450 449
 
451 450
 
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 use LimitIterator;
7 7
 use SplObjectStorage;
8 8
 
9
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
10
-	exit( 'No direct script access allowed' );
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 /**
13 13
  * Class Collection
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	  * @param string $collection_interface
46 46
 	  * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
47 47
 	  */
48
-	 public function __construct( $collection_interface ) {
49
-		 $this->setCollectionInterface( $collection_interface );
48
+	 public function __construct($collection_interface) {
49
+		 $this->setCollectionInterface($collection_interface);
50 50
 	     $this->setCollectionIdentifier();
51 51
 	 }
52 52
 
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	  */
70 70
 	 protected function setCollectionIdentifier() {
71 71
          // hash a few collection details
72
-	     $identifier = md5(spl_object_hash($this) . $this->collection_interface . time());
72
+	     $identifier = md5(spl_object_hash($this).$this->collection_interface.time());
73 73
 	     // grab a few characters from the start, middle, and end of the hash
74 74
 	     $id = array();
75
-	     for($x=0; $x<19; $x+=9){
75
+	     for ($x = 0; $x < 19; $x += 9) {
76 76
              $id[] = substr($identifier, $x, 3);
77 77
          }
78 78
          $identifier = basename(str_replace('\\', '/', get_class($this)));
79
-         $identifier .= '-' . strtoupper(implode('-', $id));
79
+         $identifier .= '-'.strtoupper(implode('-', $id));
80 80
          $this->collection_identifier = $identifier;
81 81
 	 }
82 82
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	  * @param  string $collection_interface
90 90
 	  * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
91 91
 	  */
92
-	 protected function setCollectionInterface( $collection_interface ) {
93
-		 if ( ! ( interface_exists( $collection_interface ) || class_exists( $collection_interface ) ) ) {
94
-			 throw new InvalidInterfaceException( $collection_interface );
92
+	 protected function setCollectionInterface($collection_interface) {
93
+		 if ( ! (interface_exists($collection_interface) || class_exists($collection_interface))) {
94
+			 throw new InvalidInterfaceException($collection_interface);
95 95
 		 }
96 96
 		 $this->collection_interface = $collection_interface;
97 97
 	 }
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 	  * @return bool
111 111
 	  * @throws \EventEspresso\core\exceptions\InvalidEntityException
112 112
 	  */
113
-	 public function add( $object, $identifier = null ) {
114
-		 if ( ! $object instanceof $this->collection_interface ) {
115
-			 throw new InvalidEntityException( $object, $this->collection_interface );
113
+	 public function add($object, $identifier = null) {
114
+		 if ( ! $object instanceof $this->collection_interface) {
115
+			 throw new InvalidEntityException($object, $this->collection_interface);
116 116
 		 }
117
-		 $this->attach( $object );
118
-		 $this->setIdentifier( $object, $identifier );
119
-		 return $this->contains( $object );
117
+		 $this->attach($object);
118
+		 $this->setIdentifier($object, $identifier);
119
+		 return $this->contains($object);
120 120
 	 }
121 121
 
122 122
 
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 	  * @param  mixed $identifier
133 133
 	  * @return bool
134 134
 	  */
135
-	 public function setIdentifier( $object, $identifier = null ) {
136
-		 $identifier = ! empty( $identifier ) ? $identifier : spl_object_hash( $object );
135
+	 public function setIdentifier($object, $identifier = null) {
136
+		 $identifier = ! empty($identifier) ? $identifier : spl_object_hash($object);
137 137
 		 $this->rewind();
138
-		 while ( $this->valid() ) {
139
-			 if ( $object === $this->current() ) {
140
-				 $this->setInfo( $identifier );
138
+		 while ($this->valid()) {
139
+			 if ($object === $this->current()) {
140
+				 $this->setInfo($identifier);
141 141
 				 $this->rewind();
142 142
 				 return true;
143 143
 			 }
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 	  * @param mixed $identifier
158 158
 	  * @return mixed
159 159
 	  */
160
-	 public function get( $identifier ) {
160
+	 public function get($identifier) {
161 161
 		 $this->rewind();
162
-		 while ( $this->valid() ) {
163
-			 if ( $identifier === $this->getInfo() ) {
162
+		 while ($this->valid()) {
163
+			 if ($identifier === $this->getInfo()) {
164 164
 				 $object = $this->current();
165 165
 				 $this->rewind();
166 166
 				 return $object;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 	  * @param  mixed $identifier
183 183
 	  * @return bool
184 184
 	  */
185
-	 public function has( $identifier ) {
185
+	 public function has($identifier) {
186 186
 		 $this->rewind();
187
-		 while ( $this->valid() ) {
188
-			 if ( $identifier === $this->getInfo() ) {
187
+		 while ($this->valid()) {
188
+			 if ($identifier === $this->getInfo()) {
189 189
 				 $this->rewind();
190 190
 				 return true;
191 191
 			 }
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 	  * @param $object
205 205
 	  * @return bool
206 206
 	  */
207
-	 public function hasObject( $object ) {
208
-		 return $this->contains( $object );
207
+	 public function hasObject($object) {
208
+		 return $this->contains($object);
209 209
 	 }
210 210
 
211 211
 
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
 	  * @param $object
245 245
 	  * @return bool
246 246
 	  */
247
-	 public function remove( $object ) {
248
-		 $this->detach( $object );
247
+	 public function remove($object) {
248
+		 $this->detach($object);
249 249
 		 return true;
250 250
 	 }
251 251
 
@@ -259,10 +259,10 @@  discard block
 block discarded – undo
259 259
 	  * @param mixed $identifier
260 260
 	  * @return boolean
261 261
 	  */
262
-	 public function setCurrent( $identifier ) {
262
+	 public function setCurrent($identifier) {
263 263
 		 $this->rewind();
264
-		 while ( $this->valid() ) {
265
-			 if ( $identifier === $this->getInfo() ) {
264
+		 while ($this->valid()) {
265
+			 if ($identifier === $this->getInfo()) {
266 266
 				 return true;
267 267
 			 }
268 268
 			 $this->next();
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
 	  * @param $object
281 281
 	  * @return boolean
282 282
 	  */
283
-	 public function setCurrentUsingObject( $object ) {
283
+	 public function setCurrentUsingObject($object) {
284 284
 		 $this->rewind();
285
-		 while ( $this->valid() ) {
286
-			 if ( $this->current() === $object ) {
285
+		 while ($this->valid()) {
286
+			 if ($this->current() === $object) {
287 287
 				 return true;
288 288
 			 }
289 289
 			 $this->next();
@@ -300,12 +300,12 @@  discard block
 block discarded – undo
300 300
 	  * @return mixed
301 301
 	  */
302 302
 	 public function previous() {
303
-		 $index = $this->indexOf( $this->current() );
304
-		 if ( $index === 0 ) {
303
+		 $index = $this->indexOf($this->current());
304
+		 if ($index === 0) {
305 305
 			 return $this->current();
306 306
 		 }
307 307
 		 $index--;
308
-		 return $this->objectAtIndex( $index );
308
+		 return $this->objectAtIndex($index);
309 309
 	 }
310 310
 
311 311
 
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 	  * @param $object
318 318
 	  * @return boolean|int|string
319 319
 	  */
320
-	 public function indexOf( $object ) {
321
-		 if ( ! $this->contains( $object ) ) {
320
+	 public function indexOf($object) {
321
+		 if ( ! $this->contains($object)) {
322 322
 			 return false;
323 323
 		 }
324
-		 foreach ( $this as $index => $obj ) {
325
-			 if ( $obj === $object ) {
324
+		 foreach ($this as $index => $obj) {
325
+			 if ($obj === $object) {
326 326
 				 return $index;
327 327
 			 }
328 328
 		 }
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
 	  * @param int $index
339 339
 	  * @return mixed
340 340
 	  */
341
-	 public function objectAtIndex( $index ) {
342
-		 $iterator = new LimitIterator( $this, $index, 1 );
341
+	 public function objectAtIndex($index) {
342
+		 $iterator = new LimitIterator($this, $index, 1);
343 343
 		 $iterator->rewind();
344 344
 		 return $iterator->current();
345 345
 	 }
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
 	  * @param int $length
355 355
 	  * @return array
356 356
 	  */
357
-	 public function slice( $offset, $length ) {
357
+	 public function slice($offset, $length) {
358 358
 		 $slice = array();
359
-		 $iterator = new LimitIterator( $this, $offset, $length );
360
-		 foreach ( $iterator as $object ) {
359
+		 $iterator = new LimitIterator($this, $offset, $length);
360
+		 foreach ($iterator as $object) {
361 361
 			 $slice[] = $object;
362 362
 		 }
363 363
 		 return $slice;
@@ -372,35 +372,35 @@  discard block
 block discarded – undo
372 372
 	  * @param mixed $objects A single object or an array of objects
373 373
 	  * @param int $index
374 374
 	  */
375
-	 public function insertAt( $objects, $index ) {
376
-		 if ( ! is_array( $objects ) ) {
377
-			 $objects = array( $objects );
375
+	 public function insertAt($objects, $index) {
376
+		 if ( ! is_array($objects)) {
377
+			 $objects = array($objects);
378 378
 		 }
379 379
 		 // check to ensure that objects don't already exist in the collection
380
-		 foreach ( $objects as $key => $object ) {
381
-			 if ( $this->contains( $object ) ) {
382
-				 unset( $objects[ $key ] );
380
+		 foreach ($objects as $key => $object) {
381
+			 if ($this->contains($object)) {
382
+				 unset($objects[$key]);
383 383
 			 }
384 384
 		 }
385 385
 		 // do we have any objects left?
386
-		 if ( ! $objects ) {
386
+		 if ( ! $objects) {
387 387
 			 return;
388 388
 		 }
389 389
 		 // detach any objects at or past this index
390 390
 		 $remaining = array();
391
-		 if ( $index < $this->count() ) {
392
-			 $remaining = $this->slice( $index, $this->count() - $index );
393
-			 foreach ( $remaining as $object ) {
394
-				 $this->detach( $object );
391
+		 if ($index < $this->count()) {
392
+			 $remaining = $this->slice($index, $this->count() - $index);
393
+			 foreach ($remaining as $object) {
394
+				 $this->detach($object);
395 395
 			 }
396 396
 		 }
397 397
 		 // add the new objects we're splicing in
398
-		 foreach ( $objects as $object ) {
399
-			 $this->attach( $object );
398
+		 foreach ($objects as $object) {
399
+			 $this->attach($object);
400 400
 		 }
401 401
 		 // attach the objects we previously detached
402
-		 foreach ( $remaining as $object ) {
403
-			 $this->attach( $object );
402
+		 foreach ($remaining as $object) {
403
+			 $this->attach($object);
404 404
 		 }
405 405
 	 }
406 406
 
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
 	  * @see http://stackoverflow.com/a/8736013
413 413
 	  * @param int $index
414 414
 	  */
415
-	 public function removeAt( $index ) {
416
-		 $this->detach( $this->objectAtIndex( $index ) );
415
+	 public function removeAt($index) {
416
+		 $this->detach($this->objectAtIndex($index));
417 417
 	 }
418 418
 
419 419
 
Please login to merge, or discard this patch.
core/services/editor/EditorBlockRegistrationManager.php 2 patches
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -37,141 +37,141 @@
 block discarded – undo
37 37
 class EditorBlockRegistrationManager extends EditorBlockManager
38 38
 {
39 39
 
40
-    /**
41
-     *  Returns the name of a hookpoint to be used to call initialize()
42
-     *
43
-     * @return string
44
-     */
45
-    public function init_hook()
46
-    {
47
-        return 'AHEE__EE_System__set_hooks_for_core';
48
-    }
49
-
50
-
51
-    /**
52
-     * Perform any early setup required for block editors to functions
53
-     *
54
-     * @return void
55
-     * @throws Exception
56
-     */
57
-    public function initialize()
58
-    {
59
-        $this->loadEditorBlocks();
60
-        add_action('AHEE__EE_System__initialize', array($this, 'registerEditorBlocks'));
61
-    }
62
-
63
-
64
-    /**
65
-     * @return CollectionInterface|EditorBlockInterface[]
66
-     * @throws ReflectionException
67
-     * @throws InvalidArgumentException
68
-     * @throws EE_Error
69
-     * @throws InvalidClassException
70
-     * @throws InvalidDataTypeException
71
-     * @throws InvalidEntityException
72
-     * @throws InvalidFilePathException
73
-     * @throws InvalidIdentifierException
74
-     * @throws InvalidInterfaceException
75
-     */
76
-    protected function populateEditorBlockCollection()
77
-    {
78
-        $loader = new CollectionLoader(
79
-            new CollectionDetails(
80
-            // collection name
81
-                'shortcodes',
82
-                // collection interface
83
-                'EventEspresso\core\domain\entities\editor\EditorBlockInterface',
84
-                // FQCNs for classes to add (all classes within each namespace will be loaded)
85
-                apply_filters(
86
-                    'FHEE__EventEspresso_core_services_editor_EditorBlockManager__populateEditorBlockCollection__collection_FQCNs',
87
-                    array('EventEspresso\core\domain\entities\editor\blocks')
88
-                ),
89
-                // filepaths to classes to add
90
-                array(),
91
-                // file mask to use if parsing folder for files to add
92
-                '',
93
-                // what to use as identifier for collection entities
94
-                // using CLASS NAME prevents duplicates (works like a singleton)
95
-                CollectionDetails::ID_CLASS_NAME
96
-            ),
97
-            $this->blocks
98
-        );
99
-        return $loader->getCollection();
100
-    }
101
-
102
-
103
-    /**
104
-     * populates the EditorBlockCollection and calls initialize() on all installed blocks
105
-     *
106
-     * @return void
107
-     * @throws Exception
108
-     */
109
-    public function loadEditorBlocks()
110
-    {
111
-        try {
112
-            $this->populateEditorBlockCollection();
113
-            // cycle thru block loaders and initialize each loader
114
-            foreach ($this->blocks as $block) {
115
-                $block->initialize();
116
-            }
117
-        } catch (Exception $exception) {
118
-            new ExceptionStackTraceDisplay($exception);
119
-        }
120
-    }
121
-
122
-
123
-    /**
124
-     * calls registerBlock() and load assets for all installed blocks
125
-     *
126
-     * @return void
127
-     * @throws Exception
128
-     */
129
-    public function registerEditorBlocks()
130
-    {
131
-        try {
132
-            // register primary assets
133
-            add_action('enqueue_block_assets', array($this, 'registerStyles'));
134
-            add_action('enqueue_block_assets', array($this, 'registerScripts'));
135
-            // cycle thru block loader folders
136
-            foreach ($this->blocks as $block) {
137
-                // perform any setup required for the block
138
-                $block_type = $block->registerBlock();
139
-                if (! $block_type instanceof WP_Block_Type) {
140
-                    throw new InvalidEntityException($block_type, 'WP_Block_Type');
141
-                }
142
-                add_action('enqueue_block_assets', array($block, 'registerStyles'));
143
-                add_action('enqueue_block_assets', array($block, 'registerScripts'));
144
-                do_action(
145
-                    'FHEE__EventEspresso_core_services_editor_EditorBlockManager__registerEditorBlocks__block_type_registered',
146
-                    $block,
147
-                    $block_type
148
-                );
149
-            }
150
-        } catch (Exception $exception) {
151
-            new ExceptionStackTraceDisplay($exception);
152
-        }
153
-    }
154
-
155
-
156
-    public function registerStyles()
157
-    {
158
-        wp_register_style(
159
-            'ee-block-styles',
160
-            $this->domain->distributionAssetsUrl() . 'style.css',
161
-            array(),
162
-            filemtime($this->domain->distributionAssetsPath() . 'style.css')
163
-        );
164
-    }
165
-
166
-
167
-    public function registerScripts()
168
-    {
169
-        wp_register_script(
170
-            'ee-shortcode-blocks',
171
-            $this->domain->distributionAssetsUrl() . 'ee-shortcode-blocks.dist.js',
172
-            array('wp-blocks'),
173
-            filemtime($this->domain->distributionAssetsPath() . 'ee-shortcode-blocks.dist.js')
174
-        );
175
-    }
40
+	/**
41
+	 *  Returns the name of a hookpoint to be used to call initialize()
42
+	 *
43
+	 * @return string
44
+	 */
45
+	public function init_hook()
46
+	{
47
+		return 'AHEE__EE_System__set_hooks_for_core';
48
+	}
49
+
50
+
51
+	/**
52
+	 * Perform any early setup required for block editors to functions
53
+	 *
54
+	 * @return void
55
+	 * @throws Exception
56
+	 */
57
+	public function initialize()
58
+	{
59
+		$this->loadEditorBlocks();
60
+		add_action('AHEE__EE_System__initialize', array($this, 'registerEditorBlocks'));
61
+	}
62
+
63
+
64
+	/**
65
+	 * @return CollectionInterface|EditorBlockInterface[]
66
+	 * @throws ReflectionException
67
+	 * @throws InvalidArgumentException
68
+	 * @throws EE_Error
69
+	 * @throws InvalidClassException
70
+	 * @throws InvalidDataTypeException
71
+	 * @throws InvalidEntityException
72
+	 * @throws InvalidFilePathException
73
+	 * @throws InvalidIdentifierException
74
+	 * @throws InvalidInterfaceException
75
+	 */
76
+	protected function populateEditorBlockCollection()
77
+	{
78
+		$loader = new CollectionLoader(
79
+			new CollectionDetails(
80
+			// collection name
81
+				'shortcodes',
82
+				// collection interface
83
+				'EventEspresso\core\domain\entities\editor\EditorBlockInterface',
84
+				// FQCNs for classes to add (all classes within each namespace will be loaded)
85
+				apply_filters(
86
+					'FHEE__EventEspresso_core_services_editor_EditorBlockManager__populateEditorBlockCollection__collection_FQCNs',
87
+					array('EventEspresso\core\domain\entities\editor\blocks')
88
+				),
89
+				// filepaths to classes to add
90
+				array(),
91
+				// file mask to use if parsing folder for files to add
92
+				'',
93
+				// what to use as identifier for collection entities
94
+				// using CLASS NAME prevents duplicates (works like a singleton)
95
+				CollectionDetails::ID_CLASS_NAME
96
+			),
97
+			$this->blocks
98
+		);
99
+		return $loader->getCollection();
100
+	}
101
+
102
+
103
+	/**
104
+	 * populates the EditorBlockCollection and calls initialize() on all installed blocks
105
+	 *
106
+	 * @return void
107
+	 * @throws Exception
108
+	 */
109
+	public function loadEditorBlocks()
110
+	{
111
+		try {
112
+			$this->populateEditorBlockCollection();
113
+			// cycle thru block loaders and initialize each loader
114
+			foreach ($this->blocks as $block) {
115
+				$block->initialize();
116
+			}
117
+		} catch (Exception $exception) {
118
+			new ExceptionStackTraceDisplay($exception);
119
+		}
120
+	}
121
+
122
+
123
+	/**
124
+	 * calls registerBlock() and load assets for all installed blocks
125
+	 *
126
+	 * @return void
127
+	 * @throws Exception
128
+	 */
129
+	public function registerEditorBlocks()
130
+	{
131
+		try {
132
+			// register primary assets
133
+			add_action('enqueue_block_assets', array($this, 'registerStyles'));
134
+			add_action('enqueue_block_assets', array($this, 'registerScripts'));
135
+			// cycle thru block loader folders
136
+			foreach ($this->blocks as $block) {
137
+				// perform any setup required for the block
138
+				$block_type = $block->registerBlock();
139
+				if (! $block_type instanceof WP_Block_Type) {
140
+					throw new InvalidEntityException($block_type, 'WP_Block_Type');
141
+				}
142
+				add_action('enqueue_block_assets', array($block, 'registerStyles'));
143
+				add_action('enqueue_block_assets', array($block, 'registerScripts'));
144
+				do_action(
145
+					'FHEE__EventEspresso_core_services_editor_EditorBlockManager__registerEditorBlocks__block_type_registered',
146
+					$block,
147
+					$block_type
148
+				);
149
+			}
150
+		} catch (Exception $exception) {
151
+			new ExceptionStackTraceDisplay($exception);
152
+		}
153
+	}
154
+
155
+
156
+	public function registerStyles()
157
+	{
158
+		wp_register_style(
159
+			'ee-block-styles',
160
+			$this->domain->distributionAssetsUrl() . 'style.css',
161
+			array(),
162
+			filemtime($this->domain->distributionAssetsPath() . 'style.css')
163
+		);
164
+	}
165
+
166
+
167
+	public function registerScripts()
168
+	{
169
+		wp_register_script(
170
+			'ee-shortcode-blocks',
171
+			$this->domain->distributionAssetsUrl() . 'ee-shortcode-blocks.dist.js',
172
+			array('wp-blocks'),
173
+			filemtime($this->domain->distributionAssetsPath() . 'ee-shortcode-blocks.dist.js')
174
+		);
175
+	}
176 176
 
177 177
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             foreach ($this->blocks as $block) {
137 137
                 // perform any setup required for the block
138 138
                 $block_type = $block->registerBlock();
139
-                if (! $block_type instanceof WP_Block_Type) {
139
+                if ( ! $block_type instanceof WP_Block_Type) {
140 140
                     throw new InvalidEntityException($block_type, 'WP_Block_Type');
141 141
                 }
142 142
                 add_action('enqueue_block_assets', array($block, 'registerStyles'));
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
     {
158 158
         wp_register_style(
159 159
             'ee-block-styles',
160
-            $this->domain->distributionAssetsUrl() . 'style.css',
160
+            $this->domain->distributionAssetsUrl().'style.css',
161 161
             array(),
162
-            filemtime($this->domain->distributionAssetsPath() . 'style.css')
162
+            filemtime($this->domain->distributionAssetsPath().'style.css')
163 163
         );
164 164
     }
165 165
 
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
     {
169 169
         wp_register_script(
170 170
             'ee-shortcode-blocks',
171
-            $this->domain->distributionAssetsUrl() . 'ee-shortcode-blocks.dist.js',
171
+            $this->domain->distributionAssetsUrl().'ee-shortcode-blocks.dist.js',
172 172
             array('wp-blocks'),
173
-            filemtime($this->domain->distributionAssetsPath() . 'ee-shortcode-blocks.dist.js')
173
+            filemtime($this->domain->distributionAssetsPath().'ee-shortcode-blocks.dist.js')
174 174
         );
175 175
     }
176 176
 
Please login to merge, or discard this patch.
core/services/editor/EditorBlockManager.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -24,84 +24,84 @@
 block discarded – undo
24 24
 abstract class EditorBlockManager
25 25
 {
26 26
 
27
-    /**
28
-     * @var CollectionInterface|EditorBlockInterface[] $blocks
29
-     */
30
-    protected $blocks;
31
-
32
-    /**
33
-     * @var RequestInterface $request
34
-     */
35
-    protected $request;
36
-
37
-    /**
38
-     * @var DomainInterface $domain
39
-     */
40
-    protected $domain;
41
-
42
-    /**
43
-     * the post type that the current request applies to
44
-     *
45
-     * @var string $request_post_type
46
-     */
47
-    protected $request_post_type;
48
-
49
-    /**
50
-     * value of the 'page' $_GET param
51
-     *
52
-     * @var string $page
53
-     */
54
-    protected $page;
55
-
56
-    /**
57
-     * value of the 'action' $_GET param
58
-     *
59
-     * @var string $action
60
-     */
61
-    protected $action;
62
-
63
-    /**
64
-     * EditorBlockManager constructor.
65
-     *
66
-     * @param EditorBlockCollection $blocks
67
-     * @param RequestInterface      $request
68
-     * @param DomainInterface       $domain
69
-     */
70
-    public function __construct(EditorBlockCollection $blocks, RequestInterface $request, DomainInterface $domain)
71
-    {
72
-        $this->blocks  = $blocks;
73
-        $this->request = $request;
74
-        $this->domain  = $domain;
75
-        $this->request_post_type = $this->request->getRequestParam('post_type', '');
76
-        $this->page = $this->request->getRequestParam('page', '');
77
-        $this->action = $this->request->getRequestParam('action', '');
78
-        add_action($this->init_hook(), array($this, 'initialize'));
79
-    }
80
-
81
-
82
-    /**
83
-     *  Returns the name of a hookpoint to be used to call initialize()
84
-     *
85
-     * @return string
86
-     */
87
-    abstract public function init_hook();
88
-
89
-
90
-    /**
91
-     * Perform any early setup required for block editors to functions
92
-     *
93
-     * @return void
94
-     */
95
-    abstract public function initialize();
96
-
97
-
98
-    /**
99
-     * @return string
100
-     */
101
-    public function currentRequestPostType()
102
-    {
103
-        return $this->request_post_type;
104
-    }
27
+	/**
28
+	 * @var CollectionInterface|EditorBlockInterface[] $blocks
29
+	 */
30
+	protected $blocks;
31
+
32
+	/**
33
+	 * @var RequestInterface $request
34
+	 */
35
+	protected $request;
36
+
37
+	/**
38
+	 * @var DomainInterface $domain
39
+	 */
40
+	protected $domain;
41
+
42
+	/**
43
+	 * the post type that the current request applies to
44
+	 *
45
+	 * @var string $request_post_type
46
+	 */
47
+	protected $request_post_type;
48
+
49
+	/**
50
+	 * value of the 'page' $_GET param
51
+	 *
52
+	 * @var string $page
53
+	 */
54
+	protected $page;
55
+
56
+	/**
57
+	 * value of the 'action' $_GET param
58
+	 *
59
+	 * @var string $action
60
+	 */
61
+	protected $action;
62
+
63
+	/**
64
+	 * EditorBlockManager constructor.
65
+	 *
66
+	 * @param EditorBlockCollection $blocks
67
+	 * @param RequestInterface      $request
68
+	 * @param DomainInterface       $domain
69
+	 */
70
+	public function __construct(EditorBlockCollection $blocks, RequestInterface $request, DomainInterface $domain)
71
+	{
72
+		$this->blocks  = $blocks;
73
+		$this->request = $request;
74
+		$this->domain  = $domain;
75
+		$this->request_post_type = $this->request->getRequestParam('post_type', '');
76
+		$this->page = $this->request->getRequestParam('page', '');
77
+		$this->action = $this->request->getRequestParam('action', '');
78
+		add_action($this->init_hook(), array($this, 'initialize'));
79
+	}
80
+
81
+
82
+	/**
83
+	 *  Returns the name of a hookpoint to be used to call initialize()
84
+	 *
85
+	 * @return string
86
+	 */
87
+	abstract public function init_hook();
88
+
89
+
90
+	/**
91
+	 * Perform any early setup required for block editors to functions
92
+	 *
93
+	 * @return void
94
+	 */
95
+	abstract public function initialize();
96
+
97
+
98
+	/**
99
+	 * @return string
100
+	 */
101
+	public function currentRequestPostType()
102
+	{
103
+		return $this->request_post_type;
104
+	}
105 105
 
106 106
 
107 107
 }
Please login to merge, or discard this patch.
core/services/editor/EditorBlockAdminManager.php 2 patches
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -20,96 +20,96 @@
 block discarded – undo
20 20
 class EditorBlockAdminManager extends EditorBlockManager
21 21
 {
22 22
 
23
-    /**
24
-     *  Returns the name of a hookpoint to be used to call initialize()
25
-     *
26
-     * @return string
27
-     */
28
-    public function init_hook()
29
-    {
30
-        return 'AHEE__EE_System__load_CPTs_and_session__complete';
31
-    }
32
-
33
-
34
-    /**
35
-     * Perform any early setup required for block editors to functions
36
-     *
37
-     * @return void
38
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
39
-     * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
40
-     * @throws \InvalidArgumentException
41
-     */
42
-    public function initialize()
43
-    {
44
-        $custom_post_types     = EE_Register_CPTs::get_CPTs();
45
-        $espresso_post_types   = array_keys($custom_post_types);
46
-        $espresso_post_types[] = 'espresso_registrations';
47
-        if (
48
-            ($this->action === 'edit' || $this->action === 'create_new' || $this->action === 'edit_attendee')
49
-            && in_array($this->page, $espresso_post_types, true)
50
-        ) {
51
-            $this->loadCustomPostTypeBlockEditor(array_keys($custom_post_types));
52
-        }
53
-        add_action('admin_url', array($this, 'coerceEeCptEditorUrlForGutenberg'), 10, 3);/**/
54
-    }
55
-
56
-
57
-    public function loadCustomPostTypeBlockEditor(array $custom_post_types)
58
-    {
59
-        $this->modifyWpPostTypes($custom_post_types);
60
-        add_action('admin_enqueue_scripts', array($this, 'registerAdminScripts'), 20);
61
-        add_filter('FHEE__EE_Admin_Page_CPT___create_new_cpt_item__replace_editor', 'gutenberg_init', 10, 2);
62
-    }
63
-
64
-    /**
65
-     * Manipulate globals related to EE Post Type so gutenberg loads.
66
-     */
67
-    private function modifyWpPostTypes(array $custom_post_types)
68
-    {
69
-        global $wp_post_types, $_wp_post_type_features;
70
-        foreach ($custom_post_types as $post_type) {
71
-            $_wp_post_type_features[ $post_type ]['editor'] = true;
72
-            if(isset($wp_post_types[ $post_type ]) && $wp_post_types[ $post_type ] instanceof WP_Post_Type){
73
-                $post_type_object = $wp_post_types[ $post_type ];
74
-                $post_type_object->show_in_rest = true;
75
-                $post_type_object->template = array();
76
-                foreach ($this->blocks as $block) {
77
-                    if($block->appliesToPostType($post_type)){
78
-                        $post_type_object->template[] = $block->getEditorContainer();
79
-                    }
80
-                }
81
-            }
82
-        }
83
-    }
84
-
85
-
86
-    public function coerceEeCptEditorUrlForGutenberg($url, $path, $blog_id)
87
-    {
88
-        if (
89
-            $this->page === 'espresso_events'
90
-            && ($this->action === 'edit' || $this->action === 'create_new')
91
-            && strpos($path, 'post.php') !== false
92
-        ) {
93
-            return add_query_arg(
94
-                array(
95
-                    'page'   => $this->page,
96
-                    'action' => $this->action
97
-                ),
98
-                get_site_url($blog_id)
99
-            );
100
-        }
101
-        return $url;
102
-    }
103
-
104
-
105
-
106
-    public function registerAdminScripts()
107
-    {
108
-        wp_register_script(
109
-            'ee-event-editor-blocks',
110
-            $this->domain->distributionAssetsUrl() . 'ee-event-editor-blocks.dist.js',
111
-            array('wp-blocks'),
112
-            filemtime($this->domain->distributionAssetsPath() . 'ee-event-editor-blocks.dist.js')
113
-        );
114
-    }
23
+	/**
24
+	 *  Returns the name of a hookpoint to be used to call initialize()
25
+	 *
26
+	 * @return string
27
+	 */
28
+	public function init_hook()
29
+	{
30
+		return 'AHEE__EE_System__load_CPTs_and_session__complete';
31
+	}
32
+
33
+
34
+	/**
35
+	 * Perform any early setup required for block editors to functions
36
+	 *
37
+	 * @return void
38
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
39
+	 * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
40
+	 * @throws \InvalidArgumentException
41
+	 */
42
+	public function initialize()
43
+	{
44
+		$custom_post_types     = EE_Register_CPTs::get_CPTs();
45
+		$espresso_post_types   = array_keys($custom_post_types);
46
+		$espresso_post_types[] = 'espresso_registrations';
47
+		if (
48
+			($this->action === 'edit' || $this->action === 'create_new' || $this->action === 'edit_attendee')
49
+			&& in_array($this->page, $espresso_post_types, true)
50
+		) {
51
+			$this->loadCustomPostTypeBlockEditor(array_keys($custom_post_types));
52
+		}
53
+		add_action('admin_url', array($this, 'coerceEeCptEditorUrlForGutenberg'), 10, 3);/**/
54
+	}
55
+
56
+
57
+	public function loadCustomPostTypeBlockEditor(array $custom_post_types)
58
+	{
59
+		$this->modifyWpPostTypes($custom_post_types);
60
+		add_action('admin_enqueue_scripts', array($this, 'registerAdminScripts'), 20);
61
+		add_filter('FHEE__EE_Admin_Page_CPT___create_new_cpt_item__replace_editor', 'gutenberg_init', 10, 2);
62
+	}
63
+
64
+	/**
65
+	 * Manipulate globals related to EE Post Type so gutenberg loads.
66
+	 */
67
+	private function modifyWpPostTypes(array $custom_post_types)
68
+	{
69
+		global $wp_post_types, $_wp_post_type_features;
70
+		foreach ($custom_post_types as $post_type) {
71
+			$_wp_post_type_features[ $post_type ]['editor'] = true;
72
+			if(isset($wp_post_types[ $post_type ]) && $wp_post_types[ $post_type ] instanceof WP_Post_Type){
73
+				$post_type_object = $wp_post_types[ $post_type ];
74
+				$post_type_object->show_in_rest = true;
75
+				$post_type_object->template = array();
76
+				foreach ($this->blocks as $block) {
77
+					if($block->appliesToPostType($post_type)){
78
+						$post_type_object->template[] = $block->getEditorContainer();
79
+					}
80
+				}
81
+			}
82
+		}
83
+	}
84
+
85
+
86
+	public function coerceEeCptEditorUrlForGutenberg($url, $path, $blog_id)
87
+	{
88
+		if (
89
+			$this->page === 'espresso_events'
90
+			&& ($this->action === 'edit' || $this->action === 'create_new')
91
+			&& strpos($path, 'post.php') !== false
92
+		) {
93
+			return add_query_arg(
94
+				array(
95
+					'page'   => $this->page,
96
+					'action' => $this->action
97
+				),
98
+				get_site_url($blog_id)
99
+			);
100
+		}
101
+		return $url;
102
+	}
103
+
104
+
105
+
106
+	public function registerAdminScripts()
107
+	{
108
+		wp_register_script(
109
+			'ee-event-editor-blocks',
110
+			$this->domain->distributionAssetsUrl() . 'ee-event-editor-blocks.dist.js',
111
+			array('wp-blocks'),
112
+			filemtime($this->domain->distributionAssetsPath() . 'ee-event-editor-blocks.dist.js')
113
+		);
114
+	}
115 115
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         ) {
51 51
             $this->loadCustomPostTypeBlockEditor(array_keys($custom_post_types));
52 52
         }
53
-        add_action('admin_url', array($this, 'coerceEeCptEditorUrlForGutenberg'), 10, 3);/**/
53
+        add_action('admin_url', array($this, 'coerceEeCptEditorUrlForGutenberg'), 10, 3); /**/
54 54
     }
55 55
 
56 56
 
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
     {
69 69
         global $wp_post_types, $_wp_post_type_features;
70 70
         foreach ($custom_post_types as $post_type) {
71
-            $_wp_post_type_features[ $post_type ]['editor'] = true;
72
-            if(isset($wp_post_types[ $post_type ]) && $wp_post_types[ $post_type ] instanceof WP_Post_Type){
73
-                $post_type_object = $wp_post_types[ $post_type ];
71
+            $_wp_post_type_features[$post_type]['editor'] = true;
72
+            if (isset($wp_post_types[$post_type]) && $wp_post_types[$post_type] instanceof WP_Post_Type) {
73
+                $post_type_object = $wp_post_types[$post_type];
74 74
                 $post_type_object->show_in_rest = true;
75 75
                 $post_type_object->template = array();
76 76
                 foreach ($this->blocks as $block) {
77
-                    if($block->appliesToPostType($post_type)){
77
+                    if ($block->appliesToPostType($post_type)) {
78 78
                         $post_type_object->template[] = $block->getEditorContainer();
79 79
                     }
80 80
                 }
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
     {
108 108
         wp_register_script(
109 109
             'ee-event-editor-blocks',
110
-            $this->domain->distributionAssetsUrl() . 'ee-event-editor-blocks.dist.js',
110
+            $this->domain->distributionAssetsUrl().'ee-event-editor-blocks.dist.js',
111 111
             array('wp-blocks'),
112
-            filemtime($this->domain->distributionAssetsPath() . 'ee-event-editor-blocks.dist.js')
112
+            filemtime($this->domain->distributionAssetsPath().'ee-event-editor-blocks.dist.js')
113 113
         );
114 114
     }
115 115
 }
Please login to merge, or discard this patch.