Server IP : 104.21.14.48 / Your IP : 18.217.236.200 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/wp-content/plugins/defender-security/vendor/spomky-labs/cbor-php/src/ |
Upload File : |
<?php declare(strict_types=1); /* * The MIT License (MIT) * * Copyright (c) 2018-2020 Spomky-Labs * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ namespace CBOR; final class TextStringObject extends AbstractCBORObject implements Normalizable { private const MAJOR_TYPE = self::MAJOR_TYPE_TEXT_STRING; /** * @var string|null */ private $length; /** * @var string */ private $data; public function __construct(string $data) { [$additionalInformation, $length] = LengthCalculator::getLengthOfString($data); parent::__construct(self::MAJOR_TYPE, $additionalInformation); $this->data = $data; $this->length = $length; } public function __toString(): string { $result = parent::__toString(); if ($this->length !== null) { $result .= $this->length; } return $result . $this->data; } public static function create(string $data): self { return new self($data); } public function getValue(): string { return $this->data; } public function getLength(): int { return mb_strlen($this->data, 'utf8'); } /** * @deprecated The method will be removed on v3.0. Please rely on the CBOR\Normalizable interface */ public function getNormalizedData(bool $ignoreTags = false): string { return $this->data; } public function normalize() { return $this->data; } }