[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/fgrosse/phpasn1/lib/ASN1/Universal/ -> NullObject.php (source)

   1  <?php
   2  /*
   3   * This file is part of the PHPASN1 library.
   4   *
   5   * Copyright © Friedrich Große <[email protected]>
   6   *
   7   * For the full copyright and license information, please view the LICENSE
   8   * file that was distributed with this source code.
   9   */
  10  
  11  namespace FG\ASN1\Universal;
  12  
  13  use FG\ASN1\ASNObject;
  14  use FG\ASN1\Parsable;
  15  use FG\ASN1\Identifier;
  16  use FG\ASN1\Exception\ParserException;
  17  
  18  class NullObject extends ASNObject implements Parsable
  19  {
  20      public function getType()
  21      {
  22          return Identifier::NULL;
  23      }
  24  
  25      protected function calculateContentLength()
  26      {
  27          return 0;
  28      }
  29  
  30      protected function getEncodedValue()
  31      {
  32          return null;
  33      }
  34  
  35      public function getContent()
  36      {
  37          return 'NULL';
  38      }
  39  
  40      public static function fromBinary(&$binaryData, &$offsetIndex = 0)
  41      {
  42          self::parseIdentifier($binaryData[$offsetIndex], Identifier::NULL, $offsetIndex++);
  43          $contentLength = self::parseContentLength($binaryData, $offsetIndex);
  44  
  45          if ($contentLength != 0) {
  46              throw new ParserException("An ASN.1 Null should not have a length other than zero. Extracted length was {$contentLength}", $offsetIndex);
  47          }
  48  
  49          $parsedObject = new self();
  50          $parsedObject->setContentLength(0);
  51  
  52          return $parsedObject;
  53      }
  54  }


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