Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   1  <?php
   2  
   3  namespace Packback\Lti1p3;
   4  
   5  class LtiGradeSubmissionReview
   6  {
   7      private $reviewable_status;
   8      private $label;
   9      private $url;
  10      private $custom;
  11  
  12      public function __construct(array $gradeSubmission = null)
  13      {
  14          $this->reviewable_status = $gradeSubmission['reviewableStatus'] ?? null;
  15          $this->label = $gradeSubmission['label'] ?? null;
  16          $this->url = $gradeSubmission['url'] ?? null;
  17          $this->custom = $gradeSubmission['custom'] ?? null;
  18      }
  19  
  20      public function __toString()
  21      {
  22          // Additionally, includes the call back to filter out only NULL values
  23          return json_encode(array_filter([
  24              'reviewableStatus' => $this->reviewable_status,
  25              'label' => $this->label,
  26              'url' => $this->url,
  27              'custom' => $this->custom,
  28          ], '\Packback\Lti1p3\Helpers\Helpers::checkIfNullValue'));
  29      }
  30  
  31      /**
  32       * Static function to allow for method chaining without having to assign to a variable first.
  33       */
  34      public static function new()
  35      {
  36          return new LtiGradeSubmissionReview();
  37      }
  38  
  39      public function getReviewableStatus()
  40      {
  41          return $this->reviewable_status;
  42      }
  43  
  44      public function setReviewableStatus($value)
  45      {
  46          $this->reviewable_status = $value;
  47  
  48          return $this;
  49      }
  50  
  51      public function getLabel()
  52      {
  53          return $this->label;
  54      }
  55  
  56      public function setLabel($value)
  57      {
  58          $this->label = $value;
  59  
  60          return $this;
  61      }
  62  
  63      public function getUrl()
  64      {
  65          return $this->url;
  66      }
  67  
  68      public function setUrl($url)
  69      {
  70          $this->url = $url;
  71  
  72          return $this;
  73      }
  74  
  75      public function getCustom()
  76      {
  77          return $this->custom;
  78      }
  79  
  80      public function setCustom($value)
  81      {
  82          $this->custom = $value;
  83  
  84          return $this;
  85      }
  86  }