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\Exception;
13
14use Exception;
15use FreeDSx\Ldap\LdapUrl;
16use FreeDSx\Ldap\Operation\ResultCode;
17
18/**
19 * Represents a referral exception from an operation that needs to be chased to be completed.
20 *
21 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
22 */
23class ReferralException extends Exception
24{
25    /**
26     * @var LdapUrl[]
27     */
28    protected $referrals;
29
30    /**
31     * @param string $diagnostic
32     * @param LdapUrl ...$referrals
33     */
34    public function __construct(string $diagnostic, LdapUrl ...$referrals)
35    {
36        $this->referrals = $referrals;
37        parent::__construct($diagnostic, ResultCode::REFERRAL);
38    }
39
40    /**
41     * @return LdapUrl[]
42     */
43    public function getReferrals()
44    {
45        return $this->referrals;
46    }
47}
48