-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
316 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?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; | ||
|
||
interface DecoderInterface | ||
{ | ||
public function decode(Stream $stream): CBORObject; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?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\OtherObject; | ||
|
||
use CBOR\OtherObject; | ||
|
||
interface OtherObjectManagerInterface | ||
{ | ||
public function createObjectForValue(int $value, ?string $data): OtherObject; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?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; | ||
|
||
abstract class Tag extends AbstractCBORObject | ||
{ | ||
private const MAJOR_TYPE = self::MAJOR_TYPE_TAG; | ||
|
||
/** | ||
* @var string|null | ||
*/ | ||
protected $data; | ||
|
||
/** | ||
* @var CBORObject | ||
*/ | ||
protected $object; | ||
|
||
public function __construct(int $additionalInformation, ?string $data, CBORObject $object) | ||
{ | ||
parent::__construct(self::MAJOR_TYPE, $additionalInformation); | ||
$this->data = $data; | ||
$this->object = $object; | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
$result = parent::__toString(); | ||
if (null !== $this->data) { | ||
$result .= $this->data; | ||
} | ||
$result .= (string) $this->object; | ||
|
||
return $result; | ||
} | ||
|
||
abstract public static function getTagId(): int; | ||
|
||
abstract public static function createFromLoadedData(int $additionalInformation, ?string $data, CBORObject $object): self; | ||
|
||
public function getValue(): CBORObject | ||
{ | ||
return $this->object; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.