20
20
21
21
use \GuzzleHttp \Client ;
22
22
use \GuzzleHttp \Exception \ClientException ;
23
+ use \Drupal \rocket_chat_api \RocketChat \RocketChatConfigInterface ;
23
24
24
25
/**
25
26
* Class ApiClient
@@ -49,7 +50,7 @@ class ApiClient {
49
50
50
51
/**
51
52
* Config Object.
52
- * @var \Drupal\rocket_chat_api\RocketChat\RocketChatConfigInterface Object
53
+ * @var \Drupal\rocket_chat_api\RocketChat\RocketChatConfigInterface $config
53
54
* RocketChatConfigInterface object.
54
55
*/
55
56
private $ config ;
@@ -58,24 +59,25 @@ class ApiClient {
58
59
59
60
/**
60
61
* ApiClient constructor.
61
- * Loads in the configuration from the Drupal Variables and preparers the
62
- * Client with some defaults and base values for ease of use.
63
62
*
64
63
* @param \Drupal\rocket_chat_api\RocketChat\RocketChatConfigInterface $config
65
64
* Config Object.
66
- *
67
65
* @param bool $login
68
- * When true the stored login tokens will not be used. when false the
66
+ * When true the stored login tokens will not be used. when false the
69
67
* stored login tokens will be used. This is to facilitate login and
70
68
* non-auth calls. Or in other words, is this a login call.
71
69
*/
72
- public function __construct ($ config = NULL , $ login = FALSE ) {
70
+ public function __construct (RocketChatConfigInterface $ config = NULL ,
71
+ $ login = FALSE ) {
73
72
$ this ->config = $ config ;
74
73
if (!empty ($ config )) {
75
74
$ this ->client = $ this ->createClient ($ login );
76
75
$ userToken = $ this ->config ->getElement ("rocket_chat_uit " );
77
76
if (empty ($ userToken )) {
78
- $ this ->loggedIn = $ this ->login ($ this ->config ->getElement ("user " ), $ this ->config ->getElement ("secret " ));
77
+ $ this ->loggedIn = $ this ->login (
78
+ $ this ->config ->getElement ("user " ),
79
+ $ this ->config ->getElement ("secret " )
80
+ );
79
81
}
80
82
}
81
83
else {
0 commit comments