xref: /plugin/pureldap/vendor/freedsx/ldap/src/FreeDSx/Ldap/Protocol/LdapMessageResponse.php (revision dad993c57a70866aa1db59c43f043769c2eb7ed0) !
10b3fd2d3SAndreas Gohr<?php
2*dad993c5SAndreas Gohr
30b3fd2d3SAndreas Gohr/**
40b3fd2d3SAndreas Gohr * This file is part of the FreeDSx LDAP package.
50b3fd2d3SAndreas Gohr *
60b3fd2d3SAndreas Gohr * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
70b3fd2d3SAndreas Gohr *
80b3fd2d3SAndreas Gohr * For the full copyright and license information, please view the LICENSE
90b3fd2d3SAndreas Gohr * file that was distributed with this source code.
100b3fd2d3SAndreas Gohr */
110b3fd2d3SAndreas Gohr
120b3fd2d3SAndreas Gohrnamespace FreeDSx\Ldap\Protocol;
130b3fd2d3SAndreas Gohr
140b3fd2d3SAndreas Gohruse FreeDSx\Asn1\Type\AbstractType;
150b3fd2d3SAndreas Gohruse FreeDSx\Ldap\Control\Control;
160b3fd2d3SAndreas Gohruse FreeDSx\Ldap\Operation\LdapResult;
170b3fd2d3SAndreas Gohruse FreeDSx\Ldap\Operation\Response\ResponseInterface;
180b3fd2d3SAndreas Gohr
190b3fd2d3SAndreas Gohr/**
200b3fd2d3SAndreas Gohr * The LDAP Message envelope PDU. This represents a message as a response from LDAP.
210b3fd2d3SAndreas Gohr *
220b3fd2d3SAndreas Gohr * @see LdapMessage
230b3fd2d3SAndreas Gohr * @author Chad Sikorra <Chad.Sikorra@gmail.com>
240b3fd2d3SAndreas Gohr */
250b3fd2d3SAndreas Gohrclass LdapMessageResponse extends LdapMessage
260b3fd2d3SAndreas Gohr{
270b3fd2d3SAndreas Gohr    /**
280b3fd2d3SAndreas Gohr     * @var ResponseInterface
290b3fd2d3SAndreas Gohr     */
300b3fd2d3SAndreas Gohr    protected $response;
310b3fd2d3SAndreas Gohr
320b3fd2d3SAndreas Gohr    /**
330b3fd2d3SAndreas Gohr     * @param int $messageId
340b3fd2d3SAndreas Gohr     * @param ResponseInterface $response
350b3fd2d3SAndreas Gohr     * @param Control ...$controls
360b3fd2d3SAndreas Gohr     */
370b3fd2d3SAndreas Gohr    public function __construct(int $messageId, ResponseInterface $response, Control ...$controls)
380b3fd2d3SAndreas Gohr    {
390b3fd2d3SAndreas Gohr        $this->response = $response;
400b3fd2d3SAndreas Gohr        parent::__construct($messageId, ...$controls);
410b3fd2d3SAndreas Gohr    }
420b3fd2d3SAndreas Gohr
430b3fd2d3SAndreas Gohr    /**
440b3fd2d3SAndreas Gohr     * @return ResponseInterface|LdapResult
450b3fd2d3SAndreas Gohr     */
460b3fd2d3SAndreas Gohr    public function getResponse(): ResponseInterface
470b3fd2d3SAndreas Gohr    {
480b3fd2d3SAndreas Gohr        return $this->response;
490b3fd2d3SAndreas Gohr    }
500b3fd2d3SAndreas Gohr
510b3fd2d3SAndreas Gohr    /**
520b3fd2d3SAndreas Gohr     * @return AbstractType
530b3fd2d3SAndreas Gohr     */
540b3fd2d3SAndreas Gohr    protected function getOperationAsn1(): AbstractType
550b3fd2d3SAndreas Gohr    {
560b3fd2d3SAndreas Gohr        return $this->response->toAsn1();
570b3fd2d3SAndreas Gohr    }
580b3fd2d3SAndreas Gohr}
59