1<?php
2
3declare(strict_types = 1);
4
5namespace Elasticsearch\Serializers;
6
7/**
8 * Interface SerializerInterface
9 *
10 * @category Elasticsearch
11 * @package  Elasticsearch\Serializers
12 * @author   Zachary Tong <zach@elastic.co>
13 * @license  http://www.apache.org/licenses/LICENSE-2.0 Apache2
14 * @link     http://elastic.co
15 */
16interface SerializerInterface
17{
18    /**
19     * Serialize a complex data-structure into a json encoded string
20     *
21     * @param  mixed $data The data to encode
22     * @return string
23     */
24    public function serialize($data): string;
25
26    /**
27     * Deserialize json encoded string into an associative array
28     *
29     * @param  string $data    JSON encoded string
30     * @param  array  $headers Response Headers
31     * @return string|array
32     */
33    public function deserialize(?string $data, array $headers);
34}
35