ltiLaunchRequestBuilder = $ltiLaunchRequestBuilder; return $this; } /** * @throws ErrorException * @throws LtiExceptionInterface */ public function create(LtiLaunchCommandInterface $command): LtiMessageInterface { $registration = $this->getRegistrationRepository() ->find($command->getLtiProvider()->getId()); if (!$registration) { throw new ErrorException( sprintf( 'Registration for provider %s not found', $command->getLtiProvider()->getId() ) ); } return $this->getLaunchRequestBuilder()->buildLtiResourceLinkLaunchRequest( new LtiResourceLink( $command->getResourceIdentifier(), [ 'url' => $command->getLaunchUrl(), ] ), $registration, $command->getOpenIdLoginHint(), $registration->getDefaultDeploymentId(), $command->getRoles(), $command->getClaims() ); } private function getLaunchRequestBuilder(): LtiResourceLinkLaunchRequestBuilder { return $this->ltiLaunchRequestBuilder ?? new LtiResourceLinkLaunchRequestBuilder(); } private function getRegistrationRepository(): RegistrationRepositoryInterface { return $this->getServiceLocator()->get(Lti1p3RegistrationRepository::SERVICE_ID); } }