Code Duplication    Length = 17-19 lines in 2 locations

code/model/DNEnvironment.php 1 location

@@ 213-229 (lines=17) @@
210
		return Injector::inst()->get($backend);
211
	}
212
213
	public function Menu() {
214
		$list = new ArrayList();
215
216
		$controller = Controller::curr();
217
		$actionType = $controller->getField('CurrentActionType');
218
219
		$list->push(new ArrayData(array(
220
			'Link' => sprintf('naut/project/%s/environment/%s', $this->Project()->Name, $this->Name),
221
			'Title' => 'Deployments',
222
			'IsCurrent' => $this->isCurrent(),
223
			'IsSection' => $this->isSection() && $actionType == DNRoot::ACTION_DEPLOY
224
		)));
225
226
		$this->extend('updateMenu', $list);
227
228
		return $list;
229
	}
230
231
	/**
232
	 * Return the current object from $this->Menu()

code/model/DNProject.php 1 location

@@ 185-203 (lines=19) @@
182
	 *
183
	 * @return ArrayList
184
	 */
185
	public function Menu() {
186
		$list = new ArrayList();
187
188
		$controller = Controller::curr();
189
		$actionType = $controller->getField('CurrentActionType');
190
191
		if(DNRoot::FlagSnapshotsEnabled()) {
192
			$list->push(new ArrayData(array(
193
				'Link' => sprintf('naut/project/%s/snapshots', $this->Name),
194
				'Title' => 'Snapshots',
195
				'IsCurrent' => $this->isSection() && $controller->getAction() == 'snapshots',
196
				'IsSection' => $this->isSection() && $actionType == DNRoot::ACTION_SNAPSHOT
197
			)));
198
		}
199
200
		$this->extend('updateMenu', $list);
201
202
		return $list;
203
	}
204
205
	/**
206
	 * Is this project currently at the root level of the controller that handles it?