[fix] code style change

This commit is contained in:
Qihui Chan
2022-05-15 16:21:05 +10:00
parent fc54e5c809
commit 7e22919b3c
3 changed files with 16 additions and 16 deletions

View File

@@ -30,7 +30,7 @@ require_once($CFG->dirroot.'/calendar/lib.php');
* @copyright 2022 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class outagecache{
class outagecache {
/**
* Private constructor, use static methods instead.
*/
@@ -40,11 +40,11 @@ class outagecache{
/**
* Set active outage cache.
*
* @param outage|null $next_outage Next outage to save, null for not setting outage.
* @param outage|null $nextoutage Next outage to save, null for not setting outage.
*/
public static function set_active_outage_cache($next_outage = null) {
public static function set_active_outage_cache($nextoutage = null) {
$cache = \cache::make('auth_outage', 'cache_active_outage_data');
$cache->set('cache_active_outage_data', $next_outage);
$cache->set('cache_active_outage_data', $nextoutage);
}
/**
@@ -60,11 +60,11 @@ class outagecache{
/**
* Set onging outage cache.
*
* @param outage|null $onging_outage Onging outage to save, null for not setting outage.
* @param outage|null $ongingoutage Onging outage to save, null for not setting outage.
*/
public static function set_ongoing_outage_cache($onging_outage = null) {
public static function set_ongoing_outage_cache($ongingoutage = null) {
$cache = \cache::make('auth_outage', 'cache_ongoing_outage_data');
$cache->set('cache_ongoing_outage_data', $onging_outage);
$cache->set('cache_ongoing_outage_data', $ongingoutage);
}
/**
@@ -84,4 +84,4 @@ class outagecache{
$cache = \cache::make('auth_outage', 'cache_ongoing_outage_data');
$cache->delete('cache_ongoing_outage_data');
}
}
}

View File

@@ -218,9 +218,9 @@ class outagedb {
throw new coding_exception('$time must be null or a positive int.', $time);
}
$outage_cache = outagecache::get_active_outage_cache();
return $outage_cache && $outage_cache->warntime <= $time && $outage_cache->stoptime >= $time
? new outage($outage_cache) : null;
$outagecache = outagecache::get_active_outage_cache();
return $outagecache && $outagecache->warntime <= $time && $outagecache->stoptime >= $time
? new outage($outagecache) : null;
}
/**
@@ -398,10 +398,10 @@ class outagedb {
}
// If there is an onging outage in cache, return the outage.
$outage_cache = outagecache::get_ongoing_outage_cache();
if ($outage_cache) {
return $outage_cache->starttime <= $time && $outage_cache->stoptime >= $time
? new outage($outage_cache) : null;
$outagecache = outagecache::get_ongoing_outage_cache();
if ($outagecache) {
return $outagecache->starttime <= $time && $outagecache->stoptime >= $time
? new outage($outagecache) : null;
}
$data = $DB->get_records_select(