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 LtiDeepLinkResourceIframe
   6  {
   7      private ?int $width;
   8      private ?int $height;
   9  
  10      public function __construct(int $width = null, int $height = null)
  11      {
  12          $this->width = $width ?? null;
  13          $this->height = $height ?? null;
  14      }
  15  
  16      public static function new(): LtiDeepLinkResourceIframe
  17      {
  18          return new LtiDeepLinkResourceIframe();
  19      }
  20  
  21      public function setWidth(?int $width): LtiDeepLinkResourceIframe
  22      {
  23          $this->width = $width;
  24  
  25          return $this;
  26      }
  27  
  28      public function getWidth(): ?int
  29      {
  30          return $this->width;
  31      }
  32  
  33      public function setHeight(?int $height): LtiDeepLinkResourceIframe
  34      {
  35          $this->height = $height;
  36  
  37          return $this;
  38      }
  39  
  40      public function getHeight(): ?int
  41      {
  42          return $this->height;
  43      }
  44  
  45      public function toArray(): array
  46      {
  47          $iframe = [];
  48  
  49          if (isset($this->width)) {
  50              $iframe['width'] = $this->width;
  51          }
  52          if (isset($this->height)) {
  53              $iframe['height'] = $this->height;
  54          }
  55  
  56          return $iframe;
  57      }
  58  }