performed code formatting

This commit is contained in:
Steffen Schröder
2014-08-05 02:17:41 +02:00
parent 98b5f132dc
commit 28d2c08936
66 changed files with 4054 additions and 1901 deletions

View File

@ -81,10 +81,12 @@ class ManiaExchangeManager {
$maps = array($maps);
} else {
// Fetch Information for whole MapList
$maps = $this->maniaControl->getMapManager()->getMaps();
$maps = $this->maniaControl->getMapManager()
->getMaps();
}
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
$mysqli = $this->maniaControl->getDatabase()
->getMysqli();
$mapIdString = '';
// Fetch mx ids
@ -100,7 +102,8 @@ class ManiaExchangeManager {
foreach ($maps as $map) {
if (!$map) {
// TODO: remove after resolving of error report about "non-object"
$this->maniaControl->getErrorHandler()->triggerDebugNotice('Non-Object-Map', $map, $maps);
$this->maniaControl->getErrorHandler()
->triggerDebugNotice('Non-Object-Map', $map, $maps);
continue;
}
/** @var Map $map */
@ -153,13 +156,15 @@ class ManiaExchangeManager {
*/
public function fetchMaplistByMixedUidIdString($string) {
// Get Title Prefix
$titlePrefix = $this->maniaControl->getMapManager()->getCurrentMap()
->getGame();
$titlePrefix = $this->maniaControl->getMapManager()
->getCurrentMap()
->getGame();
// compile search URL
$url = "http://api.mania-exchange.com/{$titlePrefix}/maps/?ids={$string}";
$this->maniaControl->getFileReader()->loadFile($url, function ($mapInfo, $error) use ($titlePrefix, $url) {
$this->maniaControl->getFileReader()
->loadFile($url, function ($mapInfo, $error) use ($titlePrefix, $url) {
if ($error) {
trigger_error("Error: '{$error}' for Url '{$url}'");
return;
@ -194,7 +199,8 @@ class ManiaExchangeManager {
* @param array $mxMapInfos
*/
public function updateMapObjectsWithManiaExchangeIds(array $mxMapInfos) {
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
$mysqli = $this->maniaControl->getDatabase()
->getMysqli();
// Save map data
$saveMapQuery = "UPDATE `" . MapManager::TABLE_MAPS . "`
SET `mxid` = ?
@ -220,7 +226,8 @@ class ManiaExchangeManager {
} else {
$uid = $mxMapInfo->uid;
}
$map = $this->maniaControl->getMapManager()->getMapByUid($uid);
$map = $this->maniaControl->getMapManager()
->getMapByUid($uid);
if ($map) {
// TODO: how does it come that $map can be empty here? we got an error report for that
/** @var Map $map */
@ -247,13 +254,15 @@ class ManiaExchangeManager {
*/
public function fetchMapInfo($mapId, callable $function) {
// Get Title Prefix
$titlePrefix = $this->maniaControl->getMapManager()->getCurrentMap()
->getGame();
$titlePrefix = $this->maniaControl->getMapManager()
->getCurrentMap()
->getGame();
// compile search URL
$url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $mapId;
$this->maniaControl->getFileReader()->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix, $url) {
$this->maniaControl->getFileReader()
->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix, $url) {
$mxMapInfo = null;
if ($error) {
trigger_error($error);
@ -295,8 +304,9 @@ class ManiaExchangeManager {
// Get Title Id
$titleId = $this->maniaControl->getServer()->titleId;
$titlePrefix = $this->maniaControl->getMapManager()->getCurrentMap()
->getGame();
$titlePrefix = $this->maniaControl->getMapManager()
->getCurrentMap()
->getGame();
// compile search URL
$url = 'http://' . $titlePrefix . '.mania-exchange.com/tracksearch2/search?api=on';
@ -322,13 +332,15 @@ class ManiaExchangeManager {
// Get MapTypes
try {
$scriptInfos = $this->maniaControl->getClient()->getModeScriptInfo();
$scriptInfos = $this->maniaControl->getClient()
->getModeScriptInfo();
$mapTypes = $scriptInfos->compatibleMapTypes;
$url .= '&mtype=' . $mapTypes;
} catch (GameModeException $e) {
}
$this->maniaControl->getFileReader()->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix) {
$this->maniaControl->getFileReader()
->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix) {
if ($error) {
trigger_error($error);
return;