improved closure code & phpdoc
This commit is contained in:
parent
e23c795fc9
commit
5df32fa657
@ -143,7 +143,7 @@ class ManiaExchangeManager {
|
|||||||
* Get the Whole MapList from MX by Mixed Uid and Id String fetch
|
* Get the Whole MapList from MX by Mixed Uid and Id String fetch
|
||||||
*
|
*
|
||||||
* @param string $string
|
* @param string $string
|
||||||
* @return array|null
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function getMaplistByMixedUidIdString($string) {
|
public function getMaplistByMixedUidIdString($string) {
|
||||||
// Get Title Prefix
|
// Get Title Prefix
|
||||||
@ -155,18 +155,17 @@ class ManiaExchangeManager {
|
|||||||
$thisRef = $this;
|
$thisRef = $this;
|
||||||
$success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use ($thisRef, $titlePrefix, $url) {
|
$success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use ($thisRef, $titlePrefix, $url) {
|
||||||
if ($error) {
|
if ($error) {
|
||||||
trigger_error($error . " " . $url);
|
trigger_error("Error: '{$error}' for Url '{$url}'");
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$mapInfo) {
|
if (!$mapInfo) {
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mxMapList = json_decode($mapInfo);
|
$mxMapList = json_decode($mapInfo);
|
||||||
if ($mxMapList === null) {
|
if ($mxMapList === null) {
|
||||||
trigger_error('Cannot decode searched JSON data from ' . $url);
|
trigger_error("Can't decode searched JSON Data from Url '{$url}'");
|
||||||
return null;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$maps = array();
|
$maps = array();
|
||||||
@ -180,7 +179,6 @@ class ManiaExchangeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$thisRef->updateMapObjectsWithManiaExchangeIds($maps);
|
$thisRef->updateMapObjectsWithManiaExchangeIds($maps);
|
||||||
return true;
|
|
||||||
}, "application/json");
|
}, "application/json");
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
|
Loading…
Reference in New Issue
Block a user