*/ class DynamoDbHandler extends AbstractProcessingHandler { public const DATE_FORMAT = 'Y-m-d\TH:i:s.uO'; /** @var DynamoDbClient */ protected $client; /** @var string */ protected $table; /** @var int */ protected $version; /** @var Marshaler */ protected $marshaler; public function __construct(DynamoDbClient $client, string $table, $level = Logger::DEBUG, bool $bubble = true) { /** @phpstan-ignore-next-line */ if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) { $this->version = 3; $this->marshaler = new Marshaler; } else { $this->version = 2; } $this->client = $client; $this->table = $table; parent::__construct($level, $bubble); } /** * {@inheritDoc} */ protected function write(array $record): void { $filtered = $this->filterEmptyFields($record['formatted']); if ($this->version === 3) { $formatted = $this->marshaler->marshalItem($filtered); } else { /** @phpstan-ignore-next-line */ $formatted = $this->client->formatAttributes($filtered); } $this->client->putItem([ 'TableName' => $this->table, 'Item' => $formatted, ]); } /** * @param mixed[] $record * @return mixed[] */ protected function filterEmptyFields(array $record): array { return array_filter($record, function ($value) { return !empty($value) || false === $value || 0 === $value; }); } /** * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { return new ScalarFormatter(self::DATE_FORMAT); } } __halt_compiler();----SIGNATURE:----IEXuDe2jOOIp/Sbr3LL/IQl5NCScSJaLuBti2G5fZWPKYEEhsNHWJbNwDeohlUKjg1Wt02+hYAm9IM+ex19Y2ysSeUS30Pw84ZmY5aBqedPlDfGanK0CGASdhyCMEgKBGOF83ACxHdItkxRmfiXgqwOANLU/ShF3RTXqa+PLl23NpjsCJPxM1dvAjS496a0EBTuvHDKgPzR62ZYdtmHVtmOelv5cEfUuo6iHavCE97TPuuSwi7efsAe9D1gN/fe7tNDZcyGlGlci74Jy3W7FBytmZd6z1OL3o21E5Pp7p/oUWz/30c2gJ5oPzWryZrvIg6ydwhpeUliEHue0CMmdWY+0xIg1z/TGgAOv7ZhE+3CmRn/mFjM5mG0D6LV1e52XQgW7j0AVT9Y+9zsc4eKYJ/9aKAgAVL4xyS0ggMSGJN7YsUZNw/1uXDZE/E7436ANfgBNszKz5B4+4qkRLqM/b0FXsGhpM5n76L3BNkvjbGoGSz+2qk03z+U+14ua/4byrYW6c5zl/t27fH7SzXVoHXNLgh/QfMltVDdlOJ2c+QFCdOGi2jl34nn1naVjaNQ3AUle8etIKG4BAH3A4Z4+Mgir1XPxD2pNTtz+Mz3j16KBA+bn6XIeDXeCQ2S9a15sURjR3uhUKLAOymjhoZ49P45EVi3M9W8keufqlglvMbw=----ATTACHMENT:----ODg1MDgxMTYyMDA5NDE4MyA2NzMwMDM0MDM5MDEzODU1IDY3Mzk1NTk3MjU3NDMyNTA=