| Conditions | 7 |
| Paths | 8 |
| Total Lines | 56 |
| Code Lines | 39 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 40 | public function build($globalMode = true) |
||
| 41 | { |
||
| 42 | $plugin = ImsLtiPlugin::create(); |
||
| 43 | $course = $this->tool->getCourse(); |
||
|
|
|||
| 44 | $parent = $this->tool->getParent(); |
||
| 45 | |||
| 46 | $this->addHeader($plugin->get_lang('ToolSettings')); |
||
| 47 | |||
| 48 | if (null !== $course && $globalMode) { |
||
| 49 | $this->addHtml( |
||
| 50 | Display::return_message( |
||
| 51 | sprintf($plugin->get_lang('ToolAddedOnCourseX'), $course->getTitle()), |
||
| 52 | 'normal', |
||
| 53 | false |
||
| 54 | ) |
||
| 55 | ); |
||
| 56 | } |
||
| 57 | |||
| 58 | $this->addText('name', get_lang('Name')); |
||
| 59 | $this->addTextarea('description', get_lang('Description')); |
||
| 60 | |||
| 61 | if (null === $parent) { |
||
| 62 | $this->addElement('url', 'launch_url', $plugin->get_lang('LaunchUrl')); |
||
| 63 | $this->addRule('launch_url', get_lang('Required'), 'required'); |
||
| 64 | $this->addText('consumer_key', $plugin->get_lang('ConsumerKey')); |
||
| 65 | $this->addText('shared_secret', $plugin->get_lang('SharedSecret')); |
||
| 66 | } |
||
| 67 | |||
| 68 | $this->addButtonAdvancedSettings('lti_adv'); |
||
| 69 | $this->addHtml('<div id="lti_adv_options" style="display:none;">'); |
||
| 70 | $this->addTextarea( |
||
| 71 | 'custom_params', |
||
| 72 | [$plugin->get_lang('CustomParams'), $plugin->get_lang('CustomParamsHelp')] |
||
| 73 | ); |
||
| 74 | |||
| 75 | if (null === $parent || |
||
| 76 | (null !== $parent && !$parent->isActiveDeepLinking()) |
||
| 77 | ) { |
||
| 78 | $this->addCheckBox( |
||
| 79 | 'deep_linking', |
||
| 80 | [null, $plugin->get_lang('SupportDeppLinkingHelp'), null], |
||
| 81 | $plugin->get_lang('SupportDeepLinking') |
||
| 82 | ); |
||
| 83 | } |
||
| 84 | |||
| 85 | $this->addHtml('</div>'); |
||
| 86 | $this->addButtonAdvancedSettings('lti_privacy', get_lang('Privacy')); |
||
| 87 | $this->addHtml('<div id="lti_privacy_options" style="display:none;">'); |
||
| 88 | $this->addCheckBox('share_name', null, $plugin->get_lang('ShareLauncherName')); |
||
| 89 | $this->addCheckBox('share_email', null, $plugin->get_lang('ShareLauncherEmail')); |
||
| 90 | $this->addCheckBox('share_picture', null, $plugin->get_lang('ShareLauncherPicture')); |
||
| 91 | $this->addHtml('</div>'); |
||
| 92 | $this->addButtonCreate($plugin->get_lang('EditExternalTool')); |
||
| 93 | $this->addHidden('id', $this->tool->getId()); |
||
| 94 | $this->addHidden('action', 'edit'); |
||
| 95 | $this->applyFilter('__ALL__', 'Security::remove_XSS'); |
||
| 96 | } |
||
| 116 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.