Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.
   1  <?php
   2  
   3  namespace Packback\Lti1p3;
   4  
   5  class LtiDeepLinkResourceWindow
   6  {
   7      private ?string $target_name;
   8      private ?int $width;
   9      private ?int $height;
  10      private ?string $window_features;
  11  
  12      public function __construct(string $targetName = null, int $width = null, int $height = null, string $windowFeatures = null)
  13      {
  14          $this->target_name = $targetName ?? null;
  15          $this->width = $width ?? null;
  16          $this->height = $height ?? null;
  17          $this->window_features = $windowFeatures ?? null;
  18      }
  19  
  20      public static function new(): LtiDeepLinkResourceWindow
  21      {
  22          return new LtiDeepLinkResourceWindow();
  23      }
  24  
  25      public function setTargetName(?string $targetName): LtiDeepLinkResourceWindow
  26      {
  27          $this->target_name = $targetName;
  28  
  29          return $this;
  30      }
  31  
  32      public function getTargetName(): ?string
  33      {
  34          return $this->target_name;
  35      }
  36  
  37      public function setWidth(?int $width): LtiDeepLinkResourceWindow
  38      {
  39          $this->width = $width;
  40  
  41          return $this;
  42      }
  43  
  44      public function getWidth(): ?int
  45      {
  46          return $this->width;
  47      }
  48  
  49      public function setHeight(?int $height): LtiDeepLinkResourceWindow
  50      {
  51          $this->height = $height;
  52  
  53          return $this;
  54      }
  55  
  56      public function getHeight(): ?int
  57      {
  58          return $this->height;
  59      }
  60  
  61      public function setWindowFeatures(?string $windowFeatures): LtiDeepLinkResourceWindow
  62      {
  63          $this->window_features = $windowFeatures;
  64  
  65          return $this;
  66      }
  67  
  68      public function getWindowFeatures(): ?string
  69      {
  70          return $this->window_features;
  71      }
  72  
  73      public function toArray(): array
  74      {
  75          $window = [];
  76  
  77          if (isset($this->target_name)) {
  78              $window['targetName'] = $this->target_name;
  79          }
  80          if (isset($this->width)) {
  81              $window['width'] = $this->width;
  82          }
  83          if (isset($this->height)) {
  84              $window['height'] = $this->height;
  85          }
  86          if (isset($this->window_features)) {
  87              $window['windowFeatures'] = $this->window_features;
  88          }
  89  
  90          return $window;
  91      }
  92  }