Code Duplication    Length = 17-19 lines in 2 locations

code/model/DNEnvironment.php 1 location

@@ 224-240 (lines=17) @@
221
		return $this->Backend()->getDeployOptions($this);
222
	}
223
224
	public function Menu() {
225
		$list = new ArrayList();
226
227
		$controller = Controller::curr();
228
		$actionType = $controller->getField('CurrentActionType');
229
230
		$list->push(new ArrayData([
231
			'Link' => sprintf('naut/project/%s/environment/%s', $this->Project()->Name, $this->Name),
232
			'Title' => 'Deployments',
233
			'IsCurrent' => $this->isCurrent(),
234
			'IsSection' => $this->isSection() && $actionType == DNRoot::ACTION_DEPLOY
235
		]));
236
237
		$this->extend('updateMenu', $list);
238
239
		return $list;
240
	}
241
242
	/**
243
	 * Return the current object from $this->Menu()

code/model/DNProject.php 1 location

@@ 250-268 (lines=19) @@
247
	 *
248
	 * @return ArrayList
249
	 */
250
	public function Menu() {
251
		$list = new ArrayList();
252
253
		$controller = Controller::curr();
254
		$actionType = $controller->getField('CurrentActionType');
255
256
		if ($this->isProjectReady()) {
257
			$list->push(new ArrayData([
258
				'Link' => sprintf('naut/project/%s/snapshots', $this->Name),
259
				'Title' => 'Snapshots',
260
				'IsCurrent' => $this->isSection() && $controller->getAction() == 'snapshots',
261
				'IsSection' => $this->isSection() && $actionType == DNRoot::ACTION_SNAPSHOT
262
			]));
263
		}
264
265
		$this->extend('updateMenu', $list);
266
267
		return $list;
268
	}
269
270
	/**
271
	 * Is this project currently at the root level of the controller that handles it?