Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
<?php

namespace IMSGlobal\LTI\ToolProvider\MediaType;

/**
 * Class to represent an LTI Message
 *
 * @author  Stephen P Vickers <svickers@imsglobal.org>
 * @copyright  IMS Global Learning Consortium Inc
 * @date  2016
 * @version  3.0.0
 * @license  GNU Lesser General Public License, version 3 (<http://www.gnu.org/licenses/lgpl.html>)
 */
> #[\AllowDynamicProperties]
class Message { /** * Class constructor. * * @param Message $message Message object * @param array $capabilitiesOffered Capabilities offered */ function __construct($message, $capabilitiesOffered) { $this->message_type = $message->type; $this->path = $message->path; $this->enabled_capability = array(); foreach ($message->capabilities as $capability) { if (in_array($capability, $capabilitiesOffered)) { $this->enabled_capability[] = $capability; } } $this->parameter = array(); foreach ($message->constants as $name => $value) { $parameter = new \stdClass; $parameter->name = $name; $parameter->fixed = $value; $this->parameter[] = $parameter; } foreach ($message->variables as $name => $value) { if (in_array($value, $capabilitiesOffered)) { $parameter = new \stdClass; $parameter->name = $name; $parameter->variable = $value; $this->parameter[] = $parameter; } } } }