public function validate(LtiLaunchData $data) {
        try {
            if (!$this->isValidLinkId($this->getLaunchDataParameter($data, LtiLaunchData::RESOURCE_LINK_ID))) {
                throw new LtiInvalidLaunchDataException("Required parameter resource_link_id can not be empty.");
            }

            $ltiVersion = $this->getLaunchDataParameter($data, LtiLaunchData::LTI_VERSION);
            if (!$this->isValidLtiVersion($ltiVersion)) {
                throw new LtiInvalidLaunchDataException("Invalid LTI version provided.");
            }

            if (!$this->isCorrectLtiVersion($ltiVersion)) {
                throw new LtiInvalidLaunchDataException("Wrong LTI version provided.");
            }

            if (!$this->isValidLtiMessageType($this->getLaunchDataParameter($data, LtiLaunchData::LTI_MESSAGE_TYPE))) {
                throw new LtiInvalidLaunchDataException('Invalid LTI message type provided.');
            }

        } catch (LtiException $e) {
            $e->setLaunchData($data);
            throw $e;
        }

        return true;
    }
public function validate(LtiLaunchData $data) {
        try {
            if (!$this->isValidLinkId($this->getLaunchDataParameter($data, LtiLaunchData::RESOURCE_LINK_ID))) {
                throw new LtiInvalidLaunchDataException("Required parameter resource_link_id can not be empty.");
            }

            $ltiVersion = $this->getLaunchDataParameter($data, LtiLaunchData::LTI_VERSION);
            if (!$this->isValidLtiVersion($ltiVersion)) {
                throw new LtiInvalidLaunchDataException("Invalid LTI version provided.");
            }

            if (!$this->isCorrectLtiVersion($ltiVersion)) {
                throw new LtiInvalidLaunchDataException("Wrong LTI version provided.");
            }

            if (!$this->isValidLtiMessageType($this->getLaunchDataParameter($data, LtiLaunchData::LTI_MESSAGE_TYPE))) {
                throw new LtiInvalidLaunchDataException('Invalid LTI message type provided.');
            }

        } catch (LtiException $e) {
            $e->setLaunchData($data);
            throw $e;
        }

        return true;
    }
public function validate ( LtiLaunchData $ data ) { try { if ( ! $ this -> isValidLinkId ( $ this -> getLaunchDataParameter ( $ data , LtiLaunchData :: RESOURCE_LINK_ID ) ) ) { throw new LtiInvalidLaunchDataException ( "Required parameter resource_link_id can not be empty." ) ; } $ ltiVersion = $ this -> getLaunchDataParameter ( $ data , LtiLaunchData :: LTI_VERSION ) ; if ( ! $ this -> isValidLtiVersion ( $ ltiVersion ) ) { throw new LtiInvalidLaunchDataException ( "Invalid LTI version provided." ) ; } if ( ! $ this -> isCorrectLtiVersion ( $ ltiVersion ) ) { throw new LtiInvalidLaunchDataException ( "Wrong LTI version provided." ) ; } if ( ! $ this -> isValidLtiMessageType ( $ this -> getLaunchDataParameter ( $ data , LtiLaunchData :: LTI_MESSAGE_TYPE ) ) ) { throw new LtiInvalidLaunchDataException ( 'Invalid LTI message type provided.' ) ; } } catch ( LtiException $ e ) { $ e -> setLaunchData ( $ data ) ; throw $ e ; } return true ; }
Check if provides launch data object is valid.

@param LtiLaunchData $data
@return bool
@throws LtiException
@throws LtiInvalidLaunchDataException
@throws LtiVariableMissingException
Check if provides launch data object is valid .