PluginProbe
User Access Manager / 2.2.16
User Access Manager v2.2.16
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.16, at src/Controller/ControllerFactory.php

529 lines 14.7 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->fileHandler,
252 $this->setupHandler
253 );
254 }
255
256 /**
257 * Creates and returns a new backend about controller.
258 * @return AboutController
259 */
260 public function createBackendAboutController(): AboutController
261 {
262 return new AboutController(
263 $this->php,
264 $this->wordpress,
265 $this->wordpressConfig
266 );
267 }
268
269 /**
270 * Creates and returns a new backend object controller.
271 * @return ObjectController
272 */
273 public function createBackendObjectController(): ObjectController
274 {
275 return new ObjectController(
276 $this->php,
277 $this->wordpress,
278 $this->wordpressConfig,
279 $this->mainConfig,
280 $this->database,
281 $this->dateUtil,
282 $this->objectHandler,
283 $this->userHandler,
284 $this->userGroupHandler,
285 $this->userGroupAssignmentHandler,
286 $this->accessHandler,
287 $this->objectInformationFactory
288 );
289 }
290
291 /**
292 * Creates and returns a new backend cache controller.
293 * @return CacheController
294 */
295 public function createBackendCacheController(): CacheController
296 {
297 return new CacheController(
298 $this->cache
299 );
300 }
301
302 /**
303 * Creates and returns a new backend post object controller.
304 * @return PostObjectController
305 */
306 public function createBackendPostObjectController(): PostObjectController
307 {
308 return new PostObjectController(
309 $this->php,
310 $this->wordpress,
311 $this->wordpressConfig,
312 $this->mainConfig,
313 $this->database,
314 $this->dateUtil,
315 $this->objectHandler,
316 $this->userHandler,
317 $this->userGroupHandler,
318 $this->userGroupAssignmentHandler,
319 $this->accessHandler,
320 $this->objectInformationFactory
321 );
322 }
323
324 /**
325 * Creates and returns a new backend term object controller.
326 * @return TermObjectController
327 */
328 public function createBackendTermObjectController(): TermObjectController
329 {
330 return new TermObjectController(
331 $this->php,
332 $this->wordpress,
333 $this->wordpressConfig,
334 $this->mainConfig,
335 $this->database,
336 $this->dateUtil,
337 $this->objectHandler,
338 $this->userHandler,
339 $this->userGroupHandler,
340 $this->userGroupAssignmentHandler,
341 $this->accessHandler,
342 $this->objectInformationFactory
343 );
344 }
345
346 /**
347 * Creates and returns a new backend user object controller.
348 * @return UserObjectController
349 */
350 public function createBackendUserObjectController(): UserObjectController
351 {
352 return new UserObjectController(
353 $this->php,
354 $this->wordpress,
355 $this->wordpressConfig,
356 $this->mainConfig,
357 $this->database,
358 $this->dateUtil,
359 $this->objectHandler,
360 $this->userHandler,
361 $this->userGroupHandler,
362 $this->userGroupAssignmentHandler,
363 $this->accessHandler,
364 $this->objectInformationFactory
365 );
366 }
367
368 /**
369 * Creates and returns a new backend dynamic group controller.
370 * @return DynamicGroupsController
371 */
372 public function createBackendDynamicGroupsController(): DynamicGroupsController
373 {
374 return new DynamicGroupsController(
375 $this->php,
376 $this->wordpress,
377 $this->wordpressConfig,
378 $this->mainConfig,
379 $this->database,
380 $this->dateUtil,
381 $this->objectHandler,
382 $this->userHandler,
383 $this->userGroupHandler,
384 $this->userGroupAssignmentHandler,
385 $this->accessHandler,
386 $this->objectInformationFactory
387 );
388 }
389
390 /**
391 * Creates and returns a new backend setup controller.
392 * @return SettingsController
393 */
394 public function createBackendSettingsController(): SettingsController
395 {
396 return new SettingsController(
397 $this->php,
398 $this->wordpress,
399 $this->wordpressConfig,
400 $this->mainConfig,
401 $this->cache,
402 $this->fileHandler,
403 $this->formFactory,
404 $this->formHelper
405 );
406 }
407
408 /**
409 * Creates and returns a new backend setup controller.
410 * @return SetupController
411 */
412 public function createBackendSetupController(): SetupController
413 {
414 return new SetupController(
415 $this->php,
416 $this->wordpress,
417 $this->wordpressConfig,
418 $this->database,
419 $this->setupHandler
420 );
421 }
422
423 /**
424 * Creates and returns a new backend user group controller.
425 * @return UserGroupController
426 */
427 public function createBackendUserGroupController(): UserGroupController
428 {
429 return new UserGroupController(
430 $this->php,
431 $this->wordpress,
432 $this->wordpressConfig,
433 $this->userGroupHandler,
434 $this->userGroupFactory,
435 $this->formHelper
436 );
437 }
438
439 /**
440 * Creates and returns a new frontend controller.
441 * @return FrontendController
442 */
443 public function createFrontendController(): FrontendController
444 {
445 return new FrontendController(
446 $this->php,
447 $this->wordpress,
448 $this->wordpressConfig,
449 $this->mainConfig,
450 $this->accessHandler
451 );
452 }
453
454 /**
455 * Creates and returns a new frontend post controller.
456 * @return PostController
457 */
458 public function createFrontendPostController(): PostController
459 {
460 return new PostController(
461 $this->php,
462 $this->wordpress,
463 $this->wordpressConfig,
464 $this->mainConfig,
465 $this->database,
466 $this->util,
467 $this->objectHandler,
468 $this->userHandler,
469 $this->userGroupHandler,
470 $this->accessHandler
471 );
472 }
473
474 /**
475 * Creates and returns a new frontend redirect controller.
476 * @return RedirectController
477 */
478 public function createFrontendRedirectController(): RedirectController
479 {
480 return new RedirectController(
481 $this->php,
482 $this->wordpress,
483 $this->wordpressConfig,
484 $this->mainConfig,
485 $this->database,
486 $this->util,
487 $this->cache,
488 $this->objectHandler,
489 $this->accessHandler,
490 $this->fileHandler,
491 $this->fileObjectFactory
492 );
493 }
494
495 /**
496 * Creates and returns a new frontend short code controller.
497 * @return ShortCodeController
498 */
499 public function createFrontendShortCodeController(): ShortCodeController
500 {
501 return new ShortCodeController(
502 $this->php,
503 $this->wordpress,
504 $this->wordpressConfig,
505 $this->userGroupHandler
506 );
507 }
508
509 /**
510 * Creates and returns a new frontend term controller.
511 * @return TermController
512 */
513 public function createFrontendTermController(): TermController
514 {
515 return new TermController(
516 $this->php,
517 $this->wordpress,
518 $this->wordpressConfig,
519 $this->mainConfig,
520 $this->util,
521 $this->objectHandler,
522 $this->objectMapHandler,
523 $this->userHandler,
524 $this->userGroupHandler,
525 $this->accessHandler
526 );
527 }
528 }
529