| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace UserAccessManager\Controller; |
| 6 |
|
| 7 |
use UserAccessManager\Access\AccessHandler; |
| 8 |
use UserAccessManager\Cache\Cache; |
| 9 |
use UserAccessManager\Config\MainConfig; |
| 10 |
use UserAccessManager\Config\WordpressConfig; |
| 11 |
use UserAccessManager\Controller\Backend\AboutController; |
| 12 |
use UserAccessManager\Controller\Backend\BackendController; |
| 13 |
use UserAccessManager\Controller\Backend\CacheController; |
| 14 |
use UserAccessManager\Controller\Backend\DynamicGroupsController; |
| 15 |
use UserAccessManager\Controller\Backend\ObjectController; |
| 16 |
use UserAccessManager\Controller\Backend\ObjectInformationFactory; |
| 17 |
use UserAccessManager\Controller\Backend\PostObjectController; |
| 18 |
use UserAccessManager\Controller\Backend\SettingsController; |
| 19 |
use UserAccessManager\Controller\Backend\SetupController; |
| 20 |
use UserAccessManager\Controller\Backend\TermObjectController; |
| 21 |
use UserAccessManager\Controller\Backend\UserGroupController; |
| 22 |
use UserAccessManager\Controller\Backend\UserObjectController; |
| 23 |
use UserAccessManager\Controller\Frontend\FrontendController; |
| 24 |
use UserAccessManager\Controller\Frontend\PostController; |
| 25 |
use UserAccessManager\Controller\Frontend\RedirectController; |
| 26 |
use UserAccessManager\Controller\Frontend\ShortCodeController; |
| 27 |
use UserAccessManager\Controller\Frontend\TermController; |
| 28 |
use UserAccessManager\Database\Database; |
| 29 |
use UserAccessManager\File\FileHandler; |
| 30 |
use UserAccessManager\File\FileObjectFactory; |
| 31 |
use UserAccessManager\Form\FormFactory; |
| 32 |
use UserAccessManager\Form\FormHelper; |
| 33 |
use UserAccessManager\Object\ObjectHandler; |
| 34 |
use UserAccessManager\Object\ObjectMapHandler; |
| 35 |
use UserAccessManager\Setup\SetupHandler; |
| 36 |
use UserAccessManager\User\UserHandler; |
| 37 |
use UserAccessManager\UserGroup\UserGroupAssignmentHandler; |
| 38 |
use UserAccessManager\UserGroup\UserGroupFactory; |
| 39 |
use UserAccessManager\UserGroup\UserGroupHandler; |
| 40 |
use UserAccessManager\Util\DateUtil; |
| 41 |
use UserAccessManager\Util\Util; |
| 42 |
use UserAccessManager\Wrapper\Php; |
| 43 |
use UserAccessManager\Wrapper\Wordpress; |
| 44 |
|
| 45 |
class ControllerFactory |
| 46 |
{ |
| 47 |
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 |
| 69 |
) { |
| 70 |
} |
| 71 |
|
| 72 |
public function createBackendController(): BackendController |
| 73 |
{ |
| 74 |
return new BackendController( |
| 75 |
$this->php, |
| 76 |
$this->wordpress, |
| 77 |
$this->wordpressConfig, |
| 78 |
$this->userHandler, |
| 79 |
$this->setupHandler |
| 80 |
); |
| 81 |
} |
| 82 |
|
| 83 |
public function createBackendAboutController(): AboutController |
| 84 |
{ |
| 85 |
return new AboutController( |
| 86 |
$this->php, |
| 87 |
$this->wordpress, |
| 88 |
$this->wordpressConfig |
| 89 |
); |
| 90 |
} |
| 91 |
|
| 92 |
public function createBackendObjectController(): ObjectController |
| 93 |
{ |
| 94 |
return new ObjectController( |
| 95 |
$this->php, |
| 96 |
$this->wordpress, |
| 97 |
$this->wordpressConfig, |
| 98 |
$this->mainConfig, |
| 99 |
$this->database, |
| 100 |
$this->dateUtil, |
| 101 |
$this->objectHandler, |
| 102 |
$this->userHandler, |
| 103 |
$this->userGroupHandler, |
| 104 |
$this->userGroupAssignmentHandler, |
| 105 |
$this->accessHandler, |
| 106 |
$this->objectInformationFactory |
| 107 |
); |
| 108 |
} |
| 109 |
|
| 110 |
public function createBackendCacheController(): CacheController |
| 111 |
{ |
| 112 |
return new CacheController( |
| 113 |
$this->cache |
| 114 |
); |
| 115 |
} |
| 116 |
|
| 117 |
public function createBackendPostObjectController(): PostObjectController |
| 118 |
{ |
| 119 |
return new PostObjectController( |
| 120 |
$this->php, |
| 121 |
$this->wordpress, |
| 122 |
$this->wordpressConfig, |
| 123 |
$this->mainConfig, |
| 124 |
$this->database, |
| 125 |
$this->dateUtil, |
| 126 |
$this->objectHandler, |
| 127 |
$this->userHandler, |
| 128 |
$this->userGroupHandler, |
| 129 |
$this->userGroupAssignmentHandler, |
| 130 |
$this->accessHandler, |
| 131 |
$this->objectInformationFactory |
| 132 |
); |
| 133 |
} |
| 134 |
|
| 135 |
public function createBackendTermObjectController(): TermObjectController |
| 136 |
{ |
| 137 |
return new TermObjectController( |
| 138 |
$this->php, |
| 139 |
$this->wordpress, |
| 140 |
$this->wordpressConfig, |
| 141 |
$this->mainConfig, |
| 142 |
$this->database, |
| 143 |
$this->dateUtil, |
| 144 |
$this->objectHandler, |
| 145 |
$this->userHandler, |
| 146 |
$this->userGroupHandler, |
| 147 |
$this->userGroupAssignmentHandler, |
| 148 |
$this->accessHandler, |
| 149 |
$this->objectInformationFactory |
| 150 |
); |
| 151 |
} |
| 152 |
|
| 153 |
public function createBackendUserObjectController(): UserObjectController |
| 154 |
{ |
| 155 |
return new UserObjectController( |
| 156 |
$this->php, |
| 157 |
$this->wordpress, |
| 158 |
$this->wordpressConfig, |
| 159 |
$this->mainConfig, |
| 160 |
$this->database, |
| 161 |
$this->dateUtil, |
| 162 |
$this->objectHandler, |
| 163 |
$this->userHandler, |
| 164 |
$this->userGroupHandler, |
| 165 |
$this->userGroupAssignmentHandler, |
| 166 |
$this->accessHandler, |
| 167 |
$this->objectInformationFactory |
| 168 |
); |
| 169 |
} |
| 170 |
|
| 171 |
public function createBackendDynamicGroupsController(): DynamicGroupsController |
| 172 |
{ |
| 173 |
return new DynamicGroupsController( |
| 174 |
$this->php, |
| 175 |
$this->wordpress, |
| 176 |
$this->wordpressConfig, |
| 177 |
$this->mainConfig, |
| 178 |
$this->database, |
| 179 |
$this->dateUtil, |
| 180 |
$this->objectHandler, |
| 181 |
$this->userHandler, |
| 182 |
$this->userGroupHandler, |
| 183 |
$this->userGroupAssignmentHandler, |
| 184 |
$this->accessHandler, |
| 185 |
$this->objectInformationFactory |
| 186 |
); |
| 187 |
} |
| 188 |
|
| 189 |
public function createBackendSettingsController(): SettingsController |
| 190 |
{ |
| 191 |
return new SettingsController( |
| 192 |
$this->php, |
| 193 |
$this->wordpress, |
| 194 |
$this->wordpressConfig, |
| 195 |
$this->mainConfig, |
| 196 |
$this->cache, |
| 197 |
$this->fileHandler, |
| 198 |
$this->formFactory, |
| 199 |
$this->formHelper |
| 200 |
); |
| 201 |
} |
| 202 |
|
| 203 |
public function createBackendSetupController(): SetupController |
| 204 |
{ |
| 205 |
return new SetupController( |
| 206 |
$this->php, |
| 207 |
$this->wordpress, |
| 208 |
$this->wordpressConfig, |
| 209 |
$this->database, |
| 210 |
$this->setupHandler |
| 211 |
); |
| 212 |
} |
| 213 |
|
| 214 |
public function createBackendUserGroupController(): UserGroupController |
| 215 |
{ |
| 216 |
return new UserGroupController( |
| 217 |
$this->php, |
| 218 |
$this->wordpress, |
| 219 |
$this->wordpressConfig, |
| 220 |
$this->userGroupHandler, |
| 221 |
$this->userGroupFactory, |
| 222 |
$this->formHelper |
| 223 |
); |
| 224 |
} |
| 225 |
|
| 226 |
public function createFrontendController(): FrontendController |
| 227 |
{ |
| 228 |
return new FrontendController( |
| 229 |
$this->php, |
| 230 |
$this->wordpress, |
| 231 |
$this->wordpressConfig, |
| 232 |
$this->mainConfig, |
| 233 |
$this->accessHandler |
| 234 |
); |
| 235 |
} |
| 236 |
|
| 237 |
public function createFrontendPostController(): PostController |
| 238 |
{ |
| 239 |
return new PostController( |
| 240 |
$this->php, |
| 241 |
$this->wordpress, |
| 242 |
$this->wordpressConfig, |
| 243 |
$this->mainConfig, |
| 244 |
$this->util, |
| 245 |
$this->objectHandler, |
| 246 |
$this->userHandler, |
| 247 |
$this->userGroupHandler, |
| 248 |
$this->accessHandler, |
| 249 |
$this->database |
| 250 |
); |
| 251 |
} |
| 252 |
|
| 253 |
public function createFrontendRedirectController(): RedirectController |
| 254 |
{ |
| 255 |
return new RedirectController( |
| 256 |
$this->php, |
| 257 |
$this->wordpress, |
| 258 |
$this->wordpressConfig, |
| 259 |
$this->mainConfig, |
| 260 |
$this->database, |
| 261 |
$this->util, |
| 262 |
$this->cache, |
| 263 |
$this->objectHandler, |
| 264 |
$this->accessHandler, |
| 265 |
$this->fileHandler, |
| 266 |
$this->fileObjectFactory |
| 267 |
); |
| 268 |
} |
| 269 |
|
| 270 |
public function createFrontendShortCodeController(): ShortCodeController |
| 271 |
{ |
| 272 |
return new ShortCodeController( |
| 273 |
$this->php, |
| 274 |
$this->wordpress, |
| 275 |
$this->wordpressConfig, |
| 276 |
$this->userGroupHandler |
| 277 |
); |
| 278 |
} |
| 279 |
|
| 280 |
public function createFrontendTermController(): TermController |
| 281 |
{ |
| 282 |
return new TermController( |
| 283 |
$this->php, |
| 284 |
$this->wordpress, |
| 285 |
$this->wordpressConfig, |
| 286 |
$this->mainConfig, |
| 287 |
$this->util, |
| 288 |
$this->objectHandler, |
| 289 |
$this->userHandler, |
| 290 |
$this->userGroupHandler, |
| 291 |
$this->accessHandler, |
| 292 |
$this->objectMapHandler |
| 293 |
); |
| 294 |
} |
| 295 |
} |
| 296 |
|