# user-access-manager/2.3.15/src/UserGroup/UserGroupFactory.php

User Access Manager, version 2.3.15. 62 lines.

- Page: https://pluginprobe.com/plugins/user-access-manager/2.3.15/code/src/UserGroup/UserGroupFactory.php
- Raw: https://pluginprobe.com/plugins/user-access-manager/2.3.15/raw/src/UserGroup/UserGroupFactory.php
- Modified: 2026-07-27T09:02:54+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/user-access-manager/2.3.15/code/src/UserGroup/UserGroupFactory.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace UserAccessManager\UserGroup;

use UserAccessManager\Config\MainConfig;
use UserAccessManager\Database\Database;
use UserAccessManager\Object\ObjectHandler;
use UserAccessManager\Util\Util;
use UserAccessManager\Wrapper\Php;
use UserAccessManager\Wrapper\Wordpress;

class UserGroupFactory
{
    public function __construct(
        private Php $php,
        private Wordpress $wordpress,
        private Database $database,
        private MainConfig $config,
        private Util $util,
        private ObjectHandler $objectHandler,
        private AssignmentInformationFactory $assignmentInformationFactory
    ) {
    }

    /**
     * @throws UserGroupTypeException
     */
    public function createUserGroup(int|string|null $id = null): UserGroup
    {
        return new UserGroup(
            $this->php,
            $this->wordpress,
            $this->database,
            $this->config,
            $this->util,
            $this->objectHandler,
            $this->assignmentInformationFactory,
            $id
        );
    }

    /**
     * @throws UserGroupTypeException
     */
    public function createDynamicUserGroup(string $type, int|string $id): DynamicUserGroup
    {
        return new DynamicUserGroup(
            $this->php,
            $this->wordpress,
            $this->database,
            $this->config,
            $this->util,
            $this->objectHandler,
            $this->assignmentInformationFactory,
            $type,
            $id
        );
    }
}

```
