Skip to content

Commit

Permalink
Change PHP keywords to comply with PSR2
Browse files Browse the repository at this point in the history
Signed-off-by: CodeLingoBot <bot@codelingo.io>
  • Loading branch information
CodeLingoBot committed Apr 16, 2019
1 parent cd2d152 commit 7f7a6ce
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions index.php
Expand Up @@ -52,7 +52,7 @@
admin_externalpage_setup('tool_mergeusers_merge');

// Get possible posted params
$option = optional_param('option', NULL, PARAM_TEXT);
$option = optional_param('option', null, PARAM_TEXT);
if (!$option) {
if (optional_param('clearselection', false, PARAM_TEXT)) {
$option = 'clearselection';
Expand All @@ -79,10 +79,10 @@
// one or two users are selected: save them into session.
case 'saveselection':
//get and verify the userids from the selection form usig the verify_user function (second field is column)
list($olduser, $oumessage) = $mus->verify_user(optional_param('olduser', NULL, PARAM_INT), 'id');
list($newuser, $numessage) = $mus->verify_user(optional_param('newuser', NULL, PARAM_INT), 'id');
list($olduser, $oumessage) = $mus->verify_user(optional_param('olduser', null, PARAM_INT), 'id');
list($newuser, $numessage) = $mus->verify_user(optional_param('newuser', null, PARAM_INT), 'id');

if ($olduser === NULL && $newuser === NULL) {
if ($olduser === null && $newuser === null) {
$renderer->mu_error(get_string('no_saveselection', 'tool_mergeusers'));
exit(); // end execution for error
}
Expand Down Expand Up @@ -112,19 +112,19 @@

// remove any of the selected users to merge, and search for them again.
case 'clearselection':
$SESSION->mut = NULL;
$SESSION->mut = null;

// Redirect back to index/search page for new selections or review selections
$redirecturl = new moodle_url('/admin/tool/mergeusers/index.php');
redirect($redirecturl, NULL, 0);
redirect($redirecturl, null, 0);
break;

// proceed with the merging and show results.
case 'mergeusers':
// Verify users once more just to be sure. Both users should already be verified, but just an extra layer of security
list($fromuser, $oumessage) = $mus->verify_user($SESSION->mut->olduser->id, 'id');
list($touser, $numessage) = $mus->verify_user($SESSION->mut->newuser->id, 'id');
if ($fromuser === NULL || $touser === NULL) {
if ($fromuser === null || $touser === null) {
$renderer->mu_error($oumessage . '<br />' . $numessage);
break; // break execution for error
}
Expand All @@ -135,7 +135,7 @@
list($success, $log, $logid) = $mut->merge($touser->id, $fromuser->id);

// reset mut session
$SESSION->mut = NULL;
$SESSION->mut = null;

// render results page
echo $renderer->results_page($touser, $fromuser, $success, $log, $logid);
Expand Down Expand Up @@ -173,7 +173,7 @@
list($olduser, $oumessage) = $mus->verify_user($data->oldusergroup['olduserid'], $data->oldusergroup['olduseridtype']);
list($newuser, $numessage) = $mus->verify_user($data->newusergroup['newuserid'], $data->newusergroup['newuseridtype']);

if ($olduser === NULL || $newuser === NULL) {
if ($olduser === null || $newuser === null) {
$renderer->mu_error($oumessage . '<br />' . $numessage);
exit(); // end execution for error
}
Expand Down
2 changes: 1 addition & 1 deletion lib/mergeusersearch.php
Expand Up @@ -157,7 +157,7 @@ public function verify_user($uinfo, $column){
$user = $DB->get_record('user', array($column => $uinfo), '*', MUST_EXIST);
} catch (Exception $e) {
$message = get_string('invaliduser', 'tool_mergeusers'). '('.$column . '=>' . $uinfo .'): ' . $e->getMessage();
$user = NULL;
$user = null;
}

return array($user, $message);
Expand Down
4 changes: 2 additions & 2 deletions renderer.php
Expand Up @@ -101,7 +101,7 @@ public function build_progress_bar($step)
* @param UserSelectTable $ust table for users to merge after searching
* @return string html to show on index page.
*/
public function index_page(moodleform $mform, $step, UserSelectTable $ust = NULL)
public function index_page(moodleform $mform, $step, UserSelectTable $ust = null)
{
$output = $this->header();
$output .= $this->heading_with_help(get_string('mergeusers', 'tool_mergeusers'), 'header', 'tool_mergeusers');
Expand All @@ -115,7 +115,7 @@ public function index_page(moodleform $mform, $step, UserSelectTable $ust = NULL
case self::INDEX_PAGE_SEARCH_AND_SELECT_STEP:
$output .= $this->moodleform($mform);
// Render user select table if available
if ($ust !== NULL) {
if ($ust !== null) {
$this->page->requires->js_init_call('M.tool_mergeusers.init_select_table', array());
$output .= $this->render_user_select_table($ust);
}
Expand Down
2 changes: 1 addition & 1 deletion select_form.php
Expand Up @@ -34,7 +34,7 @@ class selectuserform extends moodleform {
/** @var UserSelectTable Table to select users. */
protected $ust;

public function __construct(UserSelectTable $ust = NULL)
public function __construct(UserSelectTable $ust = null)
{
//just before parent's construct
$this->ust = $ust;
Expand Down

0 comments on commit 7f7a6ce

Please sign in to comment.