blob: 9e1818fbb1cf7cc9381b74e42f19d4796f9ef99b [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace Adldap;
4
5use Adldap\Connections\ProviderInterface;
6use Adldap\Connections\ConnectionInterface;
7
8interface AdldapInterface
9{
10 /**
11 * Add a provider by the specified name.
12 *
13 * @param mixed $configuration
14 * @param string $name
15 * @param ConnectionInterface $connection
16 *
17 * @throws \InvalidArgumentException When an invalid type is given as the configuration argument.
18 *
19 * @return $this
20 */
21 public function addProvider($configuration, $name, ConnectionInterface $connection = null);
22
23 /**
24 * Returns all of the connection providers.
25 *
26 * @return array
27 */
28 public function getProviders();
29
30 /**
31 * Retrieves a Provider using its specified name.
32 *
33 * @param string $name
34 *
35 * @throws AdldapException When the specified provider does not exist.
36 *
37 * @return ProviderInterface
38 */
39 public function getProvider($name);
40
41 /**
42 * Sets the default provider.
43 *
44 * @param string $name
45 *
46 * @throws AdldapException When the specified provider does not exist.
47 */
48 public function setDefaultProvider($name);
49
50 /**
51 * Retrieves the first default provider.
52 *
53 * @throws AdldapException When no default provider exists.
54 *
55 * @return ProviderInterface
56 */
57 public function getDefaultProvider();
58
59 /**
60 * Removes a provider by the specified name.
61 *
62 * @param string $name
63 *
64 * @return $this
65 */
66 public function removeProvider($name);
67
68 /**
69 * Connects to the specified provider.
70 *
71 * If no username and password is given, then the providers
72 * configured admin credentials are used.
73 *
74 * @param string|null $name
75 * @param string|null $username
76 * @param string|null $password
77 *
78 * @return ProviderInterface
79 */
80 public function connect($name = null, $username = null, $password = null);
81
82 /**
83 * Call methods upon the default provider dynamically.
84 *
85 * @param string $method
86 * @param array $parameters
87 *
88 * @return mixed
89 */
90 public function __call($method, $parameters);
91}