Completed
Branch rem-enhancements (00a025)
by
unknown
34:38 queued 23:18
created
core/services/dependencies/DependencyHandler.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,19 +7,19 @@
 block discarded – undo
7 7
 abstract class DependencyHandler implements DependencyHandlerInterface
8 8
 {
9 9
 
10
-    /**
11
-     * @var EE_Dependency_Map $dependency_map
12
-     */
13
-    protected $dependency_map;
10
+	/**
11
+	 * @var EE_Dependency_Map $dependency_map
12
+	 */
13
+	protected $dependency_map;
14 14
 
15 15
 
16
-    /**
17
-     * DependencyHandler constructor.
18
-     *
19
-     * @param EE_Dependency_Map $dependency_map
20
-     */
21
-    public function __construct(EE_Dependency_Map $dependency_map)
22
-    {
23
-        $this->dependency_map = $dependency_map;
24
-    }
16
+	/**
17
+	 * DependencyHandler constructor.
18
+	 *
19
+	 * @param EE_Dependency_Map $dependency_map
20
+	 */
21
+	public function __construct(EE_Dependency_Map $dependency_map)
22
+	{
23
+		$this->dependency_map = $dependency_map;
24
+	}
25 25
 }
Please login to merge, or discard this patch.
core/services/dependencies/DependencyHandlerInterface.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 
5 5
 interface DependencyHandlerInterface
6 6
 {
7
-    /**
8
-     * @since $VID:$
9
-     */
10
-    public function registerDependencies();
7
+	/**
8
+	 * @since $VID:$
9
+	 */
10
+	public function registerDependencies();
11 11
 }
Please login to merge, or discard this patch.
core/services/routing/Router.php 1 patch
Indentation   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -15,236 +15,236 @@
 block discarded – undo
15 15
 class Router
16 16
 {
17 17
 
18
-    /**
19
-     * @var EE_Dependency_Map $dependency_map
20
-     */
21
-    protected $dependency_map;
22
-
23
-    /**
24
-     * @var LoaderInterface $loader
25
-     */
26
-    protected $loader;
27
-
28
-    /**
29
-     * @var RouteHandler $route_handler
30
-     */
31
-    protected $route_handler;
32
-
33
-    /**
34
-     * @var string $route_request_type
35
-     */
36
-    protected $route_request_type;
37
-
38
-
39
-    /**
40
-     * RoutingSwitch constructor.
41
-     *
42
-     * @param EE_Dependency_Map $dependency_map
43
-     * @param LoaderInterface   $loader
44
-     * @param RouteHandler      $router
45
-     */
46
-    public function __construct(EE_Dependency_Map $dependency_map, LoaderInterface $loader, RouteHandler $router)
47
-    {
48
-        $this->dependency_map = $dependency_map;
49
-        $this->loader         = $loader;
50
-        $this->route_handler  = $router;
51
-    }
52
-
53
-
54
-    /**
55
-     * @throws Exception
56
-     */
57
-    public function loadPrimaryRoutes()
58
-    {
59
-        do_action(
60
-            'AHEE__EventEspresso_core_services_routing_Router__loadPrimaryRoutes',
61
-            $this->route_handler,
62
-            $this->route_request_type,
63
-            $this->dependency_map
64
-        );
65
-        $this->dependency_map->registerDependencies(
66
-            'EventEspresso\core\domain\entities\routing\handlers\admin\ActivationRequests',
67
-            Route::getFullDependencies()
68
-        );
69
-        $this->dependency_map->registerDependencies(
70
-            'EventEspresso\core\domain\entities\routing\handlers\shared\RegularRequests',
71
-            Route::getFullDependencies()
72
-        );
73
-        // now load and prep all primary Routes
74
-        $this->route_handler->addRoute('EventEspresso\core\domain\entities\routing\handlers\admin\ActivationRequests');
75
-        $this->route_handler->addRoute('EventEspresso\core\domain\entities\routing\handlers\shared\RegularRequests');
76
-        $this->route_request_type = $this->route_handler->getRouteRequestType();
77
-    }
78
-
79
-
80
-    /**
81
-     *
82
-     * @throws Exception
83
-     */
84
-    public function registerShortcodesModulesAndWidgets()
85
-    {
86
-        do_action(
87
-            'AHEE__EventEspresso_core_services_routing_Router__registerShortcodesModulesAndWidgets',
88
-            $this->route_handler,
89
-            $this->route_request_type,
90
-            $this->dependency_map
91
-        );
92
-        switch ($this->route_request_type) {
93
-            case PrimaryRoute::ROUTE_REQUEST_TYPE_ACTIVATION:
94
-                break;
95
-            case PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR:
96
-                $this->route_handler->addRoute(
97
-                    'EventEspresso\core\domain\entities\routing\handlers\frontend\ShortcodeRequests'
98
-                );
99
-                break;
100
-        }
101
-    }
102
-
103
-
104
-    /**
105
-     *
106
-     * @throws Exception
107
-     * @throws Exception
108
-     * @throws Exception
109
-     * @throws Exception
110
-     */
111
-    public function brewEspresso()
112
-    {
113
-        do_action(
114
-            'AHEE__EventEspresso_core_services_routing_Router__brewEspresso',
115
-            $this->route_handler,
116
-            $this->route_request_type,
117
-            $this->dependency_map
118
-        );
119
-        switch ($this->route_request_type) {
120
-            case PrimaryRoute::ROUTE_REQUEST_TYPE_ACTIVATION:
121
-                $this->route_handler->addRoute(
122
-                    'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests'
123
-                );
124
-                break;
125
-            case PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR:
126
-                $this->route_handler->addRoute(
127
-                    'EventEspresso\core\domain\entities\routing\handlers\shared\GQLRequests'
128
-                );
129
-                $this->route_handler->addRoute(
130
-                    'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests'
131
-                );
132
-                $this->route_handler->addRoute(
133
-                    'EventEspresso\core\domain\entities\routing\handlers\shared\RestApiRequests'
134
-                );
135
-                break;
136
-        }
137
-    }
138
-
139
-
140
-    /**
141
-     *
142
-     * @throws Exception
143
-     * @throws Exception
144
-     * @throws Exception
145
-     * @throws Exception
146
-     * @throws Exception
147
-     * @throws Exception
148
-     * @throws Exception
149
-     * @throws Exception
150
-     * @throws Exception
151
-     * @throws Exception
152
-     */
153
-    public function loadControllers()
154
-    {
155
-        do_action(
156
-            'AHEE__EventEspresso_core_services_routing_Router__loadControllers',
157
-            $this->route_handler,
158
-            $this->route_request_type,
159
-            $this->dependency_map
160
-        );
161
-        switch ($this->route_request_type) {
162
-            case PrimaryRoute::ROUTE_REQUEST_TYPE_ACTIVATION:
163
-                $this->route_handler->addRoute(
164
-                    'EventEspresso\core\domain\entities\routing\handlers\admin\AdminRoute'
165
-                );
166
-                $this->route_handler->addRoute(
167
-                    'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage'
168
-                );
169
-                break;
170
-            case PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR:
171
-                $this->route_handler->addRoute(
172
-                    'EventEspresso\core\domain\entities\routing\handlers\frontend\FrontendRequests'
173
-                );
174
-                $this->route_handler->addRoute(
175
-                    'EventEspresso\core\domain\entities\routing\handlers\admin\AdminRoute'
176
-                );
177
-                $this->route_handler->addRoute(
178
-                    'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoLegacyAdmin'
179
-                );
180
-                $this->route_handler->addRoute(
181
-                    'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventsAdmin'
182
-                );
183
-                $this->route_handler->addRoute(
184
-                    'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventEditor'
185
-                );
186
-                $this->route_handler->addRoute(
187
-                    'EventEspresso\core\domain\entities\routing\handlers\admin\GutenbergEditor'
188
-                );
189
-                $this->route_handler->addRoute(
190
-                    'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage'
191
-                );
192
-                $this->route_handler->addRoute(
193
-                    'EventEspresso\core\domain\entities\routing\handlers\shared\WordPressHeartbeat'
194
-                );
195
-                break;
196
-        }
197
-    }
198
-
199
-
200
-    /**
201
-     *
202
-     * @throws Exception
203
-     * @throws Exception
204
-     */
205
-    public function coreLoadedAndReady()
206
-    {
207
-        do_action(
208
-            'AHEE__EventEspresso_core_services_routing_Router__coreLoadedAndReady',
209
-            $this->route_handler,
210
-            $this->route_request_type,
211
-            $this->dependency_map
212
-        );
213
-        switch ($this->route_request_type) {
214
-            case PrimaryRoute::ROUTE_REQUEST_TYPE_ACTIVATION:
215
-                break;
216
-            case PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR:
217
-                $this->route_handler->addRoute(
218
-                    'EventEspresso\core\domain\entities\routing\handlers\shared\AssetRequests'
219
-                );
220
-                $this->route_handler->addRoute(
221
-                    'EventEspresso\core\domain\entities\routing\handlers\shared\SessionRequests'
222
-                );
223
-                break;
224
-        }
225
-    }
226
-
227
-
228
-    /**
229
-     *
230
-     * @throws Exception
231
-     */
232
-    public function initializeLast()
233
-    {
234
-        do_action(
235
-            'AHEE__EventEspresso_core_services_routing_Router__initializeLast',
236
-            $this->route_handler,
237
-            $this->route_request_type,
238
-            $this->dependency_map
239
-        );
240
-        switch ($this->route_request_type) {
241
-            case PrimaryRoute::ROUTE_REQUEST_TYPE_ACTIVATION:
242
-                break;
243
-            case PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR:
244
-                $this->route_handler->addRoute(
245
-                    'EventEspresso\core\domain\entities\routing\handlers\admin\PersonalDataRequests'
246
-                );
247
-                break;
248
-        }
249
-    }
18
+	/**
19
+	 * @var EE_Dependency_Map $dependency_map
20
+	 */
21
+	protected $dependency_map;
22
+
23
+	/**
24
+	 * @var LoaderInterface $loader
25
+	 */
26
+	protected $loader;
27
+
28
+	/**
29
+	 * @var RouteHandler $route_handler
30
+	 */
31
+	protected $route_handler;
32
+
33
+	/**
34
+	 * @var string $route_request_type
35
+	 */
36
+	protected $route_request_type;
37
+
38
+
39
+	/**
40
+	 * RoutingSwitch constructor.
41
+	 *
42
+	 * @param EE_Dependency_Map $dependency_map
43
+	 * @param LoaderInterface   $loader
44
+	 * @param RouteHandler      $router
45
+	 */
46
+	public function __construct(EE_Dependency_Map $dependency_map, LoaderInterface $loader, RouteHandler $router)
47
+	{
48
+		$this->dependency_map = $dependency_map;
49
+		$this->loader         = $loader;
50
+		$this->route_handler  = $router;
51
+	}
52
+
53
+
54
+	/**
55
+	 * @throws Exception
56
+	 */
57
+	public function loadPrimaryRoutes()
58
+	{
59
+		do_action(
60
+			'AHEE__EventEspresso_core_services_routing_Router__loadPrimaryRoutes',
61
+			$this->route_handler,
62
+			$this->route_request_type,
63
+			$this->dependency_map
64
+		);
65
+		$this->dependency_map->registerDependencies(
66
+			'EventEspresso\core\domain\entities\routing\handlers\admin\ActivationRequests',
67
+			Route::getFullDependencies()
68
+		);
69
+		$this->dependency_map->registerDependencies(
70
+			'EventEspresso\core\domain\entities\routing\handlers\shared\RegularRequests',
71
+			Route::getFullDependencies()
72
+		);
73
+		// now load and prep all primary Routes
74
+		$this->route_handler->addRoute('EventEspresso\core\domain\entities\routing\handlers\admin\ActivationRequests');
75
+		$this->route_handler->addRoute('EventEspresso\core\domain\entities\routing\handlers\shared\RegularRequests');
76
+		$this->route_request_type = $this->route_handler->getRouteRequestType();
77
+	}
78
+
79
+
80
+	/**
81
+	 *
82
+	 * @throws Exception
83
+	 */
84
+	public function registerShortcodesModulesAndWidgets()
85
+	{
86
+		do_action(
87
+			'AHEE__EventEspresso_core_services_routing_Router__registerShortcodesModulesAndWidgets',
88
+			$this->route_handler,
89
+			$this->route_request_type,
90
+			$this->dependency_map
91
+		);
92
+		switch ($this->route_request_type) {
93
+			case PrimaryRoute::ROUTE_REQUEST_TYPE_ACTIVATION:
94
+				break;
95
+			case PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR:
96
+				$this->route_handler->addRoute(
97
+					'EventEspresso\core\domain\entities\routing\handlers\frontend\ShortcodeRequests'
98
+				);
99
+				break;
100
+		}
101
+	}
102
+
103
+
104
+	/**
105
+	 *
106
+	 * @throws Exception
107
+	 * @throws Exception
108
+	 * @throws Exception
109
+	 * @throws Exception
110
+	 */
111
+	public function brewEspresso()
112
+	{
113
+		do_action(
114
+			'AHEE__EventEspresso_core_services_routing_Router__brewEspresso',
115
+			$this->route_handler,
116
+			$this->route_request_type,
117
+			$this->dependency_map
118
+		);
119
+		switch ($this->route_request_type) {
120
+			case PrimaryRoute::ROUTE_REQUEST_TYPE_ACTIVATION:
121
+				$this->route_handler->addRoute(
122
+					'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests'
123
+				);
124
+				break;
125
+			case PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR:
126
+				$this->route_handler->addRoute(
127
+					'EventEspresso\core\domain\entities\routing\handlers\shared\GQLRequests'
128
+				);
129
+				$this->route_handler->addRoute(
130
+					'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests'
131
+				);
132
+				$this->route_handler->addRoute(
133
+					'EventEspresso\core\domain\entities\routing\handlers\shared\RestApiRequests'
134
+				);
135
+				break;
136
+		}
137
+	}
138
+
139
+
140
+	/**
141
+	 *
142
+	 * @throws Exception
143
+	 * @throws Exception
144
+	 * @throws Exception
145
+	 * @throws Exception
146
+	 * @throws Exception
147
+	 * @throws Exception
148
+	 * @throws Exception
149
+	 * @throws Exception
150
+	 * @throws Exception
151
+	 * @throws Exception
152
+	 */
153
+	public function loadControllers()
154
+	{
155
+		do_action(
156
+			'AHEE__EventEspresso_core_services_routing_Router__loadControllers',
157
+			$this->route_handler,
158
+			$this->route_request_type,
159
+			$this->dependency_map
160
+		);
161
+		switch ($this->route_request_type) {
162
+			case PrimaryRoute::ROUTE_REQUEST_TYPE_ACTIVATION:
163
+				$this->route_handler->addRoute(
164
+					'EventEspresso\core\domain\entities\routing\handlers\admin\AdminRoute'
165
+				);
166
+				$this->route_handler->addRoute(
167
+					'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage'
168
+				);
169
+				break;
170
+			case PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR:
171
+				$this->route_handler->addRoute(
172
+					'EventEspresso\core\domain\entities\routing\handlers\frontend\FrontendRequests'
173
+				);
174
+				$this->route_handler->addRoute(
175
+					'EventEspresso\core\domain\entities\routing\handlers\admin\AdminRoute'
176
+				);
177
+				$this->route_handler->addRoute(
178
+					'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoLegacyAdmin'
179
+				);
180
+				$this->route_handler->addRoute(
181
+					'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventsAdmin'
182
+				);
183
+				$this->route_handler->addRoute(
184
+					'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventEditor'
185
+				);
186
+				$this->route_handler->addRoute(
187
+					'EventEspresso\core\domain\entities\routing\handlers\admin\GutenbergEditor'
188
+				);
189
+				$this->route_handler->addRoute(
190
+					'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage'
191
+				);
192
+				$this->route_handler->addRoute(
193
+					'EventEspresso\core\domain\entities\routing\handlers\shared\WordPressHeartbeat'
194
+				);
195
+				break;
196
+		}
197
+	}
198
+
199
+
200
+	/**
201
+	 *
202
+	 * @throws Exception
203
+	 * @throws Exception
204
+	 */
205
+	public function coreLoadedAndReady()
206
+	{
207
+		do_action(
208
+			'AHEE__EventEspresso_core_services_routing_Router__coreLoadedAndReady',
209
+			$this->route_handler,
210
+			$this->route_request_type,
211
+			$this->dependency_map
212
+		);
213
+		switch ($this->route_request_type) {
214
+			case PrimaryRoute::ROUTE_REQUEST_TYPE_ACTIVATION:
215
+				break;
216
+			case PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR:
217
+				$this->route_handler->addRoute(
218
+					'EventEspresso\core\domain\entities\routing\handlers\shared\AssetRequests'
219
+				);
220
+				$this->route_handler->addRoute(
221
+					'EventEspresso\core\domain\entities\routing\handlers\shared\SessionRequests'
222
+				);
223
+				break;
224
+		}
225
+	}
226
+
227
+
228
+	/**
229
+	 *
230
+	 * @throws Exception
231
+	 */
232
+	public function initializeLast()
233
+	{
234
+		do_action(
235
+			'AHEE__EventEspresso_core_services_routing_Router__initializeLast',
236
+			$this->route_handler,
237
+			$this->route_request_type,
238
+			$this->dependency_map
239
+		);
240
+		switch ($this->route_request_type) {
241
+			case PrimaryRoute::ROUTE_REQUEST_TYPE_ACTIVATION:
242
+				break;
243
+			case PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR:
244
+				$this->route_handler->addRoute(
245
+					'EventEspresso\core\domain\entities\routing\handlers\admin\PersonalDataRequests'
246
+				);
247
+				break;
248
+		}
249
+	}
250 250
 }
Please login to merge, or discard this patch.
core/domain/entities/admin/GraphQLData/GraphQLData.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -15,65 +15,65 @@
 block discarded – undo
15 15
 abstract class GraphQLData implements GraphQLDataInterface
16 16
 {
17 17
 
18
-    /**
19
-     * @var string $namespace The graphql namespace/prefix.
20
-     */
21
-    protected $namespace = 'Espresso';
18
+	/**
19
+	 * @var string $namespace The graphql namespace/prefix.
20
+	 */
21
+	protected $namespace = 'Espresso';
22 22
 
23
-    /**
24
-     * @var array $params
25
-     */
26
-    private $params = [];
23
+	/**
24
+	 * @var array $params
25
+	 */
26
+	private $params = [];
27 27
 
28 28
 
29
-    /**
30
-     * @param array $params
31
-     */
32
-    public function setParams(array $params)
33
-    {
34
-        $this->params = $params;
35
-    }
29
+	/**
30
+	 * @param array $params
31
+	 */
32
+	public function setParams(array $params)
33
+	{
34
+		$this->params = $params;
35
+	}
36 36
 
37 37
 
38 38
 
39
-    /**
40
-     * @param string $field_key
41
-     * @param array  $where_params
42
-     * @return mixed|null
43
-     * @since $VID:$
44
-     */
45
-    protected function getQueryResponse($field_key, array $where_params = [])
46
-    {
47
-        if (! empty($where_params)) {
48
-            if (! array_key_exists('variables', $this->params)) {
49
-                $this->params['variables'] = [];
50
-            }
51
-            $this->params['variables']['where'] = $where_params;
52
-        }
39
+	/**
40
+	 * @param string $field_key
41
+	 * @param array  $where_params
42
+	 * @return mixed|null
43
+	 * @since $VID:$
44
+	 */
45
+	protected function getQueryResponse($field_key, array $where_params = [])
46
+	{
47
+		if (! empty($where_params)) {
48
+			if (! array_key_exists('variables', $this->params)) {
49
+				$this->params['variables'] = [];
50
+			}
51
+			$this->params['variables']['where'] = $where_params;
52
+		}
53 53
 
54
-        $responseData = $this->makeGraphQLRequest($this->params);
55
-        return ! empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null;
56
-    }
54
+		$responseData = $this->makeGraphQLRequest($this->params);
55
+		return ! empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null;
56
+	}
57 57
 
58 58
 
59
-    /**
60
-     * @param array $data
61
-     * @return array
62
-     * @since $VID:$
63
-     */
64
-    protected function makeGraphQLRequest($data)
65
-    {
66
-        try {
67
-            $response = graphql($data);
68
-            if (! empty($response['data'])) {
69
-                return $response['data'];
70
-            }
71
-            return null;
72
-        } catch (Exception $e) {
73
-            if (defined('GRAPHQL_DEBUG') && GRAPHQL_DEBUG) {
74
-                error_log($e->getMessage());
75
-            }
76
-            return null;
77
-        }
78
-    }
59
+	/**
60
+	 * @param array $data
61
+	 * @return array
62
+	 * @since $VID:$
63
+	 */
64
+	protected function makeGraphQLRequest($data)
65
+	{
66
+		try {
67
+			$response = graphql($data);
68
+			if (! empty($response['data'])) {
69
+				return $response['data'];
70
+			}
71
+			return null;
72
+		} catch (Exception $e) {
73
+			if (defined('GRAPHQL_DEBUG') && GRAPHQL_DEBUG) {
74
+				error_log($e->getMessage());
75
+			}
76
+			return null;
77
+		}
78
+	}
79 79
 }
Please login to merge, or discard this patch.
core/domain/DomainBase.php 2 patches
Indentation   +217 added lines, -217 removed lines patch added patch discarded remove patch
@@ -17,221 +17,221 @@
 block discarded – undo
17 17
 abstract class DomainBase implements DomainInterface
18 18
 {
19 19
 
20
-    const ASSETS_FOLDER = 'assets/';
21
-
22
-    /**
23
-     * Equivalent to `__FILE__` for main plugin file.
24
-     *
25
-     * @var FilePath
26
-     */
27
-    private $plugin_file;
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
-     * @var string $asset_namespace
53
-     */
54
-    private $asset_namespace;
55
-
56
-    /**
57
-     * @var string $assets_path
58
-     */
59
-    private $assets_path;
60
-
61
-    /**
62
-     * @var bool
63
-     */
64
-    protected $initialized = false;
65
-
66
-
67
-    /**
68
-     * Initializes internal properties.
69
-     *
70
-     * @param FilePath $plugin_file
71
-     * @param Version  $version
72
-     * @param string $asset_namespace
73
-     */
74
-    public function __construct(FilePath $plugin_file, Version $version, $asset_namespace = Domain::ASSET_NAMESPACE)
75
-    {
76
-        $this->plugin_file = $plugin_file;
77
-        $this->version     = $version;
78
-        $this->initialize($asset_namespace);
79
-    }
80
-
81
-
82
-    /**
83
-     * @param string $asset_namespace
84
-     * @return void
85
-     * @since $VID:$
86
-     */
87
-    public function initialize($asset_namespace = Domain::ASSET_NAMESPACE)
88
-    {
89
-        if (! $this->initialized) {
90
-            $this->plugin_basename = plugin_basename($this->pluginFile());
91
-            $this->plugin_path     = plugin_dir_path($this->pluginFile());
92
-            $this->plugin_url      = plugin_dir_url($this->pluginFile());
93
-            $this->setAssetNamespace($asset_namespace);
94
-            $this->setDistributionAssetsPath();
95
-            $this->initialized = true;
96
-        }
97
-    }
98
-
99
-
100
-    /**
101
-     * @param string $asset_namespace
102
-     * @return void
103
-     */
104
-    public function setAssetNamespace($asset_namespace = Domain::ASSET_NAMESPACE)
105
-    {
106
-        if (! $this->asset_namespace) {
107
-            $this->asset_namespace = sanitize_key(
108
-                // convert directory separators to dashes and remove file extension
109
-                str_replace(['/', '.php'], ['-', ''], $asset_namespace)
110
-            );
111
-        }
112
-    }
113
-
114
-
115
-    /**
116
-     * @throws DomainException
117
-     * @since $VID:$
118
-     */
119
-    private function setDistributionAssetsPath()
120
-    {
121
-        $assets_path = $this->pluginPath() . DomainBase::ASSETS_FOLDER;
122
-        if (! is_readable($assets_path)) {
123
-            throw new DomainException(
124
-                sprintf(
125
-                    esc_html__(
126
-                        'The assets distribution folder was not found or is not readable. Please verify that "%1$s" exists and has valid permissions.',
127
-                        'event_espresso'
128
-                    ),
129
-                    $assets_path
130
-                )
131
-            );
132
-        }
133
-        $this->assets_path = trailingslashit($assets_path);
134
-    }
135
-
136
-
137
-    /**
138
-     * @return string
139
-     */
140
-    public function pluginFile()
141
-    {
142
-        return (string) $this->plugin_file;
143
-    }
144
-
145
-
146
-    /**
147
-     * @return string
148
-     */
149
-    public function pluginBasename()
150
-    {
151
-        return $this->plugin_basename;
152
-    }
153
-
154
-
155
-    /**
156
-     * @param string $additional_path
157
-     * @return string
158
-     */
159
-    public function pluginPath($additional_path = '')
160
-    {
161
-        return is_string($additional_path) && $additional_path !== ''
162
-            ? $this->plugin_path . $additional_path
163
-            : $this->plugin_path;
164
-    }
165
-
166
-
167
-    /**
168
-     * @param string $additional_path
169
-     * @return string
170
-     */
171
-    public function pluginUrl($additional_path = '')
172
-    {
173
-        return is_string($additional_path) && $additional_path !== ''
174
-            ? $this->plugin_url . $additional_path
175
-            : $this->plugin_url;
176
-    }
177
-
178
-
179
-    /**
180
-     * @return string
181
-     */
182
-    public function version()
183
-    {
184
-        return (string) $this->version;
185
-    }
186
-
187
-
188
-    /**
189
-     * @return Version
190
-     */
191
-    public function versionValueObject()
192
-    {
193
-        return $this->version;
194
-    }
195
-
196
-
197
-    /**
198
-     * @return string
199
-     */
200
-    public function distributionAssetsFolder()
201
-    {
202
-        return DomainBase::ASSETS_FOLDER;
203
-    }
204
-
205
-
206
-    /**
207
-     * @param string $additional_path
208
-     * @return string
209
-     */
210
-    public function distributionAssetsPath($additional_path = '')
211
-    {
212
-        return is_string($additional_path) && $additional_path !== ''
213
-            ? $this->assets_path . $additional_path
214
-            : $this->assets_path;
215
-    }
216
-
217
-
218
-    /**
219
-     * @param string $additional_path
220
-     * @return string
221
-     */
222
-    public function distributionAssetsUrl($additional_path = '')
223
-    {
224
-        return is_string($additional_path) && $additional_path !== ''
225
-            ? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path
226
-            : $this->plugin_url . DomainBase::ASSETS_FOLDER;
227
-    }
228
-
229
-
230
-    /**
231
-     * @return string
232
-     */
233
-    public function assetNamespace()
234
-    {
235
-        return $this->asset_namespace;
236
-    }
20
+	const ASSETS_FOLDER = 'assets/';
21
+
22
+	/**
23
+	 * Equivalent to `__FILE__` for main plugin file.
24
+	 *
25
+	 * @var FilePath
26
+	 */
27
+	private $plugin_file;
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
+	 * @var string $asset_namespace
53
+	 */
54
+	private $asset_namespace;
55
+
56
+	/**
57
+	 * @var string $assets_path
58
+	 */
59
+	private $assets_path;
60
+
61
+	/**
62
+	 * @var bool
63
+	 */
64
+	protected $initialized = false;
65
+
66
+
67
+	/**
68
+	 * Initializes internal properties.
69
+	 *
70
+	 * @param FilePath $plugin_file
71
+	 * @param Version  $version
72
+	 * @param string $asset_namespace
73
+	 */
74
+	public function __construct(FilePath $plugin_file, Version $version, $asset_namespace = Domain::ASSET_NAMESPACE)
75
+	{
76
+		$this->plugin_file = $plugin_file;
77
+		$this->version     = $version;
78
+		$this->initialize($asset_namespace);
79
+	}
80
+
81
+
82
+	/**
83
+	 * @param string $asset_namespace
84
+	 * @return void
85
+	 * @since $VID:$
86
+	 */
87
+	public function initialize($asset_namespace = Domain::ASSET_NAMESPACE)
88
+	{
89
+		if (! $this->initialized) {
90
+			$this->plugin_basename = plugin_basename($this->pluginFile());
91
+			$this->plugin_path     = plugin_dir_path($this->pluginFile());
92
+			$this->plugin_url      = plugin_dir_url($this->pluginFile());
93
+			$this->setAssetNamespace($asset_namespace);
94
+			$this->setDistributionAssetsPath();
95
+			$this->initialized = true;
96
+		}
97
+	}
98
+
99
+
100
+	/**
101
+	 * @param string $asset_namespace
102
+	 * @return void
103
+	 */
104
+	public function setAssetNamespace($asset_namespace = Domain::ASSET_NAMESPACE)
105
+	{
106
+		if (! $this->asset_namespace) {
107
+			$this->asset_namespace = sanitize_key(
108
+				// convert directory separators to dashes and remove file extension
109
+				str_replace(['/', '.php'], ['-', ''], $asset_namespace)
110
+			);
111
+		}
112
+	}
113
+
114
+
115
+	/**
116
+	 * @throws DomainException
117
+	 * @since $VID:$
118
+	 */
119
+	private function setDistributionAssetsPath()
120
+	{
121
+		$assets_path = $this->pluginPath() . DomainBase::ASSETS_FOLDER;
122
+		if (! is_readable($assets_path)) {
123
+			throw new DomainException(
124
+				sprintf(
125
+					esc_html__(
126
+						'The assets distribution folder was not found or is not readable. Please verify that "%1$s" exists and has valid permissions.',
127
+						'event_espresso'
128
+					),
129
+					$assets_path
130
+				)
131
+			);
132
+		}
133
+		$this->assets_path = trailingslashit($assets_path);
134
+	}
135
+
136
+
137
+	/**
138
+	 * @return string
139
+	 */
140
+	public function pluginFile()
141
+	{
142
+		return (string) $this->plugin_file;
143
+	}
144
+
145
+
146
+	/**
147
+	 * @return string
148
+	 */
149
+	public function pluginBasename()
150
+	{
151
+		return $this->plugin_basename;
152
+	}
153
+
154
+
155
+	/**
156
+	 * @param string $additional_path
157
+	 * @return string
158
+	 */
159
+	public function pluginPath($additional_path = '')
160
+	{
161
+		return is_string($additional_path) && $additional_path !== ''
162
+			? $this->plugin_path . $additional_path
163
+			: $this->plugin_path;
164
+	}
165
+
166
+
167
+	/**
168
+	 * @param string $additional_path
169
+	 * @return string
170
+	 */
171
+	public function pluginUrl($additional_path = '')
172
+	{
173
+		return is_string($additional_path) && $additional_path !== ''
174
+			? $this->plugin_url . $additional_path
175
+			: $this->plugin_url;
176
+	}
177
+
178
+
179
+	/**
180
+	 * @return string
181
+	 */
182
+	public function version()
183
+	{
184
+		return (string) $this->version;
185
+	}
186
+
187
+
188
+	/**
189
+	 * @return Version
190
+	 */
191
+	public function versionValueObject()
192
+	{
193
+		return $this->version;
194
+	}
195
+
196
+
197
+	/**
198
+	 * @return string
199
+	 */
200
+	public function distributionAssetsFolder()
201
+	{
202
+		return DomainBase::ASSETS_FOLDER;
203
+	}
204
+
205
+
206
+	/**
207
+	 * @param string $additional_path
208
+	 * @return string
209
+	 */
210
+	public function distributionAssetsPath($additional_path = '')
211
+	{
212
+		return is_string($additional_path) && $additional_path !== ''
213
+			? $this->assets_path . $additional_path
214
+			: $this->assets_path;
215
+	}
216
+
217
+
218
+	/**
219
+	 * @param string $additional_path
220
+	 * @return string
221
+	 */
222
+	public function distributionAssetsUrl($additional_path = '')
223
+	{
224
+		return is_string($additional_path) && $additional_path !== ''
225
+			? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path
226
+			: $this->plugin_url . DomainBase::ASSETS_FOLDER;
227
+	}
228
+
229
+
230
+	/**
231
+	 * @return string
232
+	 */
233
+	public function assetNamespace()
234
+	{
235
+		return $this->asset_namespace;
236
+	}
237 237
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function initialize($asset_namespace = Domain::ASSET_NAMESPACE)
88 88
     {
89
-        if (! $this->initialized) {
89
+        if ( ! $this->initialized) {
90 90
             $this->plugin_basename = plugin_basename($this->pluginFile());
91 91
             $this->plugin_path     = plugin_dir_path($this->pluginFile());
92 92
             $this->plugin_url      = plugin_dir_url($this->pluginFile());
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function setAssetNamespace($asset_namespace = Domain::ASSET_NAMESPACE)
105 105
     {
106
-        if (! $this->asset_namespace) {
106
+        if ( ! $this->asset_namespace) {
107 107
             $this->asset_namespace = sanitize_key(
108 108
                 // convert directory separators to dashes and remove file extension
109 109
                 str_replace(['/', '.php'], ['-', ''], $asset_namespace)
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
      */
119 119
     private function setDistributionAssetsPath()
120 120
     {
121
-        $assets_path = $this->pluginPath() . DomainBase::ASSETS_FOLDER;
122
-        if (! is_readable($assets_path)) {
121
+        $assets_path = $this->pluginPath().DomainBase::ASSETS_FOLDER;
122
+        if ( ! is_readable($assets_path)) {
123 123
             throw new DomainException(
124 124
                 sprintf(
125 125
                     esc_html__(
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     public function pluginPath($additional_path = '')
160 160
     {
161 161
         return is_string($additional_path) && $additional_path !== ''
162
-            ? $this->plugin_path . $additional_path
162
+            ? $this->plugin_path.$additional_path
163 163
             : $this->plugin_path;
164 164
     }
165 165
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     public function pluginUrl($additional_path = '')
172 172
     {
173 173
         return is_string($additional_path) && $additional_path !== ''
174
-            ? $this->plugin_url . $additional_path
174
+            ? $this->plugin_url.$additional_path
175 175
             : $this->plugin_url;
176 176
     }
177 177
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     public function distributionAssetsPath($additional_path = '')
211 211
     {
212 212
         return is_string($additional_path) && $additional_path !== ''
213
-            ? $this->assets_path . $additional_path
213
+            ? $this->assets_path.$additional_path
214 214
             : $this->assets_path;
215 215
     }
216 216
 
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
     public function distributionAssetsUrl($additional_path = '')
223 223
     {
224 224
         return is_string($additional_path) && $additional_path !== ''
225
-            ? $this->plugin_url . DomainBase::ASSETS_FOLDER . $additional_path
226
-            : $this->plugin_url . DomainBase::ASSETS_FOLDER;
225
+            ? $this->plugin_url.DomainBase::ASSETS_FOLDER.$additional_path
226
+            : $this->plugin_url.DomainBase::ASSETS_FOLDER;
227 227
     }
228 228
 
229 229
 
Please login to merge, or discard this patch.