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;
13
14use FreeDSx\Asn1\Type\AbstractType;
15use FreeDSx\Ldap\Control\Control;
16use FreeDSx\Ldap\Operation\Request\RequestInterface;
17
18/**
19 * The LDAP Message envelope PDU. This represents a message as a request to LDAP.
20 *
21 * @see LdapMessage
22 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
23 */
24class LdapMessageRequest extends LdapMessage
25{
26    /**
27     * @var RequestInterface
28     */
29    protected $request;
30
31    /**
32     * @param int $messageId
33     * @param RequestInterface $request
34     * @param Control ...$controls
35     */
36    public function __construct(int $messageId, RequestInterface $request, Control ...$controls)
37    {
38        $this->request = $request;
39        parent::__construct($messageId, ...$controls);
40    }
41
42    /**
43     * @return RequestInterface
44     */
45    public function getRequest(): RequestInterface
46    {
47        return $this->request;
48    }
49
50    /**
51     * @return AbstractType
52     */
53    protected function getOperationAsn1(): AbstractType
54    {
55        return $this->request->toAsn1();
56    }
57}
58