PluginProbe
User Access Manager / 2.2.1
User Access Manager v2.2.1
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 / UserGroup / UserGroupFactory.php

UserGroupFactory.php in User Access Manager 2.2.1, at src/UserGroup/UserGroupFactory.php

139 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * UserGroupFactory.php
4 *
5 * The UserGroupFactory 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\UserGroup;
19
20 use UserAccessManager\Config\MainConfig;
21 use UserAccessManager\Database\Database;
22 use UserAccessManager\Object\ObjectHandler;
23 use UserAccessManager\Util\Util;
24 use UserAccessManager\Wrapper\Php;
25 use UserAccessManager\Wrapper\Wordpress;
26
27 /**
28 * Class UserGroupFactory
29 *
30 * @package UserAccessManager\UserGroup
31 */
32 class UserGroupFactory
33 {
34 /**
35 * @var Php
36 */
37 private $php;
38
39 /**
40 * @var Wordpress
41 */
42 private $wordpress;
43
44 /**
45 * @var Database
46 */
47 private $database;
48
49 /**
50 * @var MainConfig
51 */
52 private $config;
53
54 /**
55 * @var Util
56 */
57 private $util;
58
59 /**
60 * @var ObjectHandler
61 */
62 private $objectHandler;
63
64 /**
65 * @var AssignmentInformationFactory
66 */
67 private $assignmentInformationFactory;
68
69 /**
70 * UserGroupFactory constructor.
71 * @param Php $php
72 * @param Wordpress $wordpress
73 * @param Database $database
74 * @param MainConfig $config
75 * @param Util $util
76 * @param ObjectHandler $objectHandler
77 * @param AssignmentInformationFactory $assignmentInformationFactory
78 */
79 public function __construct(
80 Php $php,
81 Wordpress $wordpress,
82 Database $database,
83 MainConfig $config,
84 Util $util,
85 ObjectHandler $objectHandler,
86 AssignmentInformationFactory $assignmentInformationFactory
87 ) {
88 $this->php = $php;
89 $this->wordpress = $wordpress;
90 $this->database = $database;
91 $this->config = $config;
92 $this->util = $util;
93 $this->objectHandler = $objectHandler;
94 $this->assignmentInformationFactory = $assignmentInformationFactory;
95 }
96
97 /**
98 * Creates a new user group object.
99 * @param null|string $id
100 * @return UserGroup
101 * @throws UserGroupTypeException
102 */
103 public function createUserGroup($id = null): UserGroup
104 {
105 return new UserGroup(
106 $this->php,
107 $this->wordpress,
108 $this->database,
109 $this->config,
110 $this->util,
111 $this->objectHandler,
112 $this->assignmentInformationFactory,
113 $id
114 );
115 }
116
117 /**
118 * Creates a new dynamic user group object.
119 * @param string $type
120 * @param int|string $id
121 * @return DynamicUserGroup
122 * @throws UserGroupTypeException
123 */
124 public function createDynamicUserGroup(string $type, $id): DynamicUserGroup
125 {
126 return new DynamicUserGroup(
127 $this->php,
128 $this->wordpress,
129 $this->database,
130 $this->config,
131 $this->util,
132 $this->objectHandler,
133 $this->assignmentInformationFactory,
134 $type,
135 $id
136 );
137 }
138 }
139