MDL-62599 mod_lti: fix coding style issues
authorJake Dallimore <jake@moodle.com>
Wed, 8 May 2019 03:16:21 +0000 (11:16 +0800)
committerJake Dallimore <jake@moodle.com>
Wed, 8 May 2019 03:16:21 +0000 (11:16 +0800)
mod/lti/locallib.php
mod/lti/tests/locallib_test.php

index 72f2369..3bd9a2a 100644 (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)) {
index d2a5f6f..f79359a 100644 (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);
     }