1<?php
2
3/**
4 * This file is part of the FreeDSx SASL package.
5 *
6 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace FreeDSx\Sasl\Encoder;
13
14use FreeDSx\Sasl\Exception\SaslEncodingException;
15use FreeDSx\Sasl\Message;
16use FreeDSx\Sasl\SaslContext;
17
18/**
19 * The SASL client.
20 *
21 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
22 */
23interface EncoderInterface
24{
25    /**
26     * Encode a message object to a string. Optionally pass the type of message to be encoded.
27     *
28     * @throws SaslEncodingException
29     */
30    public function encode(Message $message, SaslContext $context): string;
31
32    /**
33     * Decode a string to a message object. Optionally pass the type of message to be decoded.
34     *
35     * @throws SaslEncodingException
36     */
37    public function decode(string $data, SaslContext $context): Message;
38}
39