1<?php
2
3/**
4 * This file is part of the FreeDSx LDAP 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\Ldap\Protocol\ClientProtocolHandler;
13
14use FreeDSx\Asn1\Exception\EncoderException;
15use FreeDSx\Ldap\Protocol\LdapMessageResponse;
16use FreeDSx\Socket\Exception\ConnectionException;
17
18/**
19 * Logic for handling an unbind operation.
20 *
21 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
22 */
23class ClientUnbindHandler implements RequestHandlerInterface
24{
25    use MessageCreationTrait;
26
27    /**
28     * @param ClientProtocolContext $context
29     * @return null
30     * @throws EncoderException
31     * @throws ConnectionException
32     */
33    public function handleRequest(ClientProtocolContext $context): ?LdapMessageResponse
34    {
35        $queue = $context->getQueue();
36        $message = $context->messageToSend();
37        $queue->sendMessage($message);
38        $queue->close();
39
40        return null;
41    }
42}
43