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\Operation\Response;
12
13use FreeDSx\Ldap\Entry\Entries;
14use FreeDSx\Ldap\Operation\LdapResult;
15
16/**
17 * This response encapsulates the entries returned from the search overall, along with the LDAP result at the end.
18 *
19 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
20 */
21class SearchResponse extends LdapResult
22{
23    /**
24     * @var Entries
25     */
26    protected $entries;
27
28    /**
29     * @param LdapResult $result
30     * @param Entries $entries
31     */
32    public function __construct(LdapResult $result, Entries $entries)
33    {
34        $this->entries = $entries;
35        parent::__construct($result->resultCode, $result->dn, $result->diagnosticMessage, ...$result->referrals);
36    }
37
38    /**
39     * @return Entries
40     */
41    public function getEntries(): Entries
42    {
43        return $this->entries;
44    }
45}
46