Code Duplication    Length = 16-16 lines in 2 locations

classes/ElggRole.php 2 locations

@@ 130-145 (lines=16) @@
127
	public function getUsers($options) {
128
129
		switch ($this->name) {
130
			case DEFAULT_ROLE :
131
				$dbprefix = elgg_get_config('dbprefix');
132
				$defaults = array(
133
					'type' => 'user',
134
					'joins' => array(
135
						"INNER JOIN {$dbprefix}users_entity u ON (u.guid = e.guid)",
136
						"LEFT JOIN {$dbprefix}entity_relationships r ON (r.guid_one = e.guid AND r.relationship = 'has_role')",
137
					),
138
					'wheres' => array(
139
						'r.guid_two IS NULL',
140
						'u.admin = "no"'
141
					)
142
				);
143
				$options = array_merge($defaults, $options);
144
				$users = elgg_get_entities($options);
145
				break;
146
			case ADMIN_ROLE :
147
				$dbprefix = elgg_get_config('dbprefix');
148
				$defaults = array(
@@ 146-161 (lines=16) @@
143
				$options = array_merge($defaults, $options);
144
				$users = elgg_get_entities($options);
145
				break;
146
			case ADMIN_ROLE :
147
				$dbprefix = elgg_get_config('dbprefix');
148
				$defaults = array(
149
					'type' => 'user',
150
					'joins' => array(
151
						"INNER JOIN {$dbprefix}users_entity u ON (u.guid = e.guid)",
152
						"LEFT JOIN {$dbprefix}entity_relationships r ON (r.guid_one = e.guid AND r.relationship = 'has_role')",
153
					),
154
					'wheres' => array(
155
						'r.guid_two IS NULL',
156
						'u.admin = "yes"'
157
					)
158
				);
159
				$options = array_merge($defaults, $options);
160
				$users = elgg_get_entities($options);
161
				break;
162
			default :
163
				$defaults = array(
164
					'type' => 'user',