[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
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 Brick\Math\BigInteger; 17 use CBOR\ByteStringObject; 18 use CBOR\CBORObject; 19 use CBOR\TagObject as Base; 20 use InvalidArgumentException; 21 22 final class NegativeBigIntegerTag extends Base 23 { 24 public static function getTagId(): int 25 { 26 return 3; 27 } 28 29 public static function createFromLoadedData(int $additionalInformation, ?string $data, CBORObject $object): Base 30 { 31 return new self($additionalInformation, $data, $object); 32 } 33 34 public static function create(CBORObject $object): Base 35 { 36 if (!$object instanceof ByteStringObject) { 37 throw new InvalidArgumentException('This tag only accepts a Byte String object.'); 38 } 39 40 return new self(3, null, $object); 41 } 42 43 public function getNormalizedData(bool $ignoreTags = false) 44 { 45 if ($ignoreTags) { 46 return $this->object->getNormalizedData($ignoreTags); 47 } 48 49 if (!$this->object instanceof ByteStringObject) { 50 return $this->object->getNormalizedData($ignoreTags); 51 } 52 $integer = BigInteger::fromBase(bin2hex($this->object->getValue()), 16); 53 $minusOne = BigInteger::of(-1); 54 55 return $minusOne->minus($integer)->toBase(10); 56 } 57 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |