Code Duplication    Length = 21-21 lines in 2 locations

src/package/ModuleManager.php 1 location

@@ 239-259 (lines=21) @@
236
	 * @param string $name
237
	 * @return Group
238
	 */
239
	private function getGroup($name) {
240
		switch ($name) {
241
			case 'guest':
242
				if ($this->guestGroup === null) {
243
					$this->guestGroup = GroupQuery::create()->filterByIsGuest(true)->findOne();
244
				}
245
				return $this->guestGroup;
246
247
			case 'user':
248
				if ($this->userGroup === null) {
249
					$this->userGroup = GroupQuery::create()->filterByIsDefault(true)->findOne();
250
				}
251
				return $this->userGroup;
252
				
253
			case 'admin':
254
				if ($this->adminGroup === null) {
255
					$this->adminGroup = GroupQuery::create()->findOneById(3);
256
				}
257
				return $this->adminGroup;
258
		}
259
	}
260
261
	private function installApi(Module $module, $data, $actionMap) {
262
		if (!isset($data['api'])) {

src/installer/ModuleInstaller.php 1 location

@@ 159-179 (lines=21) @@
156
	 * @param string $name
157
	 * @return Group
158
	 */
159
	private function getGroup($name) {
160
		switch ($name) {
161
			case 'guest':
162
				if ($this->guestGroup === null) {
163
					$this->guestGroup = GroupQuery::create()->filterByIsGuest(true)->findOne();
164
				}
165
				return $this->guestGroup;
166
	
167
			case 'user':
168
				if ($this->userGroup === null) {
169
					$this->userGroup = GroupQuery::create()->filterByIsDefault(true)->findOne();
170
				}
171
				return $this->userGroup;
172
	
173
			case 'admin':
174
				if ($this->adminGroup === null) {
175
					$this->adminGroup = GroupQuery::create()->findOneById(3);
176
				}
177
				return $this->adminGroup;
178
		}
179
	}
180
	
181
	private function updateApi(Module $model, ModuleSchema $module, $actions) {
182
		$repo = $this->service->getResourceRepository();