@@ -32,7 +32,9 @@ |
||
| 32 | 32 | $url = $this->url . $this->api . $this->v2 . $this->store . '/' . $this->id ?? $this->id; |
| 33 | 33 | $response = $this->request($url); |
| 34 | 34 | |
| 35 | - if ($selected) $response = $this->select($selected, $response); |
|
| 35 | + if ($selected) { |
|
| 36 | + $response = $this->select($selected, $response); |
|
| 37 | + } |
|
| 36 | 38 | |
| 37 | 39 | return $response; |
| 38 | 40 | |
@@ -33,7 +33,9 @@ |
||
| 33 | 33 | $url = $this->url . $this->api . $this->v2 . $this->client . '/' . $this->id ?? $this->id; |
| 34 | 34 | $response = $this->request($url); |
| 35 | 35 | |
| 36 | - if ($selected) $response = $this->select($selected, $response); |
|
| 36 | + if ($selected) { |
|
| 37 | + $response = $this->select($selected, $response); |
|
| 38 | + } |
|
| 37 | 39 | |
| 38 | 40 | return $response; |
| 39 | 41 | } catch (Exception $e) { |
@@ -397,7 +397,9 @@ |
||
| 397 | 397 | */ |
| 398 | 398 | public function sendRequestsOld(){ |
| 399 | 399 | $error = $this->checkError(); |
| 400 | - if( $error ) return false; |
|
| 400 | + if( $error ) { |
|
| 401 | + return false; |
|
| 402 | + } |
|
| 401 | 403 | |
| 402 | 404 | $results = array(); |
| 403 | 405 | |
@@ -31,7 +31,9 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function forwarding($id = null) |
| 33 | 33 | { |
| 34 | - if ($this->statement_forwarding) return $this->statement_forwarding; |
|
| 34 | + if ($this->statement_forwarding) { |
|
| 35 | + return $this->statement_forwarding; |
|
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | $this->statement_forwarding = new StatementForwardingHandler($id ? $id : null); |
| 37 | 39 | return $this->forwarding($id ? $id : null); |
@@ -18,8 +18,9 @@ discard block |
||
| 18 | 18 | 'auth' => $this->auth(), |
| 19 | 19 | 'headers' => $this->headers() |
| 20 | 20 | ]); |
| 21 | - if ( $response->getStatusCode() === 404 ) |
|
| 22 | - throw new ClientException(404); |
|
| 21 | + if ( $response->getStatusCode() === 404 ) { |
|
| 22 | + throw new ClientException(404); |
|
| 23 | + } |
|
| 23 | 24 | |
| 24 | 25 | return $response->getBody()->getContents(); |
| 25 | 26 | } catch (ClientException $e) { |
@@ -36,8 +37,9 @@ discard block |
||
| 36 | 37 | 'headers' => $this->headers(), |
| 37 | 38 | 'body' => $data |
| 38 | 39 | ]); |
| 39 | - if ( $response->getStatusCode() === 404 ) |
|
| 40 | - throw new ClientException(404); |
|
| 40 | + if ( $response->getStatusCode() === 404 ) { |
|
| 41 | + throw new ClientException(404); |
|
| 42 | + } |
|
| 41 | 43 | |
| 42 | 44 | return $response->getBody()->getContents(); |
| 43 | 45 | } catch (ClientException $e) { |
@@ -52,8 +54,9 @@ discard block |
||
| 52 | 54 | 'auth' => $this->auth(), |
| 53 | 55 | 'headers' => $this->headers() |
| 54 | 56 | ]); |
| 55 | - if ( $response->getStatusCode() === 404 ) |
|
| 56 | - throw new ClientException(404); |
|
| 57 | + if ( $response->getStatusCode() === 404 ) { |
|
| 58 | + throw new ClientException(404); |
|
| 59 | + } |
|
| 57 | 60 | |
| 58 | 61 | return $response->getBody()->getContents(); |
| 59 | 62 | } catch (ClientException $e) { |
@@ -117,8 +120,9 @@ discard block |
||
| 117 | 120 | return true; |
| 118 | 121 | } |
| 119 | 122 | |
| 120 | - if ( $response->getStatusCode() === 404 ) |
|
| 121 | - throw new ClientException(404); |
|
| 123 | + if ( $response->getStatusCode() === 404 ) { |
|
| 124 | + throw new ClientException(404); |
|
| 125 | + } |
|
| 122 | 126 | |
| 123 | 127 | return $response->getBody()->getContents(); |
| 124 | 128 | } catch (ClientException $e) { |
@@ -30,7 +30,9 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function progress($id = null) |
| 32 | 32 | { |
| 33 | - if ($this->journey_progress) return $this->journey_progress; |
|
| 33 | + if ($this->journey_progress) { |
|
| 34 | + return $this->journey_progress; |
|
| 35 | + } |
|
| 34 | 36 | |
| 35 | 37 | $this->journey_progress = new JourneyProgressHandler($id ? $id : null); |
| 36 | 38 | return $this->progress($id ? $id : null); |
@@ -103,7 +103,9 @@ discard block |
||
| 103 | 103 | * @return $response |
| 104 | 104 | */ |
| 105 | 105 | public function check($statementForwardId) { |
| 106 | - if (empty($statementForwardId)) return false; |
|
| 106 | + if (empty($statementForwardId)) { |
|
| 107 | + return false; |
|
| 108 | + } |
|
| 107 | 109 | return $this->get($statementForwardId); |
| 108 | 110 | } |
| 109 | 111 | |
@@ -180,7 +182,9 @@ discard block |
||
| 180 | 182 | * @return $response |
| 181 | 183 | */ |
| 182 | 184 | protected function update($statementForwardId, $data) { |
| 183 | - if (empty($statementForwardId)) return false; |
|
| 185 | + if (empty($statementForwardId)) { |
|
| 186 | + return false; |
|
| 187 | + } |
|
| 184 | 188 | $update = json_encode($data); |
| 185 | 189 | try { |
| 186 | 190 | $url = $this->endpoint . $this->api . $this->v2 . $this->statementForward . '/' . $statementForwardId; |
@@ -35,11 +35,21 @@ |
||
| 35 | 35 | $criteriaQuery['$comment'] = 'id:' . $criterion->id . ', object_id:' . $criterion->object_id; |
| 36 | 36 | $activity_id = $criterion->use_curatr_activity ? $criterion->object->getXapiUrl(true, true) : $criterion->activity_id; |
| 37 | 37 | $criteriaQuery['statement.object.id'] = $activity_id; |
| 38 | - if (!empty($criterion->verb)) $criteriaQuery['statement.verb.id'] = $criterion->verb; |
|
| 39 | - if (!empty($criterion->completion)) $criteriaQuery['statement.result.completion'] = true; |
|
| 40 | - if (!empty($criterion->success)) $criteriaQuery['statement.result.success'] = true; |
|
| 41 | - if (is_numeric($criterion->raw)) $criteriaQuery['statement.result.score.raw'] = ['$gte' => floatval($criterion->raw)]; |
|
| 42 | - if (is_numeric($criterion->scaled)) $criteriaQuery['statement.result.score.scaled'] = ['$gte' => floatval($criterion->scaled)]; |
|
| 38 | + if (!empty($criterion->verb)) { |
|
| 39 | + $criteriaQuery['statement.verb.id'] = $criterion->verb; |
|
| 40 | + } |
|
| 41 | + if (!empty($criterion->completion)) { |
|
| 42 | + $criteriaQuery['statement.result.completion'] = true; |
|
| 43 | + } |
|
| 44 | + if (!empty($criterion->success)) { |
|
| 45 | + $criteriaQuery['statement.result.success'] = true; |
|
| 46 | + } |
|
| 47 | + if (is_numeric($criterion->raw)) { |
|
| 48 | + $criteriaQuery['statement.result.score.raw'] = ['$gte' => floatval($criterion->raw)]; |
|
| 49 | + } |
|
| 50 | + if (is_numeric($criterion->scaled)) { |
|
| 51 | + $criteriaQuery['statement.result.score.scaled'] = ['$gte' => floatval($criterion->scaled)]; |
|
| 52 | + } |
|
| 43 | 53 | |
| 44 | 54 | if (sizeof($criteriaQuery) > 0) { |
| 45 | 55 | $queries[] = $criteriaQuery; |
@@ -65,7 +65,9 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function connect($key, $secret, $url) |
| 67 | 67 | { |
| 68 | - if ($this->connection) return $this; |
|
| 68 | + if ($this->connection) { |
|
| 69 | + return $this; |
|
| 70 | + } |
|
| 69 | 71 | |
| 70 | 72 | $this->connection = new Connection($key, $secret, $url); |
| 71 | 73 | return $this->connect($key, $secret, $url); |
@@ -78,7 +80,9 @@ discard block |
||
| 78 | 80 | */ |
| 79 | 81 | public function clients() |
| 80 | 82 | { |
| 81 | - if ($this->clients) return $this->clients; |
|
| 83 | + if ($this->clients) { |
|
| 84 | + return $this->clients; |
|
| 85 | + } |
|
| 82 | 86 | |
| 83 | 87 | $this->clients = new ClientHandler; |
| 84 | 88 | return $this->clients(); |
@@ -92,7 +96,9 @@ discard block |
||
| 92 | 96 | */ |
| 93 | 97 | public function client($id = null) |
| 94 | 98 | { |
| 95 | - if ($this->client) return $this->client; |
|
| 99 | + if ($this->client) { |
|
| 100 | + return $this->client; |
|
| 101 | + } |
|
| 96 | 102 | $this->client = new ClientHandler($id ? $id : null); |
| 97 | 103 | return $this->client($id ? $id : null); |
| 98 | 104 | } |
@@ -104,7 +110,9 @@ discard block |
||
| 104 | 110 | */ |
| 105 | 111 | public function users() |
| 106 | 112 | { |
| 107 | - if ($this->users) return $this->users; |
|
| 113 | + if ($this->users) { |
|
| 114 | + return $this->users; |
|
| 115 | + } |
|
| 108 | 116 | |
| 109 | 117 | $this->users = new UserHandler; |
| 110 | 118 | return $this->users(); |
@@ -118,7 +126,9 @@ discard block |
||
| 118 | 126 | */ |
| 119 | 127 | public function user($id = null) |
| 120 | 128 | { |
| 121 | - if ($this->user) return $this->user; |
|
| 129 | + if ($this->user) { |
|
| 130 | + return $this->user; |
|
| 131 | + } |
|
| 122 | 132 | |
| 123 | 133 | $this->user = new UserHandler($id ? $id : null); |
| 124 | 134 | return $this->user($id ? $id : null); |
@@ -131,7 +141,9 @@ discard block |
||
| 131 | 141 | */ |
| 132 | 142 | public function roles() |
| 133 | 143 | { |
| 134 | - if ($this->roles) return $this->roles; |
|
| 144 | + if ($this->roles) { |
|
| 145 | + return $this->roles; |
|
| 146 | + } |
|
| 135 | 147 | |
| 136 | 148 | $this->roles = new RoleHandler; |
| 137 | 149 | return $this->roles(); |
@@ -145,7 +157,9 @@ discard block |
||
| 145 | 157 | */ |
| 146 | 158 | public function role($id = null) |
| 147 | 159 | { |
| 148 | - if ($this->role) return $this->role; |
|
| 160 | + if ($this->role) { |
|
| 161 | + return $this->role; |
|
| 162 | + } |
|
| 149 | 163 | |
| 150 | 164 | $this->role = new RoleHandler($id ? $id : null); |
| 151 | 165 | return $this->role($id ? $id : null); |
@@ -158,7 +172,9 @@ discard block |
||
| 158 | 172 | */ |
| 159 | 173 | public function stores() |
| 160 | 174 | { |
| 161 | - if ($this->stores) return $this->stores; |
|
| 175 | + if ($this->stores) { |
|
| 176 | + return $this->stores; |
|
| 177 | + } |
|
| 162 | 178 | |
| 163 | 179 | $this->stores = new StoreHandler; |
| 164 | 180 | return $this->stores(); |
@@ -172,7 +188,9 @@ discard block |
||
| 172 | 188 | */ |
| 173 | 189 | public function store($id = null) |
| 174 | 190 | { |
| 175 | - if ($this->store) return $this->store; |
|
| 191 | + if ($this->store) { |
|
| 192 | + return $this->store; |
|
| 193 | + } |
|
| 176 | 194 | |
| 177 | 195 | $this->store = new StoreHandler($id ? $id : null); |
| 178 | 196 | return $this->store($id ? $id : null); |
@@ -185,7 +203,9 @@ discard block |
||
| 185 | 203 | */ |
| 186 | 204 | public function queries() |
| 187 | 205 | { |
| 188 | - if ($this->queries) return $this->queries; |
|
| 206 | + if ($this->queries) { |
|
| 207 | + return $this->queries; |
|
| 208 | + } |
|
| 189 | 209 | |
| 190 | 210 | $this->queries = new QueryHandler; |
| 191 | 211 | return $this->queries(); |
@@ -198,7 +218,9 @@ discard block |
||
| 198 | 218 | */ |
| 199 | 219 | public function query($id = null) |
| 200 | 220 | { |
| 201 | - if ($this->query) return $this->query; |
|
| 221 | + if ($this->query) { |
|
| 222 | + return $this->query; |
|
| 223 | + } |
|
| 202 | 224 | |
| 203 | 225 | $this->query = new QueryHandler($id ? $id : null); |
| 204 | 226 | return $this->query($id ? $id : null); |
@@ -211,7 +233,9 @@ discard block |
||
| 211 | 233 | */ |
| 212 | 234 | public function exports() |
| 213 | 235 | { |
| 214 | - if ($this->exports) return $this->exports; |
|
| 236 | + if ($this->exports) { |
|
| 237 | + return $this->exports; |
|
| 238 | + } |
|
| 215 | 239 | |
| 216 | 240 | $this->exports = new ExportHandler; |
| 217 | 241 | return $this->exports(); |
@@ -224,7 +248,9 @@ discard block |
||
| 224 | 248 | */ |
| 225 | 249 | public function export($id = null) |
| 226 | 250 | { |
| 227 | - if ($this->export) return $this->export; |
|
| 251 | + if ($this->export) { |
|
| 252 | + return $this->export; |
|
| 253 | + } |
|
| 228 | 254 | |
| 229 | 255 | $this->export = new ExportHandler($id ? $id : null); |
| 230 | 256 | return $this->export($id ? $id : null); |
@@ -237,7 +263,9 @@ discard block |
||
| 237 | 263 | */ |
| 238 | 264 | public function personas() |
| 239 | 265 | { |
| 240 | - if ($this->personas) return $this->personas; |
|
| 266 | + if ($this->personas) { |
|
| 267 | + return $this->personas; |
|
| 268 | + } |
|
| 241 | 269 | |
| 242 | 270 | $this->personas = new PersonaHandler; |
| 243 | 271 | return $this->personas(); |
@@ -251,7 +279,9 @@ discard block |
||
| 251 | 279 | */ |
| 252 | 280 | public function persona($id = null) |
| 253 | 281 | { |
| 254 | - if ($this->persona) return $this->persona; |
|
| 282 | + if ($this->persona) { |
|
| 283 | + return $this->persona; |
|
| 284 | + } |
|
| 255 | 285 | |
| 256 | 286 | $this->persona = new PersonaHandler($id ? $id : null); |
| 257 | 287 | return $this->persona($id ? $id : null); |
@@ -264,7 +294,9 @@ discard block |
||
| 264 | 294 | */ |
| 265 | 295 | public function journeys() |
| 266 | 296 | { |
| 267 | - if ($this->journeys) return $this->journeys; |
|
| 297 | + if ($this->journeys) { |
|
| 298 | + return $this->journeys; |
|
| 299 | + } |
|
| 268 | 300 | |
| 269 | 301 | $this->journeys = new JourneyHandler; |
| 270 | 302 | return $this->journeys(); |
@@ -278,7 +310,9 @@ discard block |
||
| 278 | 310 | */ |
| 279 | 311 | public function journey($id = null) |
| 280 | 312 | { |
| 281 | - if ($this->journey) return $this->journey; |
|
| 313 | + if ($this->journey) { |
|
| 314 | + return $this->journey; |
|
| 315 | + } |
|
| 282 | 316 | |
| 283 | 317 | $this->journey = new JourneyHandler($id ? $id : null); |
| 284 | 318 | return $this->journey($id ? $id : null); |
@@ -292,7 +326,9 @@ discard block |
||
| 292 | 326 | */ |
| 293 | 327 | public function journeyProgress($id = null) |
| 294 | 328 | { |
| 295 | - if ($this->journey_progress) return $this->journey_progress; |
|
| 329 | + if ($this->journey_progress) { |
|
| 330 | + return $this->journey_progress; |
|
| 331 | + } |
|
| 296 | 332 | |
| 297 | 333 | $this->journey_progress = new JourneyProgressHandler($id ? $id : null); |
| 298 | 334 | return $this->journeyProgress($id ? $id : null); |
@@ -305,7 +341,9 @@ discard block |
||
| 305 | 341 | */ |
| 306 | 342 | public function dashboards() |
| 307 | 343 | { |
| 308 | - if ($this->dashboards) return $this->dashboards; |
|
| 344 | + if ($this->dashboards) { |
|
| 345 | + return $this->dashboards; |
|
| 346 | + } |
|
| 309 | 347 | |
| 310 | 348 | $this->dashboards = new DashboardHandler; |
| 311 | 349 | return $this->dashboards(); |
@@ -319,7 +357,9 @@ discard block |
||
| 319 | 357 | */ |
| 320 | 358 | public function dashboard($id = null) |
| 321 | 359 | { |
| 322 | - if ($this->dashboard) return $this->dashboard; |
|
| 360 | + if ($this->dashboard) { |
|
| 361 | + return $this->dashboard; |
|
| 362 | + } |
|
| 323 | 363 | |
| 324 | 364 | $this->dashboard = new DashboardHandler($id ? $id : null); |
| 325 | 365 | return $this->dashboard($id ? $id : null); |
@@ -332,7 +372,9 @@ discard block |
||
| 332 | 372 | */ |
| 333 | 373 | public function downloads() |
| 334 | 374 | { |
| 335 | - if ($this->downloads) return $this->downloads; |
|
| 375 | + if ($this->downloads) { |
|
| 376 | + return $this->downloads; |
|
| 377 | + } |
|
| 336 | 378 | |
| 337 | 379 | $this->downloads = new DownloadHandler; |
| 338 | 380 | return $this->downloads(); |
@@ -345,7 +387,9 @@ discard block |
||
| 345 | 387 | */ |
| 346 | 388 | public function download($id) |
| 347 | 389 | { |
| 348 | - if ($this->download) return $this->download; |
|
| 390 | + if ($this->download) { |
|
| 391 | + return $this->download; |
|
| 392 | + } |
|
| 349 | 393 | |
| 350 | 394 | $this->download = new DownloadHandler($id); |
| 351 | 395 | return $this->download($id); |
@@ -358,7 +402,9 @@ discard block |
||
| 358 | 402 | */ |
| 359 | 403 | public function statements() |
| 360 | 404 | { |
| 361 | - if ($this->statements) return $this->statements; |
|
| 405 | + if ($this->statements) { |
|
| 406 | + return $this->statements; |
|
| 407 | + } |
|
| 362 | 408 | |
| 363 | 409 | $this->statements = new StatementHandler; |
| 364 | 410 | return $this->statements(); |
@@ -372,7 +418,9 @@ discard block |
||
| 372 | 418 | */ |
| 373 | 419 | public function statement($id = null) |
| 374 | 420 | { |
| 375 | - if ($this->statement) return $this->statement; |
|
| 421 | + if ($this->statement) { |
|
| 422 | + return $this->statement; |
|
| 423 | + } |
|
| 376 | 424 | |
| 377 | 425 | $this->statement = new StatementHandler($id ?? $id); |
| 378 | 426 | return $this->statement($id ?? $id); |
@@ -385,7 +433,9 @@ discard block |
||
| 385 | 433 | */ |
| 386 | 434 | public function statementForwarding($id = null) |
| 387 | 435 | { |
| 388 | - if ($this->statement_forwarding) return $this->statement_forwarding; |
|
| 436 | + if ($this->statement_forwarding) { |
|
| 437 | + return $this->statement_forwarding; |
|
| 438 | + } |
|
| 389 | 439 | |
| 390 | 440 | $this->statement_forwarding = new StatementForwardingHandler($id ?? $id); |
| 391 | 441 | return $this->statementForwarding($id ?? $id); |
@@ -399,7 +449,9 @@ discard block |
||
| 399 | 449 | */ |
| 400 | 450 | public function organisation($id) |
| 401 | 451 | { |
| 402 | - if ($this->organisation) return $this->organisation; |
|
| 452 | + if ($this->organisation) { |
|
| 453 | + return $this->organisation; |
|
| 454 | + } |
|
| 403 | 455 | |
| 404 | 456 | $this->organisation = new OrganisationHandler($id); |
| 405 | 457 | return $this->organisation($id); |
@@ -413,7 +465,9 @@ discard block |
||
| 413 | 465 | */ |
| 414 | 466 | public function visualisations() |
| 415 | 467 | { |
| 416 | - if ($this->visualisations) return $this->visualisations; |
|
| 468 | + if ($this->visualisations) { |
|
| 469 | + return $this->visualisations; |
|
| 470 | + } |
|
| 417 | 471 | |
| 418 | 472 | $this->visualisations = new VisualisationHandler; |
| 419 | 473 | return $this->visualisations(); |
@@ -427,7 +481,9 @@ discard block |
||
| 427 | 481 | */ |
| 428 | 482 | public function visualisation($id = null) |
| 429 | 483 | { |
| 430 | - if ($this->visualisation) return $this->visualisation; |
|
| 484 | + if ($this->visualisation) { |
|
| 485 | + return $this->visualisation; |
|
| 486 | + } |
|
| 431 | 487 | |
| 432 | 488 | $this->visualisation = new VisualisationHandler($id ? $id : null); |
| 433 | 489 | return $this->visualisation($id ? $id : null); |