Your IP : 216.73.216.84


Current Path : /home/helpink/www/libraries/vendor/spomky-labs/cbor-php/src/
Upload File :
Current File : /home/helpink/www/libraries/vendor/spomky-labs/cbor-php/src/AbstractCBORObject.php

<?php

declare(strict_types=1);

namespace CBOR;

use Stringable;
use function chr;

abstract class AbstractCBORObject implements CBORObject, Stringable
{
    public function __construct(
        private int $majorType,
        protected int $additionalInformation
    ) {
    }

    public function __toString(): string
    {
        return chr($this->majorType << 5 | $this->additionalInformation);
    }

    public function getMajorType(): int
    {
        return $this->majorType;
    }

    public function getAdditionalInformation(): int
    {
        return $this->additionalInformation;
    }
}