phpdoc & closure improvements
This commit is contained in:
parent
683e6f30a2
commit
0a7bc3b234
@ -3,7 +3,6 @@
|
||||
namespace ManiaControl\Commands;
|
||||
|
||||
use FML\Controls\Frame;
|
||||
use FML\Controls\Label;
|
||||
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
||||
use FML\ManiaLink;
|
||||
use FML\Script\Features\Paging;
|
||||
@ -216,7 +215,6 @@ class HelpManager implements CommandListener, CallbackListener {
|
||||
$array = array($command['Name'] => $x + 5, $command['Description'] => $x + 50);
|
||||
$labels = $this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
|
||||
|
||||
/** @var Label $label */
|
||||
$label = $labels[0];
|
||||
$label->setWidth(40);
|
||||
|
||||
|
@ -131,7 +131,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
||||
|
||||
// search for matching maps
|
||||
$self = $this;
|
||||
$this->maniaControl->mapManager->mxManager->getMapsAsync(function ($maps) use (&$self, &$player) {
|
||||
$this->maniaControl->mapManager->mxManager->getMapsAsync(function (array $maps) use (&$self, &$player) {
|
||||
if (!$maps) {
|
||||
$self->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login);
|
||||
return;
|
||||
@ -143,11 +143,11 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
||||
/**
|
||||
* Display the Mania Exchange List
|
||||
*
|
||||
* @param $maps
|
||||
* @param Player $player
|
||||
* @param MXMapInfo[] $maps
|
||||
* @param Player $player
|
||||
* @internal param array $chatCallback
|
||||
*/
|
||||
private function showManiaExchangeList($maps, Player $player) {
|
||||
private function showManiaExchangeList(array $maps, Player $player) {
|
||||
// Start offsets
|
||||
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
||||
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
||||
@ -181,7 +181,6 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
||||
|
||||
foreach ($maps as $map) {
|
||||
//TODO order possibilities
|
||||
/** @var MxMapInfo $map */
|
||||
if ($i % self::MAX_MX_MAPS_PER_PAGE === 0) {
|
||||
$pageFrame = new Frame();
|
||||
$frame->add($pageFrame);
|
||||
@ -201,11 +200,9 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
||||
$lineQuad->setZ(0.001);
|
||||
}
|
||||
|
||||
/** @var MxMapInfo $map */
|
||||
$time = Formatter::time_elapsed_string(strtotime($map->updated));
|
||||
$array = array('$s' . $map->id => $x + 3.5, '$s' . $map->name => $x + 12.5, '$s' . $map->author => $x + 59, '$s' . str_replace("Arena", "", $map->maptype) => $x + 103, '$s' . $map->mood => $x + 118, '$s' . $time => $x + 130);
|
||||
$labels = $this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
|
||||
/** @var Label_Text $authorLabel */
|
||||
$time = Formatter::time_elapsed_string(strtotime($map->updated));
|
||||
$array = array('$s' . $map->id => $x + 3.5, '$s' . $map->name => $x + 12.5, '$s' . $map->author => $x + 59, '$s' . str_replace("Arena", "", $map->maptype) => $x + 103, '$s' . $map->mood => $x + 118, '$s' . $time => $x + 130);
|
||||
$labels = $this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
|
||||
$authorLabel = $labels[2];
|
||||
$authorLabel->setAction(self::ACTION_GET_MAPS_FROM_AUTHOR . '.' . $map->author);
|
||||
|
||||
|
@ -310,21 +310,21 @@ class ManiaExchangeManager {
|
||||
$success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix) {
|
||||
if ($error) {
|
||||
trigger_error($error);
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
$mxMapList = json_decode($mapInfo);
|
||||
|
||||
if (!isset($mxMapList->results)) {
|
||||
trigger_error('Cannot decode searched JSON data');
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
$mxMapList = $mxMapList->results;
|
||||
|
||||
if ($mxMapList === null) {
|
||||
trigger_error('Cannot decode searched JSON data');
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
$maps = array();
|
||||
@ -335,7 +335,6 @@ class ManiaExchangeManager {
|
||||
}
|
||||
|
||||
call_user_func($function, $maps);
|
||||
return true;
|
||||
}, "application/json");
|
||||
|
||||
return $success;
|
||||
|
Loading…
Reference in New Issue
Block a user