Skip to content

Commit

Permalink
Replace array syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Laur0r committed May 23, 2024
1 parent c0aa3b6 commit f6d78b2
Show file tree
Hide file tree
Showing 62 changed files with 779 additions and 770 deletions.
10 changes: 5 additions & 5 deletions backup/moodle2/backup_ratingallocate_activity_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ protected function define_structure() {

// Define sources.
$ratingallocate->set_source_table(get_tablename_for_tableClass('ratingallocate\db\ratingallocate'),
array(this_db\ratingallocate::ID => backup::VAR_ACTIVITYID), this_db\ratingallocate_choices::ID . ' ASC');
[this_db\ratingallocate::ID => backup::VAR_ACTIVITYID], this_db\ratingallocate_choices::ID . ' ASC');
$ratingallocatechoice->set_source_table(get_tablename_for_tableClass('ratingallocate\db\ratingallocate_choices'),
array(this_db\ratingallocate_choices::RATINGALLOCATEID => backup::VAR_PARENTID),
[this_db\ratingallocate_choices::RATINGALLOCATEID => backup::VAR_PARENTID],
this_db\ratingallocate_choices::ID . ' ASC');
$groupchoice->set_source_table(get_tablename_for_tableClass($groupchoiceclass), ['choiceid' => backup::VAR_PARENTID]);
$ratingallocatechoicegroup->set_source_table(
Expand All @@ -106,13 +106,13 @@ protected function define_structure() {
if ($userinfo) {
$ratingallocaterating->set_source_table(get_tablename_for_tableClass(
'ratingallocate\db\ratingallocate_ratings'),
array(this_db\ratingallocate_ratings::CHOICEID => backup::VAR_PARENTID),
[this_db\ratingallocate_ratings::CHOICEID => backup::VAR_PARENTID],
this_db\ratingallocate_ratings::ID . ' ASC');
$ratingallocateallocation->set_source_table(
get_tablename_for_tableClass('ratingallocate\db\ratingallocate_allocations'),
array(
[
this_db\ratingallocate_allocations::RATINGALLOCATEID => backup::VAR_ACTIVITYID,
this_db\ratingallocate_allocations::CHOICEID => backup::VAR_PARENTID),
this_db\ratingallocate_allocations::CHOICEID => backup::VAR_PARENTID],
this_db\ratingallocate_allocations::ID . ' ASC'
);
}
Expand Down
6 changes: 3 additions & 3 deletions backup/moodle2/backup_restore_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
function get_fields_for_tableclass($class) {
$class = new ReflectionClass($class);
$constants = $class->getConstants();
$keystoremove = array('ID', 'TABLE');
$keystoremove = ['ID', 'TABLE'];
foreach ($constants as $key => $value) {
if (count(array_intersect(array($key), $keystoremove)) > 0) {
if (count(array_intersect([$key], $keystoremove)) > 0) {
unset($constants[$key]);
}
}
Expand All @@ -42,5 +42,5 @@ function get_tablename_for_tableclass($class) {
function get_id_for_tableclass($class) {
$class = new ReflectionClass($class);
$constants = $class->getConstants();
return array($constants['ID']);
return [$constants['ID']];
}
8 changes: 4 additions & 4 deletions backup/moodle2/restore_ratingallocate_activity_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function define_my_steps() {
* processed by the link decoder
*/
public static function define_decode_contents() {
$contents = array();
$contents = [];

return $contents;
}
Expand All @@ -59,7 +59,7 @@ public static function define_decode_contents() {
* to the activity to be executed by the link decoder
*/
public static function define_decode_rules() {
$rules = array();
$rules = [];

return $rules;
}
Expand All @@ -72,7 +72,7 @@ public static function define_decode_rules() {
* of {@link restore_log_rule} objects
*/
public static function define_restore_log_rules() {
$rules = array();
$rules = [];

return $rules;
}
Expand All @@ -89,7 +89,7 @@ public static function define_restore_log_rules() {
* activity level. All them are rules not linked to any module instance (cmid = 0)
*/
public static function define_restore_log_rules_for_course() {
$rules = array();
$rules = [];
return $rules;
}
}
8 changes: 4 additions & 4 deletions classes/allocations_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct($ratingallocate) {
parent::__construct('mod_ratingallocate_allocation_table');
global $PAGE;
$url = $PAGE->url;
$url->params(array("action" => ACTION_SHOW_ALLOCATION_TABLE));
$url->params(["action" => ACTION_SHOW_ALLOCATION_TABLE]);
$PAGE->set_url($url);
$this->ratingallocate = $ratingallocate;
if (has_capability('mod/ratingallocate:export_ratings', $ratingallocate->get_context())) {
Expand Down Expand Up @@ -203,10 +203,10 @@ private function get_user_link($user) {
$name = fullname($user);

if ($COURSE->id == SITEID) {
$profileurl = new \moodle_url('/user/profile.php', array('id' => $user->id));
$profileurl = new \moodle_url('/user/profile.php',['id' => $user->id]);
} else {
$profileurl = new \moodle_url('/user/view.php',
array('id' => $user->id, 'course' => $COURSE->id));
['id' => $user->id, 'course' => $COURSE->id]);
}
return \html_writer::link($profileurl, $name);
}
Expand All @@ -229,7 +229,7 @@ public function init_sql() {

$where = "c.ratingallocateid = :ratingallocateid";

$params = array();
$params =[];
$params['ratingallocateid'] = $this->ratingallocate->ratingallocate->id;

$this->set_sql($fields, $from, $where, $params);
Expand Down
10 changes: 5 additions & 5 deletions classes/choice_importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


class choice_importer {
const REQUIRED_FIELDS = array("title", "explanation", "maxsize", "active", "groups");
const REQUIRED_FIELDS = ["title", "explanation", "maxsize", "active", "groups"];

// The import process worked as expected.
const IMPORT_STATUS_OK = 'csvupload_ok';
Expand Down Expand Up @@ -122,7 +122,7 @@ public function import($content, $live=true) {
$importstatus = new \stdClass;
$importstatus->status = self::IMPORT_STATUS_OK; // Unless we hear otherwise.
$importstatus->live = $live; // Only commit live transactions.
$importstatus->errors = array();
$importstatus->errors = [];
$importstatus->importcount = 0;
$importstatus->rowcount = 1; // Start at 1 for header.

Expand Down Expand Up @@ -183,7 +183,7 @@ public function import($content, $live=true) {
}

if ($fieldname == 'groups') {
$groups = array();
$groups = [];

// Turn off 'usegroups' if no groups specified.
if (empty(trim($cell))) {
Expand Down Expand Up @@ -229,10 +229,10 @@ public function import($content, $live=true) {
// Note for warnings.
if (!empty($invalidgroups)) {
$importstatus->status = self::IMPORT_STATUS_DATA_ERROR;
$warningmessage = get_string('csvupload_missing_groups', 'ratingallocate', array(
$warningmessage = get_string('csvupload_missing_groups', 'ratingallocate', [
'row' => $importstatus->rowcount,
'invalidgroups' => join(', ', $invalidgroups),
));
]);
$importstatus->errors[] = $warningmessage;
}

Expand Down
8 changes: 4 additions & 4 deletions classes/event/all_ratings_deleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
class all_ratings_deleted extends \core\event\base {

public static function create_simple($modulecontext, $ratingallocateid) {
return self::create(array('context' => $modulecontext, 'objectid' => $ratingallocateid));
return self::create(['context' => $modulecontext, 'objectid' => $ratingallocateid]);
}
protected function init() {
$this->data['crud'] = 'd';
Expand All @@ -46,15 +46,15 @@ public static function get_name() {

public function get_description() {
return get_string('log_all_ratings_deleted_description', 'mod_ratingallocate',
array('userid' => $this->userid, 'ratingallocateid' => $this->objectid));
['userid' => $this->userid, 'ratingallocateid' => $this->objectid]);
}

public function get_url() {
return new \moodle_url('/mod/ratingallocate/view.php', array('m' => $this->objectid));
return new \moodle_url('/mod/ratingallocate/view.php', ['m' => $this->objectid]);
}

public static function get_objectid_mapping() {
return array('db' => 'ratingallocate', 'restore' => 'ratingallocate');
return ['db' => 'ratingallocate', 'restore' => 'ratingallocate'];
}

public static function get_other_mapping() {
Expand Down
8 changes: 4 additions & 4 deletions classes/event/allocation_published.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
class allocation_published extends \core\event\base {

public static function create_simple($modulecontext, $ratingallocateid) {
return self::create(array('context' => $modulecontext, 'objectid' => $ratingallocateid));
return self::create(['context' => $modulecontext, 'objectid' => $ratingallocateid]);
}

protected function init() {
Expand All @@ -55,15 +55,15 @@ public static function get_name() {

public function get_description() {
return get_string('log_allocation_published_description', 'mod_ratingallocate',
array('userid' => $this->userid, 'ratingallocateid' => $this->objectid));
['userid' => $this->userid, 'ratingallocateid' => $this->objectid]);
}

public function get_url() {
return new \moodle_url('/mod/ratingallocate/view.php', array('m' => $this->objectid));
return new \moodle_url('/mod/ratingallocate/view.php', ['m' => $this->objectid]);
}

public static function get_objectid_mapping() {
return array('db' => 'ratingallocate', 'restore' => 'ratingallocate');
return ['db' => 'ratingallocate', 'restore' => 'ratingallocate'];
}

public static function get_other_mapping() {
Expand Down
8 changes: 4 additions & 4 deletions classes/event/allocation_statistics_viewed.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
class allocation_statistics_viewed extends \core\event\base {

public static function create_simple($modulecontext, $ratingallocateid) {
return self::create(array('context' => $modulecontext, 'objectid' => $ratingallocateid));
return self::create(['context' => $modulecontext, 'objectid' => $ratingallocateid]);
}

protected function init() {
Expand All @@ -49,15 +49,15 @@ public static function get_name() {

public function get_description() {
return get_string('log_allocation_statistics_viewed_description', 'mod_ratingallocate',
array('userid' => $this->userid, 'ratingallocateid' => $this->objectid));
['userid' => $this->userid, 'ratingallocateid' => $this->objectid]);
}

public function get_url() {
return new \moodle_url('/mod/ratingallocate/view.php', array('m' => $this->objectid));
return new \moodle_url('/mod/ratingallocate/view.php', ['m' => $this->objectid]);
}

public static function get_objectid_mapping() {
return array('db' => 'ratingallocate', 'restore' => 'ratingallocate');
return ['db' => 'ratingallocate', 'restore' => 'ratingallocate'];
}

public static function get_other_mapping() {
Expand Down
8 changes: 4 additions & 4 deletions classes/event/allocation_table_viewed.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
class allocation_table_viewed extends \core\event\base {

public static function create_simple($modulecontext, $ratingallocateid) {
return self::create(array('context' => $modulecontext, 'objectid' => $ratingallocateid));
return self::create(['context' => $modulecontext, 'objectid' => $ratingallocateid]);
}

protected function init() {
Expand All @@ -49,15 +49,15 @@ public static function get_name() {

public function get_description() {
return get_string('log_allocation_table_viewed_description', 'mod_ratingallocate',
array('userid' => $this->userid, 'ratingallocateid' => $this->objectid));
['userid' => $this->userid, 'ratingallocateid' => $this->objectid]);
}

public function get_url() {
return new \moodle_url('/mod/ratingallocate/view.php', array('m' => $this->objectid));
return new \moodle_url('/mod/ratingallocate/view.php', ['m' => $this->objectid]);
}

public static function get_objectid_mapping() {
return array('db' => 'ratingallocate', 'restore' => 'ratingallocate');
return ['db' => 'ratingallocate', 'restore' => 'ratingallocate'];
}

public static function get_other_mapping() {
Expand Down
12 changes: 6 additions & 6 deletions classes/event/distribution_triggered.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class distribution_triggered extends \core\event\base {

public static function create_simple($modulecontext, $ratingallocateid, $timeneeded) {
$timeneededjsonvalid = json_decode(json_encode($timeneeded), true);
return self::create(array('context' => $modulecontext, 'objectid' => $ratingallocateid,
'other' => array('time_needed' => $timeneededjsonvalid)));
return self::create(['context' => $modulecontext, 'objectid' => $ratingallocateid,
'other' => ['time_needed' => $timeneededjsonvalid]]);
}

protected function init() {
Expand All @@ -58,17 +58,17 @@ public static function get_name() {

public function get_description() {
return get_string('log_distribution_triggered_description', 'mod_ratingallocate',
array('userid' => $this->userid,
['userid' => $this->userid,
'ratingallocateid' => $this->objectid,
'time_needed' => $this->other['time_needed']));
'time_needed' => $this->other['time_needed']]);
}

public function get_url() {
return new \moodle_url('/mod/ratingallocate/view.php', array('m' => $this->objectid));
return new \moodle_url('/mod/ratingallocate/view.php', ['m' => $this->objectid]);
}

public static function get_objectid_mapping() {
return array('db' => 'ratingallocate', 'restore' => 'ratingallocate');
return ['db' => 'ratingallocate', 'restore' => 'ratingallocate'];
}

public static function get_other_mapping() {
Expand Down
8 changes: 4 additions & 4 deletions classes/event/index_viewed.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
class index_viewed extends \core\event\base {

public static function create_simple($coursecontext) {
return self::create(array('context' => $coursecontext));
return self::create(['context' => $coursecontext]);
}

protected function init() {
Expand All @@ -46,15 +46,15 @@ public static function get_name() {
}

public function get_description() {
return get_string('log_index_viewed_description', 'mod_ratingallocate', array('userid' => $this->userid));
return get_string('log_index_viewed_description', 'mod_ratingallocate', ['userid' => $this->userid]);
}

public function get_url() {
return new \moodle_url('/mod/ratingallocate/index.php', array('id' => $this->courseid));
return new \moodle_url('/mod/ratingallocate/index.php', ['id' => $this->courseid]);
}

public static function get_objectid_mapping() {
return array();
return [];
}

public static function get_other_mapping() {
Expand Down
8 changes: 4 additions & 4 deletions classes/event/manual_allocation_saved.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
class manual_allocation_saved extends \core\event\base {

public static function create_simple($modulecontext, $ratingallocateid) {
return self::create(array('context' => $modulecontext, 'objectid' => $ratingallocateid));
return self::create(['context' => $modulecontext, 'objectid' => $ratingallocateid]);
}

protected function init() {
Expand All @@ -55,15 +55,15 @@ public static function get_name() {

public function get_description() {
return get_string('log_manual_allocation_saved_description', 'mod_ratingallocate',
array('userid' => $this->userid, 'ratingallocateid' => $this->objectid));
['userid' => $this->userid, 'ratingallocateid' => $this->objectid]);
}

public function get_url() {
return new \moodle_url('/mod/ratingallocate/view.php', array('m' => $this->objectid));
return new \moodle_url('/mod/ratingallocate/view.php', ['m' => $this->objectid]);
}

public static function get_objectid_mapping() {
return array('db' => 'ratingallocate', 'restore' => 'ratingallocate');
return ['db' => 'ratingallocate', 'restore' => 'ratingallocate'];
}

public static function get_other_mapping() {
Expand Down
8 changes: 4 additions & 4 deletions classes/event/rating_deleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
class rating_deleted extends \core\event\base {

public static function create_simple($modulecontext, $ratingallocateid) {
return self::create(array('context' => $modulecontext, 'objectid' => $ratingallocateid));
return self::create(['context' => $modulecontext, 'objectid' => $ratingallocateid]);
}

protected function init() {
Expand All @@ -48,15 +48,15 @@ public static function get_name() {

public function get_description() {
return get_string('log_rating_deleted_description', 'mod_ratingallocate',
array('userid' => $this->userid, 'ratingallocateid' => $this->objectid));
['userid' => $this->userid, 'ratingallocateid' => $this->objectid]);
}

public function get_url() {
return new \moodle_url('/mod/ratingallocate/view.php', array('m' => $this->objectid));
return new \moodle_url('/mod/ratingallocate/view.php', ['m' => $this->objectid]);
}

public static function get_objectid_mapping() {
return array('db' => 'ratingallocate', 'restore' => 'ratingallocate');
return ['db' => 'ratingallocate', 'restore' => 'ratingallocate'];
}

public static function get_other_mapping() {
Expand Down
Loading

0 comments on commit f6d78b2

Please sign in to comment.