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; } }