Exception
11 months ago
BinaryValue.php
11 months ago
DynamoDbClient.php
11 months ago
LockingSessionConnection.php
11 months ago
Marshaler.php
11 months ago
NumberValue.php
11 months ago
SessionConnectionConfigTrait.php
11 months ago
SessionConnectionInterface.php
11 months ago
SessionHandler.php
11 months ago
SetValue.php
11 months ago
StandardSessionConnection.php
11 months ago
WriteRequestBatch.php
11 months ago
BinaryValue.php
38 lines
| 1 | <?php |
| 2 | namespace Aws\DynamoDb; |
| 3 | |
| 4 | use GuzzleHttp\Psr7; |
| 5 | |
| 6 | /** |
| 7 | * Special object to represent a DynamoDB binary (B) value. |
| 8 | */ |
| 9 | class BinaryValue implements \JsonSerializable |
| 10 | { |
| 11 | /** @var string Binary value. */ |
| 12 | private $value; |
| 13 | |
| 14 | /** |
| 15 | * @param mixed $value A binary value compatible with Guzzle streams. |
| 16 | * |
| 17 | * @see GuzzleHttp\Stream\Stream::factory |
| 18 | */ |
| 19 | public function __construct($value) |
| 20 | { |
| 21 | if (!is_string($value)) { |
| 22 | $value = Psr7\Utils::streamFor($value); |
| 23 | } |
| 24 | $this->value = (string) $value; |
| 25 | } |
| 26 | |
| 27 | #[\ReturnTypeWillChange] |
| 28 | public function jsonSerialize() |
| 29 | { |
| 30 | return $this->value; |
| 31 | } |
| 32 | |
| 33 | public function __toString() |
| 34 | { |
| 35 | return $this->value; |
| 36 | } |
| 37 | } |
| 38 |