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

@@ 1115-1128 (lines=14) @@
1112
			'field_data' => [],
1113
			'options' => $options
1114
		];
1115
		foreach ($project->DNBranchList() as $branch) {
1116
			$sha = $branch->SHA();
1117
			$name = $branch->Name();
1118
			$branchValue = sprintf("%s (%s, %s old)",
1119
				$name,
1120
				substr($sha, 0, 8),
1121
				$branch->LastUpdated()->TimeDiff()
1122
			);
1123
			$data['field_data'][] = [
1124
				'id' => $sha,
1125
				'text' => $branchValue,
1126
				'branch_name' => $name // the raw branch name, not including the time etc
1127
			];
1128
		}
1129
		$tabs[] = $data;
1130
1131
		$data = [