setName('talk:room:remove') ->setDescription('Remove users from a room') ->addArgument( 'token', InputArgument::REQUIRED, 'Token of the room to remove users from' )->addArgument( 'participant', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'Removes the given participants from the room' ); } protected function execute(InputInterface $input, OutputInterface $output): int { $token = $input->getArgument('token'); $users = $input->getArgument('participant'); try { $room = $this->manager->getRoomByToken($token); } catch (RoomNotFoundException $e) { $output->writeln('Room not found.'); return 1; } if ($room->isFederatedConversation()) { $output->writeln('Room is a federated conversation.'); return 1; } if (!in_array($room->getType(), [Room::TYPE_GROUP, Room::TYPE_PUBLIC], true)) { $output->writeln('Room is no group call.'); return 1; } try { $this->removeRoomParticipants($room, $users); } catch (InvalidArgumentException $e) { $output->writeln(sprintf('%s', $e->getMessage())); return 1; } $output->writeln('Users successfully removed from room.'); return 0; } #[\Override] public function completeArgumentValues($argumentName, CompletionContext $context) { switch ($argumentName) { case 'token': return $this->completeTokenValues($context); case 'participant': return $this->completeParticipantValues($context); } return parent::completeArgumentValues($argumentName, $context); } }