Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** |
| 6 | * SPDX-FileCopyrightText: 2026 LibreCode coop and contributors |
| 7 | * SPDX-License-Identifier: AGPL-3.0-or-later |
| 8 | */ |
| 9 | |
| 10 | namespace OCA\Libresign\Service\Crl\Ldap; |
| 11 | |
| 12 | /** |
| 13 | * Thin abstraction over the PHP LDAP extension functions. |
| 14 | * |
| 15 | * Allows test doubles to replace real LDAP I/O without requiring a live |
| 16 | * LDAP server or the PHP ldap extension to be loaded. |
| 17 | */ |
| 18 | interface ILdapConnection { |
| 19 | /** @return \LDAP\Connection |
| 20 | * @throws \RuntimeException when the connection cannot be established |
| 21 | */ |
| 22 | public function connect(string $host, int $port): mixed; |
| 23 | |
| 24 | /** |
| 25 | * Apply the recommended default options (protocol version, timeout, |
| 26 | * referrals) to an open connection. Grouped into one method so that |
| 27 | * callers never need to reference LDAP_OPT_* constants. |
| 28 | */ |
| 29 | public function configure(mixed $ldap): void; |
| 30 | |
| 31 | /** @return bool true on success */ |
| 32 | public function bind(mixed $ldap): bool; |
| 33 | |
| 34 | /** |
| 35 | * Equivalent to ldap_read (base scope — single entry). |
| 36 | * |
| 37 | * @return \LDAP\Result|array<array-key, \LDAP\Result>|false |
| 38 | */ |
| 39 | public function read(mixed $ldap, string $dn, string $filter, array $attributes): mixed; |
| 40 | |
| 41 | /** |
| 42 | * Equivalent to ldap_list (one-level scope). |
| 43 | * |
| 44 | * @return \LDAP\Result|array<array-key, \LDAP\Result>|false |
| 45 | */ |
| 46 | public function listEntries(mixed $ldap, string $dn, string $filter, array $attributes): mixed; |
| 47 | |
| 48 | /** |
| 49 | * Equivalent to ldap_search (subtree scope). |
| 50 | * |
| 51 | * @return \LDAP\Result|array<array-key, \LDAP\Result>|false |
| 52 | */ |
| 53 | public function search(mixed $ldap, string $dn, string $filter, array $attributes): mixed; |
| 54 | |
| 55 | /** @return array<string, mixed> */ |
| 56 | public function getEntries(mixed $ldap, mixed $result): array; |
| 57 | |
| 58 | public function unbind(mixed $ldap): void; |
| 59 | } |