@@ -3,5 +3,5 @@ |
||
3 | 3 | namespace Ijeffro\Laralocker\LearningLocker\Personas; |
4 | 4 | |
5 | 5 | interface PersonaInterface { |
6 | - function get(); |
|
6 | + function get(); |
|
7 | 7 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | private $v2 = '/v2'; |
13 | 13 | |
14 | 14 | protected $headers = [ |
15 | - 'Content-Type' => 'application/json' |
|
15 | + 'Content-Type' => 'application/json' |
|
16 | 16 | ]; |
17 | 17 | |
18 | 18 | function __construct($id = null) { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | if ($this->app->runningInConsole()) { |
30 | 30 | $this->publishes([ |
31 | - __DIR__.'/../../publishable/config/laralocker.php' => config_path('laralocker.php'), |
|
31 | + __DIR__ . '/../../publishable/config/laralocker.php' => config_path('laralocker.php'), |
|
32 | 32 | ], 'config'); |
33 | 33 | |
34 | 34 | // Publishing the views. |
@@ -64,21 +64,21 @@ discard block |
||
64 | 64 | |
65 | 65 | |
66 | 66 | // Automatically apply the package configuration |
67 | - $this->mergeConfigFrom(__DIR__.'/../../publishable/config/laralocker.php', 'laralocker'); |
|
67 | + $this->mergeConfigFrom(__DIR__ . '/../../publishable/config/laralocker.php', 'laralocker'); |
|
68 | 68 | |
69 | 69 | |
70 | 70 | // Register the main class to use with the facade |
71 | - $this->app->bind('laralocker', function () { |
|
71 | + $this->app->bind('laralocker', function() { |
|
72 | 72 | return new Laralocker; |
73 | 73 | }); |
74 | 74 | |
75 | 75 | // Register the main class to use with the facade |
76 | - $this->app->bind('learninglocker', function () { |
|
76 | + $this->app->bind('learninglocker', function() { |
|
77 | 77 | return new LearningLocker; |
78 | 78 | }); |
79 | 79 | |
80 | 80 | // Register the main class to use with the facade |
81 | - $this->app->bind('xapi', function () { |
|
81 | + $this->app->bind('xapi', function() { |
|
82 | 82 | return new xAPI; |
83 | 83 | }); |
84 | 84 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | */ |
440 | 440 | public function routes() |
441 | 441 | { |
442 | - require __DIR__.'/../routes/laralocker.php'; |
|
442 | + require __DIR__ . '/../routes/laralocker.php'; |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | /** |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | break; |
492 | 492 | default: |
493 | 493 | |
494 | - $message = ["error" => "Please supply a Learning Locker model", "docs" => "http://docs.learninglocker.net/"]; |
|
494 | + $message = [ "error" => "Please supply a Learning Locker model", "docs" => "http://docs.learninglocker.net/" ]; |
|
495 | 495 | |
496 | 496 | return $message->toJosn(); |
497 | 497 | } |
@@ -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); |
@@ -484,7 +484,7 @@ |
||
484 | 484 | if ($this->learning_locker_api->check()) { |
485 | 485 | $this->info('Successfully connected to Learning Locker®'); |
486 | 486 | } else { |
487 | - return $this->error(' << Could not connect to Learning Locker® '); |
|
487 | + return $this->error(' << Could not connect to Learning Locker® '); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | } |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | class SetupClientommand extends Command |
15 | 15 | { |
16 | 16 | |
17 | - protected $seedersPath = __DIR__.'/../../publishable/database/seeds/'; |
|
18 | - protected $migrationsPath = __DIR__.'/../../publishable/database/migrations/'; |
|
17 | + protected $seedersPath = __DIR__ . '/../../publishable/database/seeds/'; |
|
18 | + protected $migrationsPath = __DIR__ . '/../../publishable/database/migrations/'; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * The console command name. |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | protected function getOptions() |
35 | 35 | { |
36 | 36 | return [ |
37 | - ['setup', null, InputOption::VALUE_NONE, 'Add new Learning Locker® Client', null], |
|
37 | + [ 'setup', null, InputOption::VALUE_NONE, 'Add new Learning Locker® Client', null ], |
|
38 | 38 | ]; |
39 | 39 | } |
40 | 40 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | elseif ($this->confirm("Setup a single client with database?")): |
160 | 160 | |
161 | - if($this->confirm("Add new columns to an existing database table?")) { |
|
161 | + if ($this->confirm("Add new columns to an existing database table?")) { |
|
162 | 162 | |
163 | 163 | $migratedDatabaseTables = \DB::connection()->getDoctrineSchemaManager()->listTableNames(); |
164 | 164 | $selectedTable = $this->anticipate("Which database table?", $migratedDatabaseTables); echo "\n"; |
@@ -166,16 +166,16 @@ discard block |
||
166 | 166 | $tableColumns = \Schema::getColumnListing($selectedTable); |
167 | 167 | |
168 | 168 | $this->line(ucfirst($selectedTable) . " Table"); echo "\n"; |
169 | - $this->table($tableColumns, []); |
|
169 | + $this->table($tableColumns, [ ]); |
|
170 | 170 | |
171 | 171 | $keyColumn = $this->anticipate("Which column for the Learning Locker client key?", $tableColumns); echo "\n"; |
172 | 172 | $secretColumn = $this->anticipate("Which column for the Learning Locker client secret?", $tableColumns); echo "\n"; |
173 | 173 | |
174 | - $headers = [$keyColumn, $secretColumn]; |
|
174 | + $headers = [ $keyColumn, $secretColumn ]; |
|
175 | 175 | |
176 | 176 | $key = str_random(10); |
177 | 177 | $secret = str_random(10); |
178 | - $tableColumns = [$key, $secret]; |
|
178 | + $tableColumns = [ $key, $secret ]; |
|
179 | 179 | |
180 | 180 | $this->table($headers, $tableColumns); |
181 | 181 | dd($tableColumns); |
@@ -187,17 +187,17 @@ discard block |
||
187 | 187 | $migrationsDirectory = database_path("/migrations/*"); |
188 | 188 | $migrationFiles = glob($migrationsDirectory); |
189 | 189 | |
190 | - $migrationFileNames = []; |
|
191 | - $addColumnMigrations = []; |
|
190 | + $migrationFileNames = [ ]; |
|
191 | + $addColumnMigrations = [ ]; |
|
192 | 192 | |
193 | 193 | //Loop through the array that glob returned. |
194 | - foreach($migrationFiles as $migrationFile) { |
|
194 | + foreach ($migrationFiles as $migrationFile) { |
|
195 | 195 | |
196 | - if(strpos($migrationFile, "add_learning_locker_client_to_$table")) { |
|
197 | - $addColumnMigrations[] = $migrationFile; |
|
196 | + if (strpos($migrationFile, "add_learning_locker_client_to_$table")) { |
|
197 | + $addColumnMigrations[ ] = $migrationFile; |
|
198 | 198 | } |
199 | 199 | |
200 | - $migrationFileNames[] = $migrationFile; |
|
200 | + $migrationFileNames[ ] = $migrationFile; |
|
201 | 201 | } |
202 | 202 | dd($addColumnMigrations); |
203 | 203 | |
@@ -216,23 +216,23 @@ discard block |
||
216 | 216 | break; |
217 | 217 | } |
218 | 218 | |
219 | - if(isset($addColumnMigrations) && count($addColumnMigrations) > 1) { |
|
219 | + if (isset($addColumnMigrations) && count($addColumnMigrations) > 1) { |
|
220 | 220 | |
221 | 221 | $this->question(" << You have " . count($addColumnMigrations) . " migrations which will add client credential columns to the $table table "); |
222 | 222 | |
223 | - if($this->confirm("Would you like to overwrite these files with the new database migration?")) { |
|
223 | + if ($this->confirm("Would you like to overwrite these files with the new database migration?")) { |
|
224 | 224 | |
225 | 225 | |
226 | - foreach($addColumnMigrations as $addColumnMigrations) { |
|
227 | - if(is_file($addColumnMigrations)) |
|
226 | + foreach ($addColumnMigrations as $addColumnMigrations) { |
|
227 | + if (is_file($addColumnMigrations)) |
|
228 | 228 | unlink($addColumnMigrations); //delete file |
229 | 229 | } |
230 | 230 | |
231 | - $makeMigration = $this->call("make:migration", ['name' => "add_learning_locker_client_to_$table"]); |
|
231 | + $makeMigration = $this->call("make:migration", [ 'name' => "add_learning_locker_client_to_$table" ]); |
|
232 | 232 | |
233 | - } elseif($this->confirm("Would you like to save the new database migration and keep existing migrations?")) { |
|
233 | + } elseif ($this->confirm("Would you like to save the new database migration and keep existing migrations?")) { |
|
234 | 234 | |
235 | - $makeMigration = $this->call("make:migration", ['name' => "add_learning_locker_client_to_$table"]); |
|
235 | + $makeMigration = $this->call("make:migration", [ 'name' => "add_learning_locker_client_to_$table" ]); |
|
236 | 236 | |
237 | 237 | } |
238 | 238 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $this->error(" << Client Setup Failed: Laralocker requires a Learning Locker url, client key and secret "); |
304 | 304 | $this->error(" << Docs: (https://docs.learninglocker.net/http-clients/) "); |
305 | 305 | |
306 | - if($this->confirm("Attempt to conigure client details?")) { |
|
306 | + if ($this->confirm("Attempt to conigure client details?")) { |
|
307 | 307 | $this->setupClient(); |
308 | 308 | } |
309 | 309 | |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | $domain = $this->anticipate("What's the new learning Locker url?", [ |
352 | 352 | 'https://saas.learninglocker.net', 'http://saas.learninglocker.net' |
353 | 353 | ]); |
354 | - $this->setEnv([strtoupper(LearningLockerConstants::URL) => $domain]); |
|
354 | + $this->setEnv([ strtoupper(LearningLockerConstants::URL) => $domain ]); |
|
355 | 355 | |
356 | 356 | $key = $this->ask("What's the new learning Locker client key?"); |
357 | - $this->setEnv([strtoupper(LearningLockerConstants::KEY) => $key]); |
|
357 | + $this->setEnv([ strtoupper(LearningLockerConstants::KEY) => $key ]); |
|
358 | 358 | |
359 | 359 | $secret = $this->secret("What's the new learning Locker client secret"); |
360 | - $this->setEnv([strtoupper(LearningLockerConstants::SECRET) => $secret]); |
|
360 | + $this->setEnv([ strtoupper(LearningLockerConstants::SECRET) => $secret ]); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | } else { |
@@ -370,14 +370,14 @@ discard block |
||
370 | 370 | $domain = $this->anticipate("What's the new learning Locker domain?", [ |
371 | 371 | 'https://saas.learninglocker.net', 'http://saas.learninglocker.net' |
372 | 372 | ]); |
373 | - $this->setEnv([strtoupper(LearningLockerConstants::URL) => $domain]); |
|
373 | + $this->setEnv([ strtoupper(LearningLockerConstants::URL) => $domain ]); |
|
374 | 374 | } |
375 | 375 | break; |
376 | 376 | case $url_has_variable_with_no_value: |
377 | 377 | $domain = $this->anticipate("What's your Learning Locker url?", [ |
378 | 378 | 'https://saas.learninglocker.net', 'http://saas.learninglocker.net' |
379 | 379 | ]); |
380 | - $this->setEnv([strtoupper(LearningLockerConstants::URL) => $domain]); |
|
380 | + $this->setEnv([ strtoupper(LearningLockerConstants::URL) => $domain ]); |
|
381 | 381 | break; |
382 | 382 | case $url_has_no_variable_and_no_value: |
383 | 383 | $domain = $this->anticipate("What's your Learning Locker url?", [ |
@@ -392,12 +392,12 @@ discard block |
||
392 | 392 | case $key_has_variable_and_value: |
393 | 393 | if ($this->confirm('Update Learning Locker client key?')) { |
394 | 394 | $key = $this->ask("What's the new learning Locker client key?"); |
395 | - $this->setEnv([strtoupper(LearningLockerConstants::KEY) => $key]); |
|
395 | + $this->setEnv([ strtoupper(LearningLockerConstants::KEY) => $key ]); |
|
396 | 396 | } |
397 | 397 | break; |
398 | 398 | case $key_has_variable_with_no_value: |
399 | 399 | $key = $this->ask("What's your Learning Locker client key?"); |
400 | - $this->setEnv([strtoupper(LearningLockerConstants::KEY) => $key]); |
|
400 | + $this->setEnv([ strtoupper(LearningLockerConstants::KEY) => $key ]); |
|
401 | 401 | break; |
402 | 402 | case $key_has_no_variable_and_no_value: |
403 | 403 | $key = $this->ask("What's your Learning Locker client key?"); |
@@ -410,12 +410,12 @@ discard block |
||
410 | 410 | case $secret_has_variable_and_value: |
411 | 411 | if ($this->confirm('Update Learning Locker client secret?')) { |
412 | 412 | $secret = $this->secret("What's the new learning Locker client secret"); |
413 | - $this->setEnv([strtoupper(LearningLockerConstants::KEY) => $key]); |
|
413 | + $this->setEnv([ strtoupper(LearningLockerConstants::KEY) => $key ]); |
|
414 | 414 | } |
415 | 415 | break; |
416 | 416 | case $secret_has_variable_with_no_value: |
417 | 417 | $secret = $this->secret("What's your Learning Locker client secret"); |
418 | - $this->setEnv([strtoupper(LearningLockerConstants::KEY) => $secret]); |
|
418 | + $this->setEnv([ strtoupper(LearningLockerConstants::KEY) => $secret ]); |
|
419 | 419 | break; |
420 | 420 | case $secret_has_no_variable_and_no_value: |
421 | 421 | $secret = $this->secret("What's your Learning Locker client secret"); |
@@ -450,8 +450,8 @@ discard block |
||
450 | 450 | */ |
451 | 451 | protected function findComposer() |
452 | 452 | { |
453 | - if (file_exists(getcwd().'/composer.phar')) { |
|
454 | - return '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
|
453 | + if (file_exists(getcwd() . '/composer.phar')) { |
|
454 | + return '"' . PHP_BINARY . '" ' . getcwd() . '/composer.phar'; |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | return 'composer'; |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | |
473 | 473 | public function publishVendor() |
474 | 474 | { |
475 | - $tags = ['config']; |
|
476 | - $this->call('vendor:publish', ['--provider' => LaraLockerServiceProvider::class, '--tag' => $tags]); |
|
475 | + $tags = [ 'config' ]; |
|
476 | + $this->call('vendor:publish', [ '--provider' => LaraLockerServiceProvider::class, '--tag' => $tags ]); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | public function checkLearningLockerConnection() |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | foreach ($variables as $variable) { |
522 | 522 | $env_variable = $this->getEnv($variable); |
523 | 523 | $contents = file_get_contents($env); |
524 | - $contents = str_replace(strtoupper($variable) . '=' . $env_variable, strtoupper($variable) . '=' . $data[$variable], $contents); |
|
524 | + $contents = str_replace(strtoupper($variable) . '=' . $env_variable, strtoupper($variable) . '=' . $data[ $variable ], $contents); |
|
525 | 525 | file_put_contents($env, $contents); |
526 | 526 | } |
527 | 527 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | $env_contents = $filesystem->get($env); |
542 | 542 | |
543 | 543 | if (false === strpos($env_contents, $key)) { |
544 | - $filesystem->append($env, "\n" . strtoupper($key) . '=' . strtolower($value)); |
|
544 | + $filesystem->append($env, "\n" . strtoupper($key) . '=' . strtolower($value)); |
|
545 | 545 | return $this->info("Created Environment variable $value successfully."); |
546 | 546 | } |
547 | 547 | } |
@@ -87,12 +87,11 @@ discard block |
||
87 | 87 | |
88 | 88 | } else { |
89 | 89 | $this->error(" << Not sure of any other way to to setup an single client in an existing database"); |
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - else: |
|
90 | + } else { |
|
91 | + : |
|
94 | 92 | |
95 | 93 | $this->error(" << Unable to setup client credentials for Learning Locker® "); |
94 | + } |
|
96 | 95 | |
97 | 96 | if ($this->confirm("Would you like to run through the client setup again?")) { |
98 | 97 | return $this->setupClient(); |
@@ -122,13 +121,7 @@ discard block |
||
122 | 121 | |
123 | 122 | } else { |
124 | 123 | $this->error(" << Not sure of any other way to to setup an single client in an existing database"); |
125 | - } |
|
126 | - |
|
127 | - |
|
128 | - |
|
129 | - |
|
130 | - |
|
131 | - elseif ($this->confirm("Setup multiply Learning Locker® clients in the database?")): |
|
124 | + } elseif ($this->confirm("Setup multiply Learning Locker® clients in the database?")): |
|
132 | 125 | |
133 | 126 | |
134 | 127 | |
@@ -141,13 +134,10 @@ discard block |
||
141 | 134 | |
142 | 135 | } else { |
143 | 136 | $this->error(" << Not sure of any other way to to setup an single client in an existing database"); |
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - |
|
148 | - |
|
149 | - else: |
|
137 | + } else { |
|
138 | + : |
|
150 | 139 | $this->error(" << Not sure of any other way to to setup an single client in an existing database"); |
140 | + } |
|
151 | 141 | |
152 | 142 | if ($this->confirm("Would you like to run through the setup process again?")) { |
153 | 143 | } |
@@ -224,8 +214,10 @@ discard block |
||
224 | 214 | |
225 | 215 | |
226 | 216 | foreach($addColumnMigrations as $addColumnMigrations) { |
227 | - if(is_file($addColumnMigrations)) |
|
228 | - unlink($addColumnMigrations); //delete file |
|
217 | + if(is_file($addColumnMigrations)) { |
|
218 | + unlink($addColumnMigrations); |
|
219 | + } |
|
220 | + //delete file |
|
229 | 221 | } |
230 | 222 | |
231 | 223 | $makeMigration = $this->call("make:migration", ['name' => "add_learning_locker_client_to_$table"]); |
@@ -293,14 +285,14 @@ discard block |
||
293 | 285 | dump("Single client in the database"); |
294 | 286 | } else { |
295 | 287 | dump("Single client in the database"); |
296 | - } |
|
297 | - |
|
298 | - elseif ($this->confirm("Setup multiple Learning Locker client's with database?")): |
|
288 | + } elseif ($this->confirm("Setup multiple Learning Locker client's with database?")): |
|
299 | 289 | dump("database setup"); |
300 | 290 | |
301 | - else: |
|
291 | + else { |
|
292 | + : |
|
302 | 293 | |
303 | 294 | $this->error(" << Client Setup Failed: Laralocker requires a Learning Locker url, client key and secret "); |
295 | + } |
|
304 | 296 | $this->error(" << Docs: (https://docs.learninglocker.net/http-clients/) "); |
305 | 297 | |
306 | 298 | if($this->confirm("Attempt to conigure client details?")) { |
@@ -307,7 +307,7 @@ |
||
307 | 307 | if ($this->learning_locker_api->check()) { |
308 | 308 | $this->info('Successfully connected to Learning Locker®'); |
309 | 309 | } else { |
310 | - return $this->error(' << Could not connect to Learning Locker® '); |
|
310 | + return $this->error(' << Could not connect to Learning Locker® '); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | } |
@@ -119,12 +119,12 @@ |
||
119 | 119 | case self::CHANNELS_ROUTE: |
120 | 120 | $this->addLearningLockerRouting($filesystem, self::CHANNELS_ROUTE); |
121 | 121 | break; |
122 | - default: |
|
123 | - $this->error('Could not find the Laravel route file...'); echo "\n"; |
|
122 | + default: |
|
123 | + $this->error('Could not find the Laravel route file...'); echo "\n"; |
|
124 | 124 | |
125 | - if ($this->confirm("Would you like to try again?", true)) { |
|
126 | - return $this->setupLaravelRouting($filesystem); |
|
127 | - } |
|
125 | + if ($this->confirm("Would you like to try again?", true)) { |
|
126 | + return $this->setupLaravelRouting($filesystem); |
|
127 | + } |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | } |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | const CONSOLE_ROUTE = 'console.php'; |
41 | 41 | const CHANNELS_ROUTE = 'channels.php'; |
42 | 42 | |
43 | - protected $seedersPath = __DIR__.'/../../publishable/database/seeds/'; |
|
44 | - protected $migrationsPath = __DIR__.'/../../publishable/database/migrations/'; |
|
43 | + protected $seedersPath = __DIR__ . '/../../publishable/database/seeds/'; |
|
44 | + protected $migrationsPath = __DIR__ . '/../../publishable/database/migrations/'; |
|
45 | 45 | |
46 | 46 | protected function getOptions() |
47 | 47 | { |
48 | 48 | return [ |
49 | - ['client', null, InputOption::VALUE_NONE, 'Setup a Learning Locker® Client', null], |
|
50 | - ['routes', null, InputOption::VALUE_NONE, 'Setup a Learning Locker® Endpooints', null], |
|
49 | + [ 'client', null, InputOption::VALUE_NONE, 'Setup a Learning Locker® Client', null ], |
|
50 | + [ 'routes', null, InputOption::VALUE_NONE, 'Setup a Learning Locker® Endpooints', null ], |
|
51 | 51 | ]; |
52 | 52 | } |
53 | 53 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | |
134 | 134 | public function setupLearningLockerClient() { |
135 | - return $this->call('learninglocker:client', ['--setup' => true]); |
|
135 | + return $this->call('learninglocker:client', [ '--setup' => true ]); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -173,13 +173,13 @@ discard block |
||
173 | 173 | $domain = $this->anticipate("What's the new Learning Locker® url?", [ |
174 | 174 | 'https://saas.learninglocker.net', 'http://saas.learninglocker.net' |
175 | 175 | ]); |
176 | - $this->setEnv([strtoupper(LearningLockerConstants::URL) => $domain]); |
|
176 | + $this->setEnv([ strtoupper(LearningLockerConstants::URL) => $domain ]); |
|
177 | 177 | |
178 | 178 | $key = $this->ask("What's the new Learning Locker® client key?"); |
179 | - $this->setEnv([strtoupper(LearningLockerConstants::KEY) => $key]); |
|
179 | + $this->setEnv([ strtoupper(LearningLockerConstants::KEY) => $key ]); |
|
180 | 180 | |
181 | 181 | $secret = $this->secret("What's the new Learning Locker® client secret"); |
182 | - $this->setEnv([strtoupper(LearningLockerConstants::SECRET) => $secret]); |
|
182 | + $this->setEnv([ strtoupper(LearningLockerConstants::SECRET) => $secret ]); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | } else { |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | $domain = $this->anticipate("What's the new Learning Locker® domain?", [ |
193 | 193 | 'https://saas.learninglocker.net', 'http://saas.learninglocker.net' |
194 | 194 | ]); |
195 | - $this->setEnv([strtoupper(LearningLockerConstants::URL) => $domain]); |
|
195 | + $this->setEnv([ strtoupper(LearningLockerConstants::URL) => $domain ]); |
|
196 | 196 | } |
197 | 197 | break; |
198 | 198 | case $url_has_variable_with_no_value: |
199 | 199 | $domain = $this->anticipate("What's your Learning Locker® url?", [ |
200 | 200 | 'https://saas.learninglocker.net', 'http://saas.learninglocker.net' |
201 | 201 | ]); |
202 | - $this->setEnv([strtoupper(LearningLockerConstants::URL) => $domain]); |
|
202 | + $this->setEnv([ strtoupper(LearningLockerConstants::URL) => $domain ]); |
|
203 | 203 | break; |
204 | 204 | case $url_has_no_variable_and_no_value: |
205 | 205 | $domain = $this->anticipate("What's your Learning Locker® url?", [ |
@@ -214,12 +214,12 @@ discard block |
||
214 | 214 | case $key_has_variable_and_value: |
215 | 215 | if ($this->confirm('Update Learning Locker® client key?')) { |
216 | 216 | $key = $this->ask("What's the new Learning Locker® client key?"); |
217 | - $this->setEnv([strtoupper(LearningLockerConstants::KEY) => $key]); |
|
217 | + $this->setEnv([ strtoupper(LearningLockerConstants::KEY) => $key ]); |
|
218 | 218 | } |
219 | 219 | break; |
220 | 220 | case $key_has_variable_with_no_value: |
221 | 221 | $key = $this->ask("What's your Learning Locker® client key?"); |
222 | - $this->setEnv([strtoupper(LearningLockerConstants::KEY) => $key]); |
|
222 | + $this->setEnv([ strtoupper(LearningLockerConstants::KEY) => $key ]); |
|
223 | 223 | break; |
224 | 224 | case $key_has_no_variable_and_no_value: |
225 | 225 | $key = $this->ask("What's your Learning Locker® client key?"); |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | case $secret_has_variable_and_value: |
233 | 233 | if ($this->confirm('Update Learning Locker® client secret?')) { |
234 | 234 | $secret = $this->secret("What's the new Learning Locker® client secret"); |
235 | - $this->setEnv([strtoupper(LearningLockerConstants::KEY) => $key]); |
|
235 | + $this->setEnv([ strtoupper(LearningLockerConstants::KEY) => $key ]); |
|
236 | 236 | } |
237 | 237 | break; |
238 | 238 | case $secret_has_variable_with_no_value: |
239 | 239 | $secret = $this->secret("What's your Learning Locker® client secret"); |
240 | - $this->setEnv([strtoupper(LearningLockerConstants::KEY) => $secret]); |
|
240 | + $this->setEnv([ strtoupper(LearningLockerConstants::KEY) => $secret ]); |
|
241 | 241 | break; |
242 | 242 | case $secret_has_no_variable_and_no_value: |
243 | 243 | $secret = $this->secret("What's your Learning Locker® client secret"); |
@@ -272,8 +272,8 @@ discard block |
||
272 | 272 | */ |
273 | 273 | protected function findComposer() |
274 | 274 | { |
275 | - if (file_exists(getcwd().'/composer.phar')) { |
|
276 | - return '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
|
275 | + if (file_exists(getcwd() . '/composer.phar')) { |
|
276 | + return '"' . PHP_BINARY . '" ' . getcwd() . '/composer.phar'; |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | return 'composer'; |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | |
296 | 296 | public function publishVendor() |
297 | 297 | { |
298 | - $tags = ['config']; |
|
299 | - $this->call('vendor:publish', ['--provider' => LaraLockerServiceProvider::class, '--tag' => $tags]); |
|
298 | + $tags = [ 'config' ]; |
|
299 | + $this->call('vendor:publish', [ '--provider' => LaraLockerServiceProvider::class, '--tag' => $tags ]); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | public function checkLearningLockerConnection() |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | foreach ($variables as $variable) { |
345 | 345 | $env_variable = $this->getEnv($variable); |
346 | 346 | $contents = file_get_contents($env); |
347 | - $contents = str_replace(strtoupper($variable) . '=' . $env_variable, strtoupper($variable) . '=' . $data[$variable], $contents); |
|
347 | + $contents = str_replace(strtoupper($variable) . '=' . $env_variable, strtoupper($variable) . '=' . $data[ $variable ], $contents); |
|
348 | 348 | file_put_contents($env, $contents); |
349 | 349 | } |
350 | 350 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $env_contents = $filesystem->get($env); |
365 | 365 | |
366 | 366 | if (false === strpos($env_contents, $key)) { |
367 | - $filesystem->append($env, "\n" . strtoupper($key) . '=' . strtolower($value)); |
|
367 | + $filesystem->append($env, "\n" . strtoupper($key) . '=' . strtolower($value)); |
|
368 | 368 | return $this->info("Created Environment variable $value successfully."); |
369 | 369 | } |
370 | 370 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function show($id) |
27 | 27 | { |
28 | - $select = ["_id"]; |
|
28 | + $select = [ "_id" ]; |
|
29 | 29 | return LearningLocker::client($id)->get($select); |
30 | 30 | } |
31 | 31 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function show($id) |
27 | 27 | { |
28 | - $selectables = ["_id"]; |
|
28 | + $selectables = [ "_id" ]; |
|
29 | 29 | return LearningLocker::store($id)->get($selectables); |
30 | 30 | } |
31 | 31 |
@@ -133,7 +133,7 @@ |
||
133 | 133 | */ |
134 | 134 | public function store() |
135 | 135 | { |
136 | - $this->send = $this->send( |
|
136 | + $this->send = $this->send( |
|
137 | 137 | $this->actor, |
138 | 138 | $this->verb, |
139 | 139 | $this->object, |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @param $homepage = Account Homepage |
29 | 29 | * |
30 | 30 | */ |
31 | - public function actor($actor = [], $ref = null, $homepage = null) |
|
31 | + public function actor($actor = [ ], $ref = null, $homepage = null) |
|
32 | 32 | { |
33 | 33 | if (!$actor) return error('Please supply an actor'); |
34 | 34 | |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | |
38 | 38 | if ($actor_type === xAPIConstants::MBOX) { |
39 | 39 | |
40 | - if ($actor['name'] && $actor['email']) { |
|
41 | - $authority = StatementGenerator::createAuthority($actor['name'], $actor['email']); |
|
42 | - $actor = StatementGenerator::createMboxActor($actor['name'], $actor['email']); |
|
40 | + if ($actor[ 'name' ] && $actor[ 'email' ]) { |
|
41 | + $authority = StatementGenerator::createAuthority($actor[ 'name' ], $actor[ 'email' ]); |
|
42 | + $actor = StatementGenerator::createMboxActor($actor[ 'name' ], $actor[ 'email' ]); |
|
43 | 43 | // dd($authority); |
44 | 44 | } else { |
45 | 45 | return error('Please supply the actor\'s name and email in the form of an array.'); |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | |
48 | 48 | |
49 | 49 | // $this->agent->setAuthority($authority); |
50 | - $this->agent->setName($actor['name']); |
|
51 | - $this->agent->setMbox($actor['mbox']); |
|
50 | + $this->agent->setName($actor[ 'name' ]); |
|
51 | + $this->agent->setMbox($actor[ 'mbox' ]); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | // if ($actor_type === xAPIConstants::ACCOUNT && $actor) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | isset($this->result) ? $this->result : null |
119 | 119 | ); |
120 | 120 | |
121 | - $this->make = []; |
|
121 | + $this->make = [ ]; |
|
122 | 122 | $this->make = $this->statement; |
123 | 123 | return $this->make; |
124 | 124 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | ); |
144 | 144 | |
145 | 145 | // $this->send = []; |
146 | - $this->send =$this->send; |
|
146 | + $this->send = $this->send; |
|
147 | 147 | return $this->send; |
148 | 148 | |
149 | 149 | } |
@@ -30,7 +30,9 @@ |
||
30 | 30 | */ |
31 | 31 | public function actor($actor = [], $ref = null, $homepage = null) |
32 | 32 | { |
33 | - if (!$actor) return error('Please supply an actor'); |
|
33 | + if (!$actor) { |
|
34 | + return error('Please supply an actor'); |
|
35 | + } |
|
34 | 36 | |
35 | 37 | $this->agent = new Agent; |
36 | 38 | $actor_type = Config::get('laralocker.learning_locker.xapi_statements.actor_type'); |