MDL-62599 mod_lti: fix coding style issues

This commit is contained in:
Jake Dallimore
2019-05-08 11:16:21 +08:00
parent 7b3297d298
commit e61312afc9
2 changed files with 8 additions and 7 deletions
+4 -3
View File
@@ -3144,9 +3144,9 @@ function lti_convert_from_jwt($typeid, $jwtparam) {
if (!empty($value) && $mapping['isarray']) {
if (is_array($value)) {
if (is_array($value[0])) {
$value = json_encode($value);
$value = json_encode($value);
} else {
$value = implode(',', $value);
$value = implode(',', $value);
}
}
}
@@ -3262,7 +3262,8 @@ function lti_post_launch_html($newparms, $endpoint, $debug=false) {
* @param string $text Description of content item
* @return string
*/
function lti_initiate_login($courseid, $id, $instance, $config, $messagetype = 'basic-lti-launch-request', $title = '', $text = '') {
function lti_initiate_login($courseid, $id, $instance, $config, $messagetype = 'basic-lti-launch-request', $title = '',
$text = '') {
global $SESSION, $USER;
if (!empty($instance)) {
+4 -4
View File
@@ -1188,13 +1188,13 @@ MwIDAQAB
$objgraph->title = 'Test title';
$objgraph->text = 'Test text';
$objgraph->frame = [];
$objgraph->$strtype = 'LtiLinkItem';
$objgraph->{$strtype} = 'LtiLinkItem';
$objgraph->mediaType = 'application\/vnd.ims.lti.v1.ltilink';
$expected = new stdClass();
$expected->$strcontext = 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem';
$expected->$strgraph = [];
$expected->$strgraph[] = $objgraph;
$expected->{$strcontext} = 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem';
$expected->{$strgraph} = [];
$expected->{$strgraph}[] = $objgraph;
$this->assertEquals($expected, $jsondecode);
}