PluginProbe
User Access Manager / 2.2.25
User Access Manager v2.2.25
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
user-access-manager / src / Controller / ControllerFactory.php

ControllerFactory.php in User Access Manager 2.2.25, at src/Controller/ControllerFactory.php

528 lines 14.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * ControllerFactory.php
4 *
5 * The ControllerFactory class file.
6 *
7 * PHP versions 5
8 *
9 * @author Alexander Schneider <alexanderschneider85@gmail.com>
10 * @copyright 2008-2017 Alexander Schneider
11 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2
12 * @version SVN: $id$
13 * @link http://wordpress.org/extend/plugins/user-access-manager/
14 */
15
16 declare(strict_types=1);
17
18 namespace UserAccessManager\Controller;
19
20 use UserAccessManager\Access\AccessHandler;
21 use UserAccessManager\Cache\Cache;
22 use UserAccessManager\Config\MainConfig;
23 use UserAccessManager\Config\WordpressConfig;
24 use UserAccessManager\Controller\Backend\AboutController;
25 use UserAccessManager\Controller\Backend\BackendController;
26 use UserAccessManager\Controller\Backend\CacheController;
27 use UserAccessManager\Controller\Backend\DynamicGroupsController;
28 use UserAccessManager\Controller\Backend\ObjectController;
29 use UserAccessManager\Controller\Backend\ObjectInformationFactory;
30 use UserAccessManager\Controller\Backend\PostObjectController;
31 use UserAccessManager\Controller\Backend\SettingsController;
32 use UserAccessManager\Controller\Backend\SetupController;
33 use UserAccessManager\Controller\Backend\TermObjectController;
34 use UserAccessManager\Controller\Backend\UserGroupController;
35 use UserAccessManager\Controller\Backend\UserObjectController;
36 use UserAccessManager\Controller\Frontend\FrontendController;
37 use UserAccessManager\Controller\Frontend\PostController;
38 use UserAccessManager\Controller\Frontend\RedirectController;
39 use UserAccessManager\Controller\Frontend\ShortCodeController;
40 use UserAccessManager\Controller\Frontend\TermController;
41 use UserAccessManager\Database\Database;
42 use UserAccessManager\File\FileHandler;
43 use UserAccessManager\File\FileObjectFactory;
44 use UserAccessManager\Form\FormFactory;
45 use UserAccessManager\Form\FormHelper;
46 use UserAccessManager\Object\ObjectHandler;
47 use UserAccessManager\Object\ObjectMapHandler;
48 use UserAccessManager\Setup\SetupHandler;
49 use UserAccessManager\UserGroup\UserGroupAssignmentHandler;
50 use UserAccessManager\UserGroup\UserGroupFactory;
51 use UserAccessManager\User\UserHandler;
52 use UserAccessManager\UserGroup\UserGroupHandler;
53 use UserAccessManager\Util\DateUtil;
54 use UserAccessManager\Util\Util;
55 use UserAccessManager\Wrapper\Php;
56 use UserAccessManager\Wrapper\Wordpress;
57
58 /**
59 * Class ControllerFactory
60 *
61 * @package UserAccessManager\Controller
62 */
63 class ControllerFactory
64 {
65 /**
66 * @var Php
67 */
68 private $php;
69
70 /**
71 * @var Wordpress
72 */
73 private $wordpress;
74
75 /**
76 * @var Database
77 */
78 private $database;
79
80 /**
81 * @var WordpressConfig
82 */
83 private $wordpressConfig;
84
85 /**
86 * @var MainConfig
87 */
88 private $mainConfig;
89
90 /**
91 * @var Util
92 */
93 private $util;
94
95 /**
96 * @var DateUtil
97 */
98 private $dateUtil;
99
100 /**
101 * @var Cache
102 */
103 private $cache;
104
105 /**
106 * @var ObjectHandler
107 */
108 private $objectHandler;
109
110 /**
111 * @var ObjectMapHandler
112 */
113 private $objectMapHandler;
114
115 /**
116 * @var UserHandler
117 */
118 private $userHandler;
119
120 /**
121 * @var UserGroupHandler
122 */
123 private $userGroupHandler;
124
125 /**
126 * @var UserGroupFactory
127 */
128 private $userGroupFactory;
129
130 /**
131 * @var UserGroupAssignmentHandler
132 */
133 private $userGroupAssignmentHandler;
134
135 /**
136 * @var AccessHandler
137 */
138 private $accessHandler;
139
140 /**
141 * @var FileHandler
142 */
143 private $fileHandler;
144
145 /**
146 * @var FileObjectFactory
147 */
148 private $fileObjectFactory;
149
150 /**
151 * @var SetupHandler
152 */
153 private $setupHandler;
154
155 /**
156 * @var FormFactory
157 */
158 private $formFactory;
159
160 /**
161 * @var FormHelper
162 */
163 private $formHelper;
164
165 /**
166 * @var ObjectInformationFactory
167 */
168 private $objectInformationFactory;
169
170 /**
171 * ControllerFactory constructor.
172 * @param Php $php
173 * @param Wordpress $wordpress
174 * @param Database $database
175 * @param WordpressConfig $wordpressConfig
176 * @param MainConfig $mainConfig
177 * @param Util $util
178 * @param DateUtil $dateUtil
179 * @param Cache $cache
180 * @param ObjectHandler $objectHandler
181 * @param ObjectMapHandler $objectMapHandler
182 * @param UserHandler $userHandler
183 * @param UserGroupHandler $userGroupHandler
184 * @param UserGroupFactory $userGroupFactory
185 * @param UserGroupAssignmentHandler $userGroupAssignmentHandler
186 * @param AccessHandler $accessHandler
187 * @param FileHandler $fileHandler
188 * @param FileObjectFactory $fileObjectFactory
189 * @param SetupHandler $setupHandler
190 * @param FormFactory $formFactory
191 * @param FormHelper $formHelper
192 * @param ObjectInformationFactory $objectInformationFactory
193 */
194 public function __construct(
195 Php $php,
196 Wordpress $wordpress,
197 Database $database,
198 WordpressConfig $wordpressConfig,
199 MainConfig $mainConfig,
200 Util $util,
201 DateUtil $dateUtil,
202 Cache $cache,
203 ObjectHandler $objectHandler,
204 ObjectMapHandler $objectMapHandler,
205 UserHandler $userHandler,
206 UserGroupHandler $userGroupHandler,
207 UserGroupFactory $userGroupFactory,
208 UserGroupAssignmentHandler $userGroupAssignmentHandler,
209 AccessHandler $accessHandler,
210 FileHandler $fileHandler,
211 FileObjectFactory $fileObjectFactory,
212 SetupHandler $setupHandler,
213 FormFactory $formFactory,
214 FormHelper $formHelper,
215 ObjectInformationFactory $objectInformationFactory
216 ) {
217 $this->php = $php;
218 $this->wordpress = $wordpress;
219 $this->database = $database;
220 $this->wordpressConfig = $wordpressConfig;
221 $this->mainConfig = $mainConfig;
222 $this->util = $util;
223 $this->dateUtil = $dateUtil;
224 $this->cache = $cache;
225 $this->objectHandler = $objectHandler;
226 $this->objectMapHandler = $objectMapHandler;
227 $this->userHandler = $userHandler;
228 $this->userGroupHandler = $userGroupHandler;
229 $this->userGroupFactory = $userGroupFactory;
230 $this->userGroupAssignmentHandler = $userGroupAssignmentHandler;
231 $this->accessHandler = $accessHandler;
232 $this->fileHandler = $fileHandler;
233 $this->fileObjectFactory = $fileObjectFactory;
234 $this->setupHandler = $setupHandler;
235 $this->formFactory = $formFactory;
236 $this->formHelper = $formHelper;
237 $this->objectInformationFactory = $objectInformationFactory;
238 }
239
240 /**
241 * Creates and returns a new backend controller.
242 * @return BackendController
243 */
244 public function createBackendController(): BackendController
245 {
246 return new BackendController(
247 $this->php,
248 $this->wordpress,
249 $this->wordpressConfig,
250 $this->userHandler,
251 $this->setupHandler
252 );
253 }
254
255 /**
256 * Creates and returns a new backend about controller.
257 * @return AboutController
258 */
259 public function createBackendAboutController(): AboutController
260 {
261 return new AboutController(
262 $this->php,
263 $this->wordpress,
264 $this->wordpressConfig
265 );
266 }
267
268 /**
269 * Creates and returns a new backend object controller.
270 * @return ObjectController
271 */
272 public function createBackendObjectController(): ObjectController
273 {
274 return new ObjectController(
275 $this->php,
276 $this->wordpress,
277 $this->wordpressConfig,
278 $this->mainConfig,
279 $this->database,
280 $this->dateUtil,
281 $this->objectHandler,
282 $this->userHandler,
283 $this->userGroupHandler,
284 $this->userGroupAssignmentHandler,
285 $this->accessHandler,
286 $this->objectInformationFactory
287 );
288 }
289
290 /**
291 * Creates and returns a new backend cache controller.
292 * @return CacheController
293 */
294 public function createBackendCacheController(): CacheController
295 {
296 return new CacheController(
297 $this->cache
298 );
299 }
300
301 /**
302 * Creates and returns a new backend post object controller.
303 * @return PostObjectController
304 */
305 public function createBackendPostObjectController(): PostObjectController
306 {
307 return new PostObjectController(
308 $this->php,
309 $this->wordpress,
310 $this->wordpressConfig,
311 $this->mainConfig,
312 $this->database,
313 $this->dateUtil,
314 $this->objectHandler,
315 $this->userHandler,
316 $this->userGroupHandler,
317 $this->userGroupAssignmentHandler,
318 $this->accessHandler,
319 $this->objectInformationFactory
320 );
321 }
322
323 /**
324 * Creates and returns a new backend term object controller.
325 * @return TermObjectController
326 */
327 public function createBackendTermObjectController(): TermObjectController
328 {
329 return new TermObjectController(
330 $this->php,
331 $this->wordpress,
332 $this->wordpressConfig,
333 $this->mainConfig,
334 $this->database,
335 $this->dateUtil,
336 $this->objectHandler,
337 $this->userHandler,
338 $this->userGroupHandler,
339 $this->userGroupAssignmentHandler,
340 $this->accessHandler,
341 $this->objectInformationFactory
342 );
343 }
344
345 /**
346 * Creates and returns a new backend user object controller.
347 * @return UserObjectController
348 */
349 public function createBackendUserObjectController(): UserObjectController
350 {
351 return new UserObjectController(
352 $this->php,
353 $this->wordpress,
354 $this->wordpressConfig,
355 $this->mainConfig,
356 $this->database,
357 $this->dateUtil,
358 $this->objectHandler,
359 $this->userHandler,
360 $this->userGroupHandler,
361 $this->userGroupAssignmentHandler,
362 $this->accessHandler,
363 $this->objectInformationFactory
364 );
365 }
366
367 /**
368 * Creates and returns a new backend dynamic group controller.
369 * @return DynamicGroupsController
370 */
371 public function createBackendDynamicGroupsController(): DynamicGroupsController
372 {
373 return new DynamicGroupsController(
374 $this->php,
375 $this->wordpress,
376 $this->wordpressConfig,
377 $this->mainConfig,
378 $this->database,
379 $this->dateUtil,
380 $this->objectHandler,
381 $this->userHandler,
382 $this->userGroupHandler,
383 $this->userGroupAssignmentHandler,
384 $this->accessHandler,
385 $this->objectInformationFactory
386 );
387 }
388
389 /**
390 * Creates and returns a new backend setup controller.
391 * @return SettingsController
392 */
393 public function createBackendSettingsController(): SettingsController
394 {
395 return new SettingsController(
396 $this->php,
397 $this->wordpress,
398 $this->wordpressConfig,
399 $this->mainConfig,
400 $this->cache,
401 $this->fileHandler,
402 $this->formFactory,
403 $this->formHelper
404 );
405 }
406
407 /**
408 * Creates and returns a new backend setup controller.
409 * @return SetupController
410 */
411 public function createBackendSetupController(): SetupController
412 {
413 return new SetupController(
414 $this->php,
415 $this->wordpress,
416 $this->wordpressConfig,
417 $this->database,
418 $this->setupHandler
419 );
420 }
421
422 /**
423 * Creates and returns a new backend user group controller.
424 * @return UserGroupController
425 */
426 public function createBackendUserGroupController(): UserGroupController
427 {
428 return new UserGroupController(
429 $this->php,
430 $this->wordpress,
431 $this->wordpressConfig,
432 $this->userGroupHandler,
433 $this->userGroupFactory,
434 $this->formHelper
435 );
436 }
437
438 /**
439 * Creates and returns a new frontend controller.
440 * @return FrontendController
441 */
442 public function createFrontendController(): FrontendController
443 {
444 return new FrontendController(
445 $this->php,
446 $this->wordpress,
447 $this->wordpressConfig,
448 $this->mainConfig,
449 $this->accessHandler
450 );
451 }
452
453 /**
454 * Creates and returns a new frontend post controller.
455 * @return PostController
456 */
457 public function createFrontendPostController(): PostController
458 {
459 return new PostController(
460 $this->php,
461 $this->wordpress,
462 $this->wordpressConfig,
463 $this->mainConfig,
464 $this->database,
465 $this->util,
466 $this->objectHandler,
467 $this->userHandler,
468 $this->userGroupHandler,
469 $this->accessHandler
470 );
471 }
472
473 /**
474 * Creates and returns a new frontend redirect controller.
475 * @return RedirectController
476 */
477 public function createFrontendRedirectController(): RedirectController
478 {
479 return new RedirectController(
480 $this->php,
481 $this->wordpress,
482 $this->wordpressConfig,
483 $this->mainConfig,
484 $this->database,
485 $this->util,
486 $this->cache,
487 $this->objectHandler,
488 $this->accessHandler,
489 $this->fileHandler,
490 $this->fileObjectFactory
491 );
492 }
493
494 /**
495 * Creates and returns a new frontend short code controller.
496 * @return ShortCodeController
497 */
498 public function createFrontendShortCodeController(): ShortCodeController
499 {
500 return new ShortCodeController(
501 $this->php,
502 $this->wordpress,
503 $this->wordpressConfig,
504 $this->userGroupHandler
505 );
506 }
507
508 /**
509 * Creates and returns a new frontend term controller.
510 * @return TermController
511 */
512 public function createFrontendTermController(): TermController
513 {
514 return new TermController(
515 $this->php,
516 $this->wordpress,
517 $this->wordpressConfig,
518 $this->mainConfig,
519 $this->util,
520 $this->objectHandler,
521 $this->objectMapHandler,
522 $this->userHandler,
523 $this->userGroupHandler,
524 $this->accessHandler
525 );
526 }
527 }
528