Code Duplication    Length = 15-15 lines in 2 locations

code/control/DNRoot.php 1 location

@@ 1314-1328 (lines=15) @@
1311
		// Add in a URL for comparing from->to code changes. Ensure that we have
1312
		// two proper 40 character SHAs, otherwise we can't show the compare link.
1313
		$interface = $project->getRepositoryInterface();
1314
		if(
1315
			!empty($interface) && !empty($interface->URL)
1316
			&& !empty($data['changes']['Code version']['from'])
1317
			&& strlen($data['changes']['Code version']['from']) == '40'
1318
			&& !empty($data['changes']['Code version']['to'])
1319
			&& strlen($data['changes']['Code version']['to']) == '40'
1320
		) {
1321
			$compareurl = sprintf(
1322
				'%s/compare/%s...%s',
1323
				$interface->URL,
1324
				$data['changes']['Code version']['from'],
1325
				$data['changes']['Code version']['to']
1326
			);
1327
			$data['changes']['Code version']['compareUrl'] = $compareurl;
1328
		}
1329
1330
		// Append json to response
1331
		$token = SecurityToken::inst();

code/control/DeployPlanDispatcher.php 1 location

@@ 220-234 (lines=15) @@
217
		// Add in a URL for comparing from->to code changes. Ensure that we have
218
		// two proper 40 character SHAs, otherwise we can't show the compare link.
219
		$interface = $project->getRepositoryInterface();
220
		if(
221
			!empty($interface) && !empty($interface->URL)
222
			&& !empty($data['changes']['Code version']['from'])
223
			&& strlen($data['changes']['Code version']['from']) == '40'
224
			&& !empty($data['changes']['Code version']['to'])
225
			&& strlen($data['changes']['Code version']['to']) == '40'
226
		) {
227
			$compareurl = sprintf(
228
				'%s/compare/%s...%s',
229
				$interface->URL,
230
				$data['changes']['Code version']['from'],
231
				$data['changes']['Code version']['to']
232
			);
233
			$data['changes']['Code version']['compareUrl'] = $compareurl;
234
		}
235
236
		// Append json to response
237
		$token = SecurityToken::inst();