예제 #1
0
 /**
  * Get the LTI Configuration generator
  *
  * @return Generator
  */
 public function getGenerator()
 {
     try {
         if (empty($this->generator)) {
             $this->setGenerator(new Generator($this->metadata['TOOL_NAME'], $this->metadata['TOOL_ID'], $this->metadata['TOOL_LAUNCH_URL'], empty($this->metadata['TOOL_DESCRIPTION']) ? false : $this->metadata['TOOL_DESCRIPTION'], empty($this->metadata['TOOL_ICON_URL']) ? false : $this->metadata['TOOL_ICON_URL'], empty($this->metadata['TOOL_LAUNCH_PRIVACY']) ? LaunchPrivacy::USER_PROFILE() : $this->metadata['TOOL_LAUNCH_PRIVACY'], empty($this->metadata['TOOL_DOMAIN']) ? false : $this->metadata['TOOL_DOMAIN']));
         }
     } catch (LTIConfigGeneratorException $e) {
         throw new ConfigurationException($e->getMessage(), ConfigurationException::TOOL_PROVIDER);
     }
     return $this->generator;
 }
예제 #2
0
 /**
  * Set the level of user profile privacy requested of the Tool Consumer
  *
  * @param string $launchPrivacy Must be a valid value of the
  *     `LaunchPrivacy` enumerated type
  *
  * @see LaunchPrivacy `LaunchPrivacy` enumerated type
  */
 public function setLaunchPrivacy($launchPrivacy)
 {
     if (!is_a($launchPrivacy, LaunchPrivacy::class) && !LaunchPrivacy::isValid($launchPrivacy)) {
         throw new ConfigurationException("Invalid launch privacy setting '{$launchPrivacy}'", ConfigurationException::TOOL_PROVIDER);
     } else {
         $this->launchPrivacy = empty($launchPrivacy) ? LaunchPrivacy::ANONYMOUS() : $launchPrivacy;
     }
 }