protected function getIntegrationSummary(Integration $integration)
{
$details = $integration->getProperties();
unset($details['id'], $details['type']);
switch ($integration->type) {
case 'github':
case 'bitbucket':
$summary = sprintf('Repository: %s', $details['repository']);
if ($integration->hasLink('#hook')) {
$summary .= "\n" . sprintf('Hook URL: %s', $integration->getLink('#hook'));
}
break;
case 'hipchat':
$summary = sprintf('Room ID: %s', $details['room']);
break;
case 'webhook':
$summary = sprintf('URL: %s', $details['url']);
break;
default:
$summary = json_encode($details);
}
if (strlen($summary) > 240) {
$summary = substr($summary, 0, 237) . '...';
}
return $summary;
}