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