[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/spomky-labs/cbor-php/src/Tag/ -> EpochTag.php (source)

   1  <?php
   2  
   3  declare(strict_types=1);
   4  
   5  /*
   6   * The MIT License (MIT)
   7   *
   8   * Copyright (c) 2018-2020 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 CBOR\Tag;
  15  
  16  use CBOR\CBORObject;
  17  use CBOR\TagObject as Base;
  18  use DateTimeImmutable;
  19  
  20  final class EpochTag extends Base
  21  {
  22      public static function getTagId(): int
  23      {
  24          return 0;
  25      }
  26  
  27      public static function createFromLoadedData(int $additionalInformation, ?string $data, CBORObject $object): Base
  28      {
  29          return new self($additionalInformation, $data, $object);
  30      }
  31  
  32      public static function create(CBORObject $object): Base
  33      {
  34          return new self(0, null, $object);
  35      }
  36  
  37      public function getNormalizedData(bool $ignoreTags = false)
  38      {
  39          if ($ignoreTags) {
  40              return $this->object->getNormalizedData($ignoreTags);
  41          }
  42  
  43          return DateTimeImmutable::createFromFormat(DATE_RFC3339, $this->object->getNormalizedData($ignoreTags));
  44      }
  45  }


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