Skip to content

Commit 3bc565e

Browse files
committed
Minor: Format code
1 parent 5d7d728 commit 3bc565e

File tree

110 files changed

+676
-455
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+676
-455
lines changed

public/plugin/xapi/admin.php

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/* For licensing terms, see /license.txt */
46

57
use Chamilo\PluginBundle\Entity\XApi\LrsAuth;
8+
use Symfony\Component\HttpFoundation\Request;
69

710
$cidReset = true;
811

912
require_once __DIR__.'/../../main/inc/global.inc.php';
1013

1114
api_protect_admin_script();
1215

13-
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
16+
$request = Request::createFromGlobals();
1417
$plugin = XApiPlugin::create();
1518
$em = Database::getManager();
1619

@@ -19,11 +22,11 @@
1922
$pageContent = '';
2023

2124
/**
22-
* @throws \Exception
25+
* @return FormValidator
2326
*
24-
* @return \FormValidator
27+
* @throws Exception
2528
*/
26-
function createForm(LrsAuth $auth = null)
29+
function createForm(?LrsAuth $auth = null)
2730
{
2831
$pageBaseUrl = api_get_self();
2932

@@ -67,7 +70,8 @@ function createForm(LrsAuth $auth = null)
6770
->setEnabled(isset($values['enabled']))
6871
->setCreatedAt(
6972
api_get_utc_datetime(null, false, true)
70-
);
73+
)
74+
;
7175

7276
$em->persist($auth);
7377
$em->flush();
@@ -77,6 +81,7 @@ function createForm(LrsAuth $auth = null)
7781
);
7882

7983
header('Location: '.$pageBaseUrl);
84+
8085
exit;
8186
}
8287

@@ -85,7 +90,9 @@ function createForm(LrsAuth $auth = null)
8590
$pageBaseUrl
8691
);
8792
$pageContent = $form->returnForm();
93+
8894
break;
95+
8996
case 'edit':
9097
$auth = $em->find(LrsAuth::class, $request->query->getInt('id'));
9198

@@ -104,7 +111,8 @@ function createForm(LrsAuth $auth = null)
104111
->setEnabled(isset($values['enabled']))
105112
->setCreatedAt(
106113
api_get_utc_datetime(null, false, true)
107-
);
114+
)
115+
;
108116

109117
$em->persist($auth);
110118
$em->flush();
@@ -114,6 +122,7 @@ function createForm(LrsAuth $auth = null)
114122
);
115123

116124
header('Location: '.$pageBaseUrl);
125+
117126
exit;
118127
}
119128

@@ -122,7 +131,9 @@ function createForm(LrsAuth $auth = null)
122131
$pageBaseUrl
123132
);
124133
$pageContent = $form->returnForm();
134+
125135
break;
136+
126137
case 'delete':
127138
$auth = $em->find(LrsAuth::class, $request->query->getInt('id'));
128139

@@ -138,7 +149,9 @@ function createForm(LrsAuth $auth = null)
138149
);
139150

140151
header('Location: '.$pageBaseUrl);
152+
141153
exit;
154+
142155
case 'list':
143156
default:
144157
$pageActions = Display::url(
@@ -177,11 +190,12 @@ function createForm(LrsAuth $auth = null)
177190
$table->setCellContents($row, 1, $auth->getPassword());
178191
$table->setCellContents($row, 2, $auth->isEnabled() ? get_lang('Yes') : get_lang('No'));
179192
$table->setCellContents($row, 3, api_convert_and_format_date($auth->getCreatedAt()));
180-
$table->setCellContents($row, 4, implode(PHP_EOL, $actions));
193+
$table->setCellContents($row, 4, implode(\PHP_EOL, $actions));
181194
}
182195

183196
$pageContent = $table->toHtml();
184197
}
198+
185199
break;
186200
}
187201

public/plugin/xapi/cmi5/launch.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/* For licensing terms, see /license.txt */
46

57
use Chamilo\PluginBundle\Entity\XApi\Cmi5Item;
@@ -74,7 +76,8 @@
7476
api_get_setting('Institution').' - '.api_get_setting('siteName')
7577
)
7678
->withLanguage(api_get_language_isocode())
77-
->withRegistration($registration);
79+
->withRegistration($registration)
80+
;
7881

7982
$statementUuid = Uuid::uuid5(
8083
$plugin->get(XApiPlugin::SETTING_UUID_NAMESPACE),
@@ -95,17 +98,17 @@
9598

9699
$statementClient = XApiPlugin::create()->getXApiStatementClient();
97100

98-
//try {
101+
// try {
99102
// $statementClient->storeStatement($statement);
100-
//} catch (ConflictException $e) {
103+
// } catch (ConflictException $e) {
101104
// echo Display::return_message($e->getMessage(), 'error');
102105
//
103106
// exit;
104-
//} catch (XApiException $e) {
107+
// } catch (XApiException $e) {
105108
// echo Display::return_message($e->getMessage(), 'error');
106109
//
107110
// exit;
108-
//}
111+
// }
109112

110113
$viewSessionId = (string) Uuid::uuid4();
111114

@@ -146,7 +149,8 @@
146149
->getXApiStateClient()
147150
->createOrReplaceDocument(
148151
new StateDocument($state, $documentData)
149-
);
152+
)
153+
;
150154
} catch (Exception $exception) {
151155
echo Display::return_message($exception->getMessage(), 'error');
152156

public/plugin/xapi/cmi5/token.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/* For licensing terms, see /license.txt */
46

57
use Symfony\Component\HttpFoundation\JsonResponse;

public/plugin/xapi/cmi5/view.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/* For licensing terms, see /license.txt */
46

57
use Chamilo\PluginBundle\Entity\XApi\Cmi5Item;
@@ -25,6 +27,7 @@
2527
|| 'cmi5' !== $toolLaunch->getActivityType()
2628
) {
2729
header('Location: '.api_get_course_url());
30+
2831
exit;
2932
}
3033

@@ -42,7 +45,8 @@
4245
->from(Cmi5Item::class, 'item')
4346
->where('item.tool = :tool')
4447
->setParameter('tool', $toolLaunch->getId())
45-
->getQuery();
48+
->getQuery()
49+
;
4650

4751
$tocHtml = $itemsRepo->buildTree(
4852
$query->getArrayResult(),

public/plugin/xapi/cron/send_statements.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/* For licensing terms, see /license.txt */
46

57
use Chamilo\PluginBundle\Entity\XApi\SharedStatement;
@@ -12,11 +14,11 @@
1214

1315
require_once __DIR__.'/../../../main/inc/global.inc.php';
1416

15-
if (php_sapi_name() !== 'cli') {
17+
if (\PHP_SAPI !== 'cli') {
1618
exit;
1719
}
1820

19-
echo 'XAPI: Cron to send statements.'.PHP_EOL;
21+
echo 'XAPI: Cron to send statements.'.\PHP_EOL;
2022

2123
$em = Database::getManager();
2224
$serializer = Serializer::createSerializer();
@@ -28,11 +30,12 @@
2830
['uuid' => null, 'sent' => false],
2931
null,
3032
100
31-
);
33+
)
34+
;
3235
$countNotSent = count($notSentSharedStatements);
3336

3437
if ($countNotSent > 0) {
35-
echo '['.time().'] Trying to send '.$countNotSent.' statements to LRS'.PHP_EOL;
38+
echo '['.time().'] Trying to send '.$countNotSent.' statements to LRS'.\PHP_EOL;
3639

3740
$client = XApiPlugin::create()->getXapiStatementCronClient();
3841

@@ -55,25 +58,26 @@
5558

5659
echo "\t\tStatement ID received: \"{$sentStatement->getId()->getValue()}\"";
5760
} catch (ConflictException $e) {
58-
echo $e->getMessage().PHP_EOL;
61+
echo $e->getMessage().\PHP_EOL;
5962

6063
continue;
6164
} catch (XApiException $e) {
62-
echo $e->getMessage().PHP_EOL;
65+
echo $e->getMessage().\PHP_EOL;
6366

6467
continue;
6568
}
6669

6770
$notSentSharedStatement
6871
->setUuid($sentStatement->getId()->getValue())
69-
->setSent(true);
72+
->setSent(true)
73+
;
7074

7175
$em->persist($notSentSharedStatement);
7276

73-
echo "\t\tShared statement updated".PHP_EOL;
77+
echo "\t\tShared statement updated".\PHP_EOL;
7478
}
7579

7680
$em->flush();
7781
} else {
78-
echo 'No statements to process.'.PHP_EOL;
82+
echo 'No statements to process.'.\PHP_EOL;
7983
}

public/plugin/xapi/install.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/* For licensing terms, see /license.txt */
46

57
XApiPlugin::create()->install();

public/plugin/xapi/lang/english.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/* For licensing terms, see /license.txt */
46

57
$strings['plugin_title'] = 'Experience API (xAPI)';

public/plugin/xapi/lang/french.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/* For licensing terms, see /license.txt */
46

57
$strings['plugin_title'] = 'Experience API (xAPI)';

public/plugin/xapi/lang/spanish.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/* For licensing terms, see /license.txt */
46

57
$strings['plugin_title'] = 'Experience API (xAPI)';

public/plugin/xapi/lrs.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/* For licensing terms, see /license.txt */
46

57
use Chamilo\PluginBundle\XApi\Lrs\LrsRequest;

0 commit comments

Comments
 (0)