1 | <?php |
||
43 | class Member extends BaseBlameableModel |
||
44 | { |
||
45 | public $createdByAttribute = 'organization_guid'; |
||
46 | public $updatedByAttribute = false; |
||
47 | public $hostClass = Organization::class; |
||
48 | |||
49 | public $memberAttribute = 'user_guid'; |
||
50 | public $memberUserClass = User::class; |
||
51 | public $contentAttribute = 'nickname'; |
||
52 | private $noInitMemberUser; |
||
53 | /** |
||
54 | * @return User |
||
55 | */ |
||
56 | 23 | protected function getNoInitMemberUser() |
|
64 | |||
65 | /** |
||
66 | * @inheritdoc |
||
67 | */ |
||
68 | 23 | public function init() |
|
78 | |||
79 | public $descriptionAttribute = 'description'; |
||
80 | |||
81 | 23 | public function getMemberUserRules() |
|
88 | |||
89 | 23 | public function getMemberRoleRules() |
|
95 | |||
96 | /** |
||
97 | * Set member user. |
||
98 | * @param User|string|integer $user |
||
99 | */ |
||
100 | 23 | public function setMemberUser($user) |
|
111 | |||
112 | 23 | public function getMemberUser() |
|
116 | |||
117 | /** |
||
118 | * Get Organization Query. |
||
119 | * Alias of `getHost` method. |
||
120 | * @return OrganizationQuery |
||
121 | */ |
||
122 | 16 | public function getOrganization() |
|
126 | |||
127 | /** |
||
128 | * Set Organization. |
||
129 | * @param BaseOrganization $organization |
||
130 | * @return boolean |
||
131 | */ |
||
132 | 23 | public function setOrganization($organization) |
|
136 | |||
137 | /** |
||
138 | * Assign role. |
||
139 | * The setting role operation will not take effect immediately. You should |
||
140 | * wrap this method and the subsequent save operations together into a |
||
141 | * transaction, in order to ensure data cosistency. |
||
142 | * @param Role $role |
||
143 | */ |
||
144 | 23 | public function assignRole($role) |
|
156 | |||
157 | /** |
||
158 | * Set role. |
||
159 | * @param Role $role |
||
160 | * @return boolean |
||
161 | */ |
||
162 | 23 | public function setRole($role = null) |
|
172 | |||
173 | /** |
||
174 | * Revoke role. |
||
175 | * @param Role $role |
||
176 | */ |
||
177 | 13 | public function revokeRole($role) |
|
204 | |||
205 | 23 | public function rules() |
|
209 | |||
210 | /** |
||
211 | * @inheritdoc |
||
212 | */ |
||
213 | 23 | public static function tableName() |
|
217 | |||
218 | /** |
||
219 | * @inheritdoc |
||
220 | */ |
||
221 | public function attributeLabels() |
||
237 | |||
238 | 2 | public function isDepartmentAdministrator() |
|
242 | |||
243 | 1 | public function isDepartmentCreator() |
|
247 | |||
248 | 2 | public function isOrganizationAdministrator() |
|
252 | |||
253 | 1 | public function isOrganizationCreator() |
|
257 | |||
258 | /** |
||
259 | * |
||
260 | * @return boolean |
||
261 | */ |
||
262 | 2 | public function isAdministrator() |
|
266 | |||
267 | /** |
||
268 | * |
||
269 | * @return boolean |
||
270 | */ |
||
271 | 1 | public function isCreator() |
|
275 | |||
276 | /** |
||
277 | * We think it a `member` if `role` property is empty. |
||
278 | * @return boolean |
||
279 | */ |
||
280 | public function isMember() |
||
284 | } |
||
285 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.