@@ -22,35 +22,14 @@ class Database
22
22
* Constructor for the Database object - this is usually called by
23
23
* Server::useDb rather than directly
24
24
*
25
- * @param array $options This should contain "client" (implementing
26
- * \GuzzleHTTP\ClientInterface) and "db_name" (a string)
27
- * @throws \PHPCouchDB\Exception\ServerException if we don't have the
28
- * expected constructor arguments
25
+ * @param \GuzzleHTTP\ClientInterface $client Our HTTP client
26
+ * @param string $db_name The datbase to connect to
29
27
*/
30
28
31
- public function __construct ($ options )
29
+ public function __construct (\ GuzzleHttp \ ClientInterface $ client , string $ db_name )
32
30
{
33
- if (empty ($ options ) || !is_array ($ options )) {
34
- throw new \PHPCouchDB \Exception \ServerException (
35
- '$options is a required parameter, array must contain both the client and a db_name '
36
- );
37
- }
38
-
39
- if (isset ($ options ['client ' ]) && $ options ['client ' ] instanceof \GuzzleHttp \ClientInterface) {
40
- $ this ->client = $ options ['client ' ];
41
- } else {
42
- throw new \PHPCouchDB \Exception \ServerException (
43
- "The options array must contain a 'client' element of type GuzzleHTTP\ClientInterface "
44
- );
45
- }
46
-
47
- if (isset ($ options ['db_name ' ]) && is_string ($ options ['db_name ' ])) {
48
- $ this ->db_name = $ options ['db_name ' ];
49
- } else {
50
- throw new \PHPCouchDB \Exception \ServerException (
51
- "The options array must contain a 'db_name' key with a value of type string "
52
- );
53
- }
31
+ $ this ->client = $ client ;
32
+ $ this ->db_name = $ db_name ;
54
33
}
55
34
56
35
/**
0 commit comments