Code Duplication    Length = 13-14 lines in 2 locations

code/control/GitDispatcher.php 1 location

@@ 238-250 (lines=13) @@
235
	 */
236
	protected function getGitBranches($project) {
237
		$branches = [];
238
		foreach ($project->DNBranchList() as $branch) {
239
			$sha = $branch->SHA();
240
			$name = $branch->Name();
241
			$branches[] = [
242
				'id' => $sha,
243
				'branch' => $name,
244
				'title' => sprintf('%s (%s, %s old)',
245
					$name,
246
					substr($sha, 0, 8),
247
					$branch->LastUpdated()->TimeDiff()
248
				)
249
			];
250
		}
251
		return $branches;
252
	}
253

code/control/DNRoot.php 1 location

@@ 1087-1100 (lines=14) @@
1084
			'field_data' => [],
1085
			'options' => $options
1086
		];
1087
		foreach ($project->DNBranchList() as $branch) {
1088
			$sha = $branch->SHA();
1089
			$name = $branch->Name();
1090
			$branchValue = sprintf("%s (%s, %s old)",
1091
				$name,
1092
				substr($sha, 0, 8),
1093
				$branch->LastUpdated()->TimeDiff()
1094
			);
1095
			$data['field_data'][] = [
1096
				'id' => $sha,
1097
				'text' => $branchValue,
1098
				'branch_name' => $name // the raw branch name, not including the time etc
1099
			];
1100
		}
1101
		$tabs[] = $data;
1102
1103
		$data = [