[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/web-auth/metadata-service/src/ -> DisplayPNGCharacteristicsDescriptor.php (source)

   1  <?php
   2  
   3  declare(strict_types=1);
   4  
   5  /*
   6   * The MIT License (MIT)
   7   *
   8   * Copyright (c) 2014-2019 Spomky-Labs
   9   *
  10   * This software may be modified and distributed under the terms
  11   * of the MIT license.  See the LICENSE file for details.
  12   */
  13  
  14  namespace Webauthn\MetadataService;
  15  
  16  use Assert\Assertion;
  17  
  18  class DisplayPNGCharacteristicsDescriptor
  19  {
  20      /**
  21       * @var int
  22       */
  23      private $width;
  24  
  25      /**
  26       * @var int
  27       */
  28      private $height;
  29  
  30      /**
  31       * @var int
  32       */
  33      private $bitDepth;
  34  
  35      /**
  36       * @var int
  37       */
  38      private $colorType;
  39  
  40      /**
  41       * @var int
  42       */
  43      private $compression;
  44  
  45      /**
  46       * @var int
  47       */
  48      private $filter;
  49  
  50      /**
  51       * @var int
  52       */
  53      private $interlace;
  54  
  55      /**
  56       * @var RgbPaletteEntry[]
  57       */
  58      private $plte = [];
  59  
  60      public function getWidth(): int
  61      {
  62          return $this->width;
  63      }
  64  
  65      public function getHeight(): int
  66      {
  67          return $this->height;
  68      }
  69  
  70      public function getBitDepth(): int
  71      {
  72          return $this->bitDepth;
  73      }
  74  
  75      public function getColorType(): int
  76      {
  77          return $this->colorType;
  78      }
  79  
  80      public function getCompression(): int
  81      {
  82          return $this->compression;
  83      }
  84  
  85      public function getFilter(): int
  86      {
  87          return $this->filter;
  88      }
  89  
  90      public function getInterlace(): int
  91      {
  92          return $this->interlace;
  93      }
  94  
  95      /**
  96       * @return RgbPaletteEntry[]
  97       */
  98      public function getPlte(): array
  99      {
 100          return $this->plte;
 101      }
 102  
 103      public static function createFromArray(array $data): self
 104      {
 105          $object = new self();
 106          $object->width = $data['width'] ?? null;
 107          $object->compression = $data['compression'] ?? null;
 108          $object->height = $data['height'] ?? null;
 109          $object->bitDepth = $data['bitDepth'] ?? null;
 110          $object->colorType = $data['colorType'] ?? null;
 111          $object->compression = $data['compression'] ?? null;
 112          $object->filter = $data['filter'] ?? null;
 113          $object->interlace = $data['interlace'] ?? null;
 114          if (isset($data['plte'])) {
 115              $plte = $data['plte'];
 116              Assertion::isArray($plte, 'Invalid "plte" parameter');
 117              foreach ($plte as $item) {
 118                  $object->plte[] = RgbPaletteEntry::createFromArray($item);
 119              }
 120          }
 121  
 122          return $object;
 123      }
 124  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer