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
				'ref_name' => $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

@@ 1103-1116 (lines=14) @@
1100
			'field_data' => [],
1101
			'options' => $options
1102
		];
1103
		foreach ($project->DNBranchList() as $branch) {
1104
			$sha = $branch->SHA();
1105
			$name = $branch->Name();
1106
			$branchValue = sprintf("%s (%s, %s old)",
1107
				$name,
1108
				substr($sha, 0, 8),
1109
				$branch->LastUpdated()->TimeDiff()
1110
			);
1111
			$data['field_data'][] = [
1112
				'id' => $sha,
1113
				'text' => $branchValue,
1114
				'branch_name' => $name // the raw branch name, not including the time etc
1115
			];
1116
		}
1117
		$tabs[] = $data;
1118
1119
		$data = [