| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace CBOR; |
| 6 | |
| 7 | use CBOR\OtherObject\OtherObjectInterface; |
| 8 | |
| 9 | abstract class OtherObject extends AbstractCBORObject implements OtherObjectInterface |
| 10 | { |
| 11 | private const MAJOR_TYPE = self::MAJOR_TYPE_OTHER_TYPE; |
| 12 | |
| 13 | public function __construct( |
| 14 | int $additionalInformation, |
| 15 | protected ?string $data |
| 16 | ) { |
| 17 | parent::__construct(self::MAJOR_TYPE, $additionalInformation); |
| 18 | } |
| 19 | |
| 20 | public function __toString(): string |
| 21 | { |
| 22 | $result = parent::__toString(); |
| 23 | if ($this->data !== null) { |
| 24 | $result .= $this->data; |
| 25 | } |
| 26 | |
| 27 | return $result; |
| 28 | } |
| 29 | |
| 30 | public function getContent(): ?string |
| 31 | { |
| 32 | return $this->data; |
| 33 | } |
| 34 | } |