memberRequest = $memberRequest; $this->federatedUserService = $federatedUserService; $this->memberService = $memberService; } protected function configure() { parent::configure(); $this->setName('circles:members:details') ->setDescription('get details about a member by its ID') ->addArgument('member_id', InputArgument::REQUIRED, 'ID of the member') ->addOption('initiator', '', InputOption::VALUE_REQUIRED, 'set an initiator to the request', '') ->addOption('initiator-type', '', InputOption::VALUE_REQUIRED, 'set initiator type', '0') ->addOption('status-code', '', InputOption::VALUE_NONE, 'display status code on exception'); } /** * @param InputInterface $input * @param OutputInterface $output * * @return int * @throws CircleNotFoundException * @throws FederatedUserException * @throws FederatedUserNotFoundException * @throws InitiatorNotFoundException * @throws MemberNotFoundException * @throws OwnerNotFoundException * @throws RemoteInstanceException * @throws RemoteNotFoundException * @throws RemoteResourceNotFoundException * @throws UnknownRemoteException * @throws UserTypeNotFoundException * @throws FederatedItemException * @throws InvalidIdException * @throws RequestBuilderException * @throws SingleCircleNotFoundException */ protected function execute(InputInterface $input, OutputInterface $output): int { $memberId = $input->getArgument('member_id'); $circleId = $this->memberRequest->getMemberById($memberId)->getCircleId(); $this->federatedUserService->commandLineInitiator( $input->getOption('initiator'), Member::parseTypeString($input->getOption('initiator-type')), $circleId, false ); $member = $this->memberService->getMemberById($memberId); $output->writeln(json_encode($member, JSON_PRETTY_PRINT)); return 0; } }