@@ -19,13 +19,19 @@ class LtiServiceConnector implements ILtiServiceConnector
19
19
20
20
private $ cache ;
21
21
private $ client ;
22
+ private $ debuggingMode = false ;
22
23
23
24
public function __construct (ICache $ cache , Client $ client )
24
25
{
25
26
$ this ->cache = $ cache ;
26
27
$ this ->client = $ client ;
27
28
}
28
29
30
+ public function setDebuggingMode ($ enable )
31
+ {
32
+ $ this ->debuggingMode = $ enable ;
33
+ }
34
+
29
35
public function getAccessToken (ILtiRegistration $ registration , array $ scopes )
30
36
{
31
37
// Get a unique cache key for the access token
@@ -108,14 +114,16 @@ public function makeServiceRequest(
108
114
});
109
115
$ respBody = $ response ->getBody ();
110
116
111
- error_log ('Syncing grade for this lti_user_id: ' .
112
- json_decode ($ request ->getPayload ()['body ' ])->userId .' ' .print_r ([
113
- 'request_method ' => $ request ->getMethod (),
114
- 'request_url ' => $ request ->getUrl (),
115
- 'request_body ' => $ request ->getPayload ()['body ' ],
116
- 'response_headers ' => $ respHeaders ,
117
- 'response_body ' => (string ) $ respBody ,
118
- ], true ));
117
+ if ($ this ->debuggingMode ) {
118
+ error_log ('Syncing grade for this lti_user_id: ' .
119
+ json_decode ($ request ->getPayload ()['body ' ])->userId .' ' .print_r ([
120
+ 'request_method ' => $ request ->getMethod (),
121
+ 'request_url ' => $ request ->getUrl (),
122
+ 'request_body ' => $ request ->getPayload ()['body ' ],
123
+ 'response_headers ' => $ respHeaders ,
124
+ 'response_body ' => (string ) $ respBody ,
125
+ ], true ));
126
+ }
119
127
120
128
return [
121
129
'headers ' => $ respHeaders ,
0 commit comments