CoreFiles by mySites.guru
AbstractCBORObject.php48 lines, 949 bytes, from Joomla_4.0.0-beta1-Beta-Full_Package.zip
Raw History Compare with 3.9.0-beta4
md5
c5adfaa0656bfbbfcda2be1210942b57
sha1
8fd3c299bf4b4d0f0233f571aa23b1d9a54a1b7f
sha256
919508ec168ff86bd9f66471d78488c8dc03d6eb468ea1eea93ae4e39101b706
<?php

declare(strict_types=1);

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2018 Spomky-Labs
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

namespace CBOR;

abstract class AbstractCBORObject implements CBORObject
{
    /**
     * @var int
     */
    private $majorType;

    /**
     * @var int
     */
    protected $additionalInformation;

    public function __construct(int $majorType, int $additionalInformation)
    {
        $this->majorType = $majorType;
        $this->additionalInformation = $additionalInformation;
    }

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

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

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

The same content is in 3 releases, Joomla 4.0.0-beta to 4.0.0-beta3. See them all, or every version of this file.