minor bugfix

+ phpdoc improvements
This commit is contained in:
Steffen Schröder 2014-08-25 14:32:09 +02:00
parent cf5910a9b7
commit 7046335893

View File

@ -14,6 +14,9 @@ use ManiaControl\Utils\ClassUtil;
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class PlayerDataManager { class PlayerDataManager {
/*
* Constants
*/
const TABLE_PLAYERDATAMETADATA = 'mc_playerdata_metadata'; const TABLE_PLAYERDATAMETADATA = 'mc_playerdata_metadata';
const TABLE_PLAYERDATA = 'mc_playerdata'; const TABLE_PLAYERDATA = 'mc_playerdata';
const TYPE_STRING = 'string'; const TYPE_STRING = 'string';
@ -32,9 +35,9 @@ class PlayerDataManager {
private $storedData = array(); private $storedData = array();
/** /**
* Construct player manager * Construct a new player manager instance
* *
* @param \ManiaControl\ManiaControl $maniaControl * @param ManiaControl $maniaControl
*/ */
public function __construct(ManiaControl $maniaControl) { public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
@ -234,7 +237,7 @@ class PlayerDataManager {
$dataStatement->store_result(); $dataStatement->store_result();
if ($dataStatement->num_rows <= 0) { if ($dataStatement->num_rows <= 0) {
$this->setPlayerData($object, $dataName, $player, $meta->defaultValue, $serverIndex); $this->setPlayerData($object, $dataName, $player, $meta->defaultValue, $serverIndex);
return $meta->default; return $meta->defaultValue;
} }
$dataStatement->bind_result($value); $dataStatement->bind_result($value);
$dataStatement->fetch(); $dataStatement->fetch();
@ -242,11 +245,12 @@ class PlayerDataManager {
$dataStatement->close(); $dataStatement->close();
$data = $this->castSetting($meta->type, $value); $data = $this->castSetting($meta->type, $value);
//Store setting in the ram // Store setting in the ram
if (!isset($this->storedData[$player->index])) { if (!isset($this->storedData[$player->index])) {
$this->storedData[$player->index] = array(); $this->storedData[$player->index] = array();
} }
$this->storedData[$player->index][$meta->dataId] = $data; $this->storedData[$player->index][$meta->dataId] = $data;
return $data; return $data;
} }