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

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