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