1<?php
2/**
3 * This file is part of the FreeDSx LDAP package.
4 *
5 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11namespace FreeDSx\Ldap\Protocol\ClientProtocolHandler;
12
13use FreeDSx\Ldap\Operation\Request\RequestInterface;
14use FreeDSx\Ldap\Protocol\LdapMessageRequest;
15use FreeDSx\Ldap\Protocol\LdapQueue;
16
17/**
18 * Simple methods for constructing the LdapMessage objects in the handlers.
19 *
20 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
21 */
22trait MessageCreationTrait
23{
24    protected function makeRequest(LdapQueue $queue, RequestInterface $request, array $controls): LdapMessageRequest
25    {
26        return new LdapMessageRequest(
27            $queue->generateId(),
28            $request,
29            ...$controls
30        );
31    }
32}
33