1 | <?php |
||
19 | class Connection extends Component |
||
20 | { |
||
21 | use LdapFunctionTrait; |
||
22 | |||
23 | /** |
||
24 | * LDAP protocol string. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | const PROTOCOL = 'ldap://'; |
||
29 | |||
30 | /** |
||
31 | * LDAP port number. |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | const PORT = '389'; |
||
36 | |||
37 | /** |
||
38 | * @event Event an event that is triggered after a DB connection is established |
||
39 | */ |
||
40 | const EVENT_AFTER_OPEN = 'afterOpen'; |
||
41 | |||
42 | /** |
||
43 | * @var string the LDAP base dn. |
||
44 | */ |
||
45 | public $baseDn; |
||
46 | |||
47 | /** |
||
48 | * https://msdn.microsoft.com/en-us/library/ms677913(v=vs.85).aspx |
||
49 | * |
||
50 | * @var bool the integer to instruct the LDAP connection whether or not to follow referrals. |
||
51 | */ |
||
52 | public $followReferrals = false; |
||
53 | |||
54 | /** |
||
55 | * @var string The LDAP port to use when connecting to the domain controllers. |
||
56 | */ |
||
57 | public $port = self::PORT; |
||
58 | |||
59 | /** |
||
60 | * @var bool Determines whether or not to use TLS with the current LDAP connection. |
||
61 | */ |
||
62 | public $useTLS = false; |
||
63 | |||
64 | /** |
||
65 | * @var array the domain controllers to connect to. |
||
66 | */ |
||
67 | public $dc = []; |
||
68 | |||
69 | /** |
||
70 | * @var string the LDAP account suffix. |
||
71 | */ |
||
72 | protected $accountSuffix; |
||
73 | |||
74 | /** |
||
75 | * @var string the LDAP account prefix. |
||
76 | */ |
||
77 | protected $accountPrefix; |
||
78 | |||
79 | /** |
||
80 | * @var string the username for establishing LDAP connection. Defaults to `null` meaning no username to use. |
||
81 | */ |
||
82 | public $username; |
||
83 | |||
84 | /** |
||
85 | * @var string the password for establishing DB connection. Defaults to `null` meaning no password to use. |
||
86 | */ |
||
87 | public $password; |
||
88 | |||
89 | /** |
||
90 | * @var bool stores the bool whether or not the current connection is bound. |
||
91 | */ |
||
92 | protected $bound = false; |
||
93 | |||
94 | /** |
||
95 | * @var Connection |
||
96 | */ |
||
97 | protected $resource; |
||
98 | |||
99 | /** |
||
100 | * Get the current resource of connection. |
||
101 | * |
||
102 | * @return mixed |
||
103 | */ |
||
104 | public function getResource() |
||
108 | |||
109 | /** |
||
110 | * Connects and Binds to the Domain Controller with a administrator credentials. |
||
111 | * |
||
112 | * @throws LdapException |
||
113 | */ |
||
114 | public function open($anonymous = false) |
||
127 | |||
128 | /** |
||
129 | * Returns true / false if the current |
||
130 | * connection is bound. |
||
131 | * |
||
132 | * @return bool |
||
133 | */ |
||
134 | public function isBound() |
||
138 | |||
139 | /** |
||
140 | * Retrieve the last error on the current |
||
141 | * connection. |
||
142 | * |
||
143 | * @return string |
||
144 | */ |
||
145 | public function connect($hostname = [], $port = '389') |
||
172 | |||
173 | /** |
||
174 | * Closes the current connection. |
||
175 | * |
||
176 | * @return mixed |
||
177 | */ |
||
178 | public function close() |
||
185 | |||
186 | /** |
||
187 | * Execute ldap functions like. |
||
188 | * |
||
189 | * http://php.net/manual/en/ref.ldap.php |
||
190 | * |
||
191 | * @param string $function php LDAP function |
||
192 | * @param array $params params for execute ldap function |
||
193 | * @return bool|resource |
||
194 | * @throws LdapException |
||
195 | */ |
||
196 | public function execute($function, $params) |
||
211 | |||
212 | /** |
||
213 | * Close the connection before serializing. |
||
214 | * @return array |
||
215 | */ |
||
216 | public function __sleep() |
||
221 | |||
222 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..