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\Ldap\Operation\Request\RequestInterface;
15use FreeDSx\Ldap\Protocol\LdapMessageRequest;
16use FreeDSx\Ldap\Protocol\LdapQueue;
17
18/**
19 * Simple methods for constructing the LdapMessage objects in the handlers.
20 *
21 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
22 */
23trait MessageCreationTrait
24{
25    protected function makeRequest(LdapQueue $queue, RequestInterface $request, array $controls): LdapMessageRequest
26    {
27        return new LdapMessageRequest(
28            $queue->generateId(),
29            $request,
30            ...$controls
31        );
32    }
33}
34