Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
   1  <?php
   2  
   3  namespace Packback\Lti1p3;
   4  
   5  class LtiDeepLinkResourceIcon
   6  {
   7      private $url;
   8      private $width;
   9      private $height;
  10  
  11      public function __construct(string $url, int $width, int $height)
  12      {
  13          $this->url = $url;
  14          $this->width = $width;
  15          $this->height = $height;
  16      }
  17  
  18      public static function new(string $url, int $width, int $height): LtiDeepLinkResourceIcon
  19      {
  20          return new LtiDeepLinkResourceIcon($url, $width, $height);
  21      }
  22  
  23      public function setUrl(string $url): LtiDeepLinkResourceIcon
  24      {
  25          $this->url = $url;
  26  
  27          return $this;
  28      }
  29  
  30      public function getUrl(): string
  31      {
  32          return $this->url;
  33      }
  34  
  35      public function setWidth(int $width): LtiDeepLinkResourceIcon
  36      {
  37          $this->width = $width;
  38  
  39          return $this;
  40      }
  41  
  42      public function getWidth(): int
  43      {
  44          return $this->width;
  45      }
  46  
  47      public function setHeight(int $height): LtiDeepLinkResourceIcon
  48      {
  49          $this->height = $height;
  50  
  51          return $this;
  52      }
  53  
  54      public function getHeight(): int
  55      {
  56          return $this->height;
  57      }
  58  
  59      public function toArray(): array
  60      {
  61          return [
  62              'url' => $this->url,
  63              'width' => $this->width,
  64              'height' => $this->height,
  65          ];
  66      }
  67  }