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