| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace UserAccessManager\UserGroup; |
| 6 |
|
| 7 |
use UserAccessManager\Config\MainConfig; |
| 8 |
use UserAccessManager\Database\Database; |
| 9 |
use UserAccessManager\Object\ObjectHandler; |
| 10 |
use UserAccessManager\Util\Util; |
| 11 |
use UserAccessManager\Wrapper\Php; |
| 12 |
use UserAccessManager\Wrapper\Wordpress; |
| 13 |
|
| 14 |
class UserGroupFactory |
| 15 |
{ |
| 16 |
public function __construct( |
| 17 |
private Php $php, |
| 18 |
private Wordpress $wordpress, |
| 19 |
private Database $database, |
| 20 |
private MainConfig $config, |
| 21 |
private Util $util, |
| 22 |
private ObjectHandler $objectHandler, |
| 23 |
private AssignmentInformationFactory $assignmentInformationFactory |
| 24 |
) { |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* @throws UserGroupTypeException |
| 29 |
*/ |
| 30 |
public function createUserGroup(int|string|null $id = null): UserGroup |
| 31 |
{ |
| 32 |
return new UserGroup( |
| 33 |
$this->php, |
| 34 |
$this->wordpress, |
| 35 |
$this->database, |
| 36 |
$this->config, |
| 37 |
$this->util, |
| 38 |
$this->objectHandler, |
| 39 |
$this->assignmentInformationFactory, |
| 40 |
$id |
| 41 |
); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* @throws UserGroupTypeException |
| 46 |
*/ |
| 47 |
public function createDynamicUserGroup(string $type, int|string $id): DynamicUserGroup |
| 48 |
{ |
| 49 |
return new DynamicUserGroup( |
| 50 |
$this->php, |
| 51 |
$this->wordpress, |
| 52 |
$this->database, |
| 53 |
$this->config, |
| 54 |
$this->util, |
| 55 |
$this->objectHandler, |
| 56 |
$this->assignmentInformationFactory, |
| 57 |
$type, |
| 58 |
$id |
| 59 |
); |
| 60 |
} |
| 61 |
} |
| 62 |
|