- md5
- 2852738e6a40c12d87b711636558ab3b
- sha1
- 991a82ccc7ee4425e9cbe75065069df3ca255653
- sha256
- a61d5fbe50ee3e361ae50d8fb28ebf77497c2da7ad5246cff5747d14594ed171
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
<?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;
use InvalidArgumentException;
final class ByteStringWithChunkObject extends AbstractCBORObject
{
private const MAJOR_TYPE = 0b010;
private const ADDITIONAL_INFORMATION = 0b00011111;
/**
* @var ByteStringObject[]
*/
private $chunks = [];
public function __construct()
{
parent::__construct(self::MAJOR_TYPE, self::ADDITIONAL_INFORMATION);
}
public function __toString(): string
{
$result = parent::__toString();
foreach ($this->chunks as $chunk) {
$result .= (string) $chunk;
}
$bin = hex2bin('FF');
if (false === $bin) {
throw new InvalidArgumentException('Unable to convert the data');
}
$result .= $bin;
return $result;
}
public function add(ByteStringObject $chunk): void
{
$this->chunks[] = $chunk;
}
public function append(string $chunk): void
{
$this->add(new ByteStringObject($chunk));
}
public function getValue(): string
{
$result = '';
foreach ($this->chunks as $chunk) {
$result .= $chunk->getValue();
}
return $result;
}
public function getLength(): int
{
$length = 0;
foreach ($this->chunks as $chunk) {
$length += $chunk->getLength();
}
return $length;
}
public function getNormalizedData(bool $ignoreTags = false): string
{
$result = '';
foreach ($this->chunks as $chunk) {
$result .= $chunk->getNormalizedData($ignoreTags);
}
return $result;
}
}
The same content is in 128 releases, Joomla 4.0.0-beta4 to 4.4.14. See them all, or every version of this file.