33namespace PulkitJalan \Google ;
44
55use Google_Client ;
6+ use Illuminate \Support \Arr ;
67use PulkitJalan \Google \Exceptions \UnknownServiceException ;
78
89class Client
@@ -26,24 +27,24 @@ public function __construct(array $config, $userEmail = '')
2627 $ this ->config = $ config ;
2728
2829 // create an instance of the google client for OAuth2
29- $ this ->client = new Google_Client (array_get ($ config , 'config ' , []));
30+ $ this ->client = new Google_Client (Arr:: get ($ config , 'config ' , []));
3031
3132 // set application name
32- $ this ->client ->setApplicationName (array_get ($ config , 'application_name ' , '' ));
33+ $ this ->client ->setApplicationName (Arr:: get ($ config , 'application_name ' , '' ));
3334
3435 // set oauth2 configs
35- $ this ->client ->setClientId (array_get ($ config , 'client_id ' , '' ));
36- $ this ->client ->setClientSecret (array_get ($ config , 'client_secret ' , '' ));
37- $ this ->client ->setRedirectUri (array_get ($ config , 'redirect_uri ' , '' ));
38- $ this ->client ->setScopes (array_get ($ config , 'scopes ' , []));
39- $ this ->client ->setAccessType (array_get ($ config , 'access_type ' , 'online ' ));
40- $ this ->client ->setApprovalPrompt (array_get ($ config , 'approval_prompt ' , 'auto ' ));
36+ $ this ->client ->setClientId (Arr:: get ($ config , 'client_id ' , '' ));
37+ $ this ->client ->setClientSecret (Arr:: get ($ config , 'client_secret ' , '' ));
38+ $ this ->client ->setRedirectUri (Arr:: get ($ config , 'redirect_uri ' , '' ));
39+ $ this ->client ->setScopes (Arr:: get ($ config , 'scopes ' , []));
40+ $ this ->client ->setAccessType (Arr:: get ($ config , 'access_type ' , 'online ' ));
41+ $ this ->client ->setApprovalPrompt (Arr:: get ($ config , 'approval_prompt ' , 'auto ' ));
4142
4243 // set developer key
43- $ this ->client ->setDeveloperKey (array_get ($ config , 'developer_key ' , '' ));
44+ $ this ->client ->setDeveloperKey (Arr:: get ($ config , 'developer_key ' , '' ));
4445
4546 // auth for service account
46- if (array_get ($ config , 'service.enable ' , false )) {
47+ if (Arr:: get ($ config , 'service.enable ' , false )) {
4748 $ this ->auth ($ userEmail );
4849 }
4950 }
@@ -57,7 +58,7 @@ public function getClient()
5758 {
5859 return $ this ->client ;
5960 }
60-
61+
6162 /**
6263 * Setter for the google client.
6364 *
@@ -68,7 +69,7 @@ public function getClient()
6869 public function setClient (Google_Client $ client )
6970 {
7071 $ this ->client = $ client ;
71-
72+
7273 return $ this ;
7374 }
7475
@@ -118,14 +119,14 @@ protected function auth($userEmail = '')
118119 */
119120 protected function useAssertCredentials ($ userEmail = '' )
120121 {
121- $ serviceJsonUrl = array_get ($ this ->config , 'service.file ' , '' );
122+ $ serviceJsonUrl = Arr:: get ($ this ->config , 'service.file ' , '' );
122123
123124 if (empty ($ serviceJsonUrl )) {
124125 return false ;
125126 }
126127
127128 $ this ->client ->setAuthConfig ($ serviceJsonUrl );
128-
129+
129130 if (! empty ($ userEmail )) {
130131 $ this ->client ->setSubject ($ userEmail );
131132 }
0 commit comments