protected function execute(InputInterface $input, OutputInterface $output)
{
$this->validateInput($input);
$project = $this->getSelectedProject();
$rows = [];
$i = 0;
$table = new Table($input, $output);
foreach ($project->getUsers() as $user) {
$account = $this->api()->getAccount($user);
$role = $user['role'];
$weight = $i++;
if ($project->owner === $user->id) {
$weight = -1;
if (!$table->formatIsMachineReadable()) {
$role .= ' (owner)';
}
}
$rows[$weight] = [$account['email'], $account['display_name'], $role];
}
ksort($rows);
$table->render(array_values($rows), ['Email address', 'Name', 'Project role']);
return 0;
}