adjusted return type

This commit is contained in:
Steffen Schröder 2014-06-27 01:18:39 +02:00
parent bb94b7712f
commit 2d78c75155

View File

@ -152,7 +152,8 @@ class ManiaExchangeManager {
*/ */
public function fetchMaplistByMixedUidIdString($string) { public function fetchMaplistByMixedUidIdString($string) {
// Get Title Prefix // Get Title Prefix
$titlePrefix = $this->maniaControl->mapManager->getCurrentMap()->getGame(); $titlePrefix = $this->maniaControl->mapManager->getCurrentMap()
->getGame();
// compile search URL // compile search URL
$url = "http://api.mania-exchange.com/{$titlePrefix}/maps/?ids={$string}"; $url = "http://api.mania-exchange.com/{$titlePrefix}/maps/?ids={$string}";
@ -242,16 +243,16 @@ class ManiaExchangeManager {
* *
* @param int $mapId * @param int $mapId
* @param callable $function * @param callable $function
* @return bool
*/ */
public function fetchMapInfo($mapId, callable $function) { public function fetchMapInfo($mapId, callable $function) {
// Get Title Prefix // Get Title Prefix
$titlePrefix = $this->maniaControl->mapManager->getCurrentMap()->getGame(); $titlePrefix = $this->maniaControl->mapManager->getCurrentMap()
->getGame();
// compile search URL // compile search URL
$url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $mapId; $url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $mapId;
return $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix, $url) { $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix, $url) {
$mxMapInfo = null; $mxMapInfo = null;
if ($error) { if ($error) {
trigger_error($error); trigger_error($error);
@ -271,7 +272,8 @@ class ManiaExchangeManager {
* @deprecated * @deprecated
* @see \ManiaControl\ManiaExchange\ManiaExchangeManager::fetchMapsAsync() * @see \ManiaControl\ManiaExchange\ManiaExchangeManager::fetchMapsAsync()
*/ */
public function getMapsAsync(callable $function, $name = '', $author = '', $env = '', $maxMapsReturned = 100, $searchOrder = self::SEARCH_ORDER_UPDATED_NEWEST) { public function getMapsAsync(callable $function, $name = '', $author = '', $env = '', $maxMapsReturned = 100,
$searchOrder = self::SEARCH_ORDER_UPDATED_NEWEST) {
$this->fetchMapsAsync($function, $name, $author, $env, $maxMapsReturned, $searchOrder); $this->fetchMapsAsync($function, $name, $author, $env, $maxMapsReturned, $searchOrder);
return true; return true;
} }
@ -286,12 +288,14 @@ class ManiaExchangeManager {
* @param int $maxMapsReturned * @param int $maxMapsReturned
* @param int $searchOrder * @param int $searchOrder
*/ */
public function fetchMapsAsync(callable $function, $name = '', $author = '', $env = '', $maxMapsReturned = 100, $searchOrder = self::SEARCH_ORDER_UPDATED_NEWEST) { public function fetchMapsAsync(callable $function, $name = '', $author = '', $env = '', $maxMapsReturned = 100,
$searchOrder = self::SEARCH_ORDER_UPDATED_NEWEST) {
// TODO: remove $env because it's not really used? // TODO: remove $env because it's not really used?
// Get Title Id // Get Title Id
$titleId = $this->maniaControl->server->titleId; $titleId = $this->maniaControl->server->titleId;
$titlePrefix = $this->maniaControl->mapManager->getCurrentMap()->getGame(); $titlePrefix = $this->maniaControl->mapManager->getCurrentMap()
->getGame();
// compile search URL // compile search URL
$url = 'http://' . $titlePrefix . '.mania-exchange.com/tracksearch2/search?api=on'; $url = 'http://' . $titlePrefix . '.mania-exchange.com/tracksearch2/search?api=on';