Skip to content

Commit

Permalink
rename WatchdogStats to PunishmentStats
Browse files Browse the repository at this point in the history
  • Loading branch information
Plancke committed Feb 28, 2021
1 parent c4a3424 commit 37007dc
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 35 deletions.
12 changes: 6 additions & 6 deletions src/HypixelPHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
use Plancke\HypixelPHP\responses\Resource;
use Plancke\HypixelPHP\responses\skyblock\SkyBlockProfile;
use Plancke\HypixelPHP\responses\Status;
use Plancke\HypixelPHP\responses\WatchdogStats;
use Plancke\HypixelPHP\responses\PunishmentStats;
use Plancke\HypixelPHP\util\InputType;
use Plancke\HypixelPHP\util\Utilities;
use Plancke\HypixelPHP\util\Validator;
Expand Down Expand Up @@ -582,15 +582,15 @@ function () {
}

/**
* @return WatchdogStats|Response|null
* @return PunishmentStats|Response|null
*/
public function getWatchdogStats() {
public function getPunishmentStats() {
return $this->handle(
$this->getCacheHandler()->getWatchdogStats(),
$this->getCacheHandler()->getPunishmentStats(),
function () {
return $this->getFetcher()->fetch(FetchTypes::WATCHDOG_STATS, ['key' => $this->getAPIKey()]);
return $this->getFetcher()->fetch(FetchTypes::PUNISHMENT_STATS, ['key' => $this->getAPIKey()]);
},
$this->getProvider()->getWatchdogStats()
$this->getProvider()->getPunishmentStats()
);
}

Expand Down
12 changes: 6 additions & 6 deletions src/cache/CacheHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Plancke\HypixelPHP\responses\Resource;
use Plancke\HypixelPHP\responses\skyblock\SkyBlockProfile;
use Plancke\HypixelPHP\responses\Status;
use Plancke\HypixelPHP\responses\WatchdogStats;
use Plancke\HypixelPHP\responses\PunishmentStats;

/**
* Class CacheHandler
Expand All @@ -45,7 +45,7 @@ abstract class CacheHandler extends Module {
CacheTimes::STATUS => 10 * 60,
CacheTimes::KEY_INFO => 10 * 60,
CacheTimes::FRIENDS => 10 * 60,
CacheTimes::WATCHDOG => 10 * 60,
CacheTimes::PUNISHMENT_STATS => 10 * 60,
CacheTimes::GAME_COUNTS => 10 * 60,

CacheTimes::SKYBLOCK_PROFILE => 10 * 60
Expand Down Expand Up @@ -241,15 +241,15 @@ public abstract function getBoosters();
public abstract function setBoosters(Boosters $boosters);

/**
* @return WatchdogStats|null
* @return PunishmentStats|null
*/
public abstract function getWatchdogStats();
public abstract function getPunishmentStats();

/**
* @param WatchdogStats $watchdogStats
* @param PunishmentStats $punishmentStats
* @return void
*/
public abstract function setWatchdogStats(WatchdogStats $watchdogStats);
public abstract function setPunishmentStats(PunishmentStats $punishmentStats);

/**
* @return PlayerCount|null
Expand Down
2 changes: 1 addition & 1 deletion src/cache/CacheTimes.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class CacheTimes {
const RECENT_GAMES = 'recentGames';
const KEY_INFO = 'keyInfo';
const FRIENDS = 'friends';
const WATCHDOG = 'watchdog';
const PUNISHMENT_STATS = 'punishmentStats';
const GAME_COUNTS = 'gameCounts';
const SKYBLOCK_PROFILE = 'skyblock_profile';

Expand Down
2 changes: 1 addition & 1 deletion src/cache/CacheTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class CacheTypes {

const LEADERBOARDS = 'leaderboards';
const BOOSTERS = 'boosters';
const WATCHDOG_STATS = 'watchdogStats';
const PUNISHMENT_STATS = 'punishmentStats';
const PLAYER_COUNT = 'playerCount';
const GAME_COUNTS = 'gameCounts';

Expand Down
16 changes: 8 additions & 8 deletions src/cache/impl/FlatFileCacheHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Plancke\HypixelPHP\responses\Resource;
use Plancke\HypixelPHP\responses\skyblock\SkyBlockProfile;
use Plancke\HypixelPHP\responses\Status;
use Plancke\HypixelPHP\responses\WatchdogStats;
use Plancke\HypixelPHP\responses\PunishmentStats;
use Plancke\HypixelPHP\util\CacheUtil;

/**
Expand Down Expand Up @@ -323,21 +323,21 @@ public function setBoosters(Boosters $boosters) {
}

/**
* @return WatchdogStats|null
* @return PunishmentStats|null
*/
public function getWatchdogStats() {
public function getPunishmentStats() {
return $this->wrapProvider(
$this->getHypixelPHP()->getProvider()->getWatchdogStats(),
$this->_getCache(CacheTypes::WATCHDOG_STATS)
$this->getHypixelPHP()->getProvider()->getPunishmentStats(),
$this->_getCache(CacheTypes::PUNISHMENT_STATS)
);
}

/**
* @param WatchdogStats $watchdogStats
* @param PunishmentStats $punishmentStats
* @throws InvalidArgumentException
*/
public function setWatchdogStats(WatchdogStats $watchdogStats) {
$this->_setCache(CacheTypes::WATCHDOG_STATS, $watchdogStats);
public function setPunishmentStats(PunishmentStats $punishmentStats) {
$this->_setCache(CacheTypes::PUNISHMENT_STATS, $punishmentStats);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/cache/impl/NoCacheHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Plancke\HypixelPHP\responses\RecentGames;
use Plancke\HypixelPHP\responses\skyblock\SkyBlockProfile;
use Plancke\HypixelPHP\responses\Status;
use Plancke\HypixelPHP\responses\WatchdogStats;
use Plancke\HypixelPHP\responses\PunishmentStats;

/**
* Class NoCacheHandler
Expand Down Expand Up @@ -103,10 +103,10 @@ function getBoosters() {
return null;
}

function setWatchdogStats(WatchdogStats $watchdogStats) {
function setPunishmentStats(PunishmentStats $punishmentStats) {
}

function getWatchdogStats() {
function getPunishmentStats() {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/fetch/FetchTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class FetchTypes {
const STATUS = 'status';
const RECENT_GAMES = 'recentGames';
const KEY = 'key';
const WATCHDOG_STATS = 'watchdogStats';
const PUNISHMENT_STATS = 'punishmentStats';
const PLAYER_COUNT = 'playerCount';
const GAME_COUNTS = 'gameCounts';

Expand All @@ -38,7 +38,7 @@ public static function values() {
self::STATUS,
self::RECENT_GAMES,
self::KEY,
self::WATCHDOG_STATS,
self::PUNISHMENT_STATS,
self::PLAYER_COUNT,
self::GAME_COUNTS,
self::SKYBLOCK_PROFILE
Expand Down
2 changes: 1 addition & 1 deletion src/fetch/adapter/ResponseAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function adaptResponse($fetch, $keyValues, Response $response) {
case FetchTypes::SKYBLOCK_PROFILE:
return $this->remapField('profile', $response);

case FetchTypes::WATCHDOG_STATS:
case FetchTypes::PUNISHMENT_STATS:
case FetchTypes::PLAYER_COUNT:
case FetchTypes::GAME_COUNTS:
return $this->wrapRecord($response);
Expand Down
6 changes: 3 additions & 3 deletions src/provider/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Plancke\HypixelPHP\responses\RecentGames;
use Plancke\HypixelPHP\responses\skyblock\SkyBlockProfile;
use Plancke\HypixelPHP\responses\Status;
use Plancke\HypixelPHP\responses\WatchdogStats;
use Plancke\HypixelPHP\responses\PunishmentStats;

/**
* Class Provider
Expand Down Expand Up @@ -98,9 +98,9 @@ public function getKeyInfo() {
/**
* @return Closure
*/
public function getWatchdogStats() {
public function getPunishmentStats() {
return function ($HypixelPHP, $data) {
return new WatchdogStats($HypixelPHP, $data);
return new PunishmentStats($HypixelPHP, $data);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
use Plancke\HypixelPHP\classes\HypixelObject;

/**
* Class WatchdogStats
* Class PunishmentStats
* @package Plancke\HypixelPHP\responses
*/
class WatchdogStats extends HypixelObject {
class PunishmentStats extends HypixelObject {
/**
* @return int
*/
Expand All @@ -35,10 +35,10 @@ public function getRollingDaily() {
* @return string
*/
public function getCacheTimeKey() {
return CacheTimes::WATCHDOG;
return CacheTimes::PUNISHMENT_STATS;
}

public function save() {
$this->getHypixelPHP()->getCacheHandler()->setWatchdogStats($this);
$this->getHypixelPHP()->getCacheHandler()->setPunishmentStats($this);
}
}

0 comments on commit 37007dc

Please sign in to comment.