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