phpdoc & formatting improvements

This commit is contained in:
Steffen Schröder 2014-10-24 20:20:12 +02:00
parent 354ab0bcdd
commit b25171657c
7 changed files with 104 additions and 45 deletions

View File

@ -236,7 +236,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
/** /**
* Closes the widget * Closes the widget
* *
* @param \ManiaControl\Players\Player $player * @param Player $player
*/ */
public function closeWidget(Player $player) { public function closeWidget(Player $player) {
unset($this->adminListShown[$player->login]); unset($this->adminListShown[$player->login]);
@ -246,7 +246,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
* Unset the player if he opened another Main Widget * Unset the player if he opened another Main Widget
* *
* @param Player $player * @param Player $player
* @param $openedWidget * @param string $openedWidget
*/ */
public function handleWidgetOpened(Player $player, $openedWidget) { public function handleWidgetOpened(Player $player, $openedWidget) {
//unset when another main widget got opened //unset when another main widget got opened

View File

@ -2,11 +2,13 @@
namespace ManiaControl\Callbacks\Structures; namespace ManiaControl\Callbacks\Structures;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
class ArmorEmptyStructure { class ArmorEmptyStructure {
/*
* Private properties
*/
private $shooter; private $shooter;
private $victim; private $victim;
private $damage; private $damage;
@ -15,8 +17,14 @@ class ArmorEmptyStructure {
/** @var ManiaControl $maniaControl */ /** @var ManiaControl $maniaControl */
private $maniaControl; private $maniaControl;
public function __construct(ManiaControl $maniaControl, $data) { /**
$this->maniaControl = $maniaControl; * Construct a new Armor Empty Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, array $data) {
$this->maniaControl = $maniaControl;
$this->shooter = $data[0]; $this->shooter = $data[0];
$this->victim = $data[1]; $this->victim = $data[1];
$this->damage = $data[2]; $this->damage = $data[2];
@ -25,22 +33,26 @@ class ArmorEmptyStructure {
} }
/** /**
* Get the shooter
*
* @return Player * @return Player
*/ */
public function getShooter() { public function getShooter() {
$shooter = $this->maniaControl->getPlayerManager()->getPlayer($this->shooter); return $this->maniaControl->getPlayerManager()->getPlayer($this->shooter);
return $shooter;
} }
/** /**
* Get the victim
*
* @return Player * @return Player
*/ */
public function getVictim() { public function getVictim() {
$victim = $this->maniaControl->getPlayerManager()->getPlayer($this->victim); return $this->maniaControl->getPlayerManager()->getPlayer($this->victim);
return $victim;
} }
/** /**
* Get the damage
*
* @return int * @return int
*/ */
public function getDamage() { public function getDamage() {
@ -48,6 +60,8 @@ class ArmorEmptyStructure {
} }
/** /**
* Get the shooter points
*
* @return int * @return int
*/ */
public function getShooterPoints() { public function getShooterPoints() {
@ -55,9 +69,12 @@ class ArmorEmptyStructure {
} }
/** /**
* Get the weapon
*
* @return int * @return int
*/ */
public function getWeapon() { //TODO any way of returning type "Weapon?" public function getWeapon() {
// TODO: any way of returning type "Weapon?"
return $this->weapon; return $this->weapon;
} }
} }

View File

@ -2,28 +2,40 @@
namespace ManiaControl\Callbacks\Structures; namespace ManiaControl\Callbacks\Structures;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
class CaptureStructure { class CaptureStructure {
/*
* Private properties
*/
private $playerArray; private $playerArray;
/** @var ManiaControl $maniaControl */ /** @var ManiaControl $maniaControl */
private $maniaControl; private $maniaControl;
public function __construct(ManiaControl $maniaControl, $data) { /**
* Construct a new Capture Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, array $data) {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
$this->playerArray = $data; $this->playerArray = $data;
} }
/** /**
* @return mixed * Get the logins
*
* @return array
*/ */
public function getLoginArray() { public function getLoginArray() {
return $this->playerArray; return $this->playerArray;
} }
/** /**
* Get the players
*
* @return Player[] * @return Player[]
*/ */
public function getPlayerArray() { public function getPlayerArray() {

View File

@ -2,52 +2,65 @@
namespace ManiaControl\Callbacks\Structures; namespace ManiaControl\Callbacks\Structures;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
class NearMissStructure { class NearMissStructure {
/*
* Private properties
*/
private $shooter; private $shooter;
private $victim; private $victim;
private $distance; private $distance;
private $weapon; private $weapon;
/** @var ManiaControl $maniaControl */ /** @var ManiaControl $maniaControl */
private $maniaControl; private $maniaControl;
public function __construct(ManiaControl $maniaControl, $data) { /**
* Construct a new Near Miss Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, array $data) {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
$this->shooter = $data[0]; $this->shooter = $data[0];
$this->victim = $data[1]; $this->victim = $data[1];
$this->weapon = $data[2]; $this->weapon = $data[2];
$this->distance = $data[3]; $this->distance = $data[3];
} }
/** /**
* @return Player|null * Get the shooter
*
* @return Player
*/ */
public function getShooter() { public function getShooter() {
$shooter = $this->maniaControl->getPlayerManager()->getPlayer($this->shooter); return $this->maniaControl->getPlayerManager()->getPlayer($this->shooter);
return $shooter;
} }
/** /**
* @return Player|null * Get the victim
*
* @return Player
*/ */
public function getVictim() { public function getVictim() {
$victim = $this->maniaControl->getPlayerManager()->getPlayer($this->victim); return $this->maniaControl->getPlayerManager()->getPlayer($this->victim);
return $victim;
} }
/** /**
* @return mixed * Get the distance
*
* @return float
*/ */
public function getDistance() { public function getDistance() {
return $this->distance; return $this->distance;
} }
/** /**
* @return mixed * Get the weapon
*
* @return int
*/ */
public function getWeapon() { public function getWeapon() {
return $this->weapon; return $this->weapon;

View File

@ -2,11 +2,13 @@
namespace ManiaControl\Callbacks\Structures; namespace ManiaControl\Callbacks\Structures;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
class PlayerHitStructure { class PlayerHitStructure {
/*
* Private properties
*/
private $shooter; private $shooter;
private $victim; private $victim;
private $damage; private $damage;
@ -15,8 +17,14 @@ class PlayerHitStructure {
/** @var ManiaControl $maniaControl */ /** @var ManiaControl $maniaControl */
private $maniaControl; private $maniaControl;
public function __construct(ManiaControl $maniaControl, $data) { /**
$this->maniaControl = $maniaControl; * Construct new Player Hit Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, array $data) {
$this->maniaControl = $maniaControl;
$this->shooter = $data[0]; $this->shooter = $data[0];
$this->victim = $data[1]; $this->victim = $data[1];
$this->damage = $data[2]; $this->damage = $data[2];
@ -25,22 +33,26 @@ class PlayerHitStructure {
} }
/** /**
* @return Player|null * Get the shooter
*
* @return Player
*/ */
public function getShooter() { public function getShooter() {
$shooter = $this->maniaControl->getPlayerManager()->getPlayer($this->shooter); return $this->maniaControl->getPlayerManager()->getPlayer($this->shooter);
return $shooter;
} }
/** /**
* @return Player|null * Get the victim
*
* @return Player
*/ */
public function getVictim() { public function getVictim() {
$victim = $this->maniaControl->getPlayerManager()->getPlayer($this->victim); return $this->maniaControl->getPlayerManager()->getPlayer($this->victim);
return $victim;
} }
/** /**
* Get the damage
*
* @return int * @return int
*/ */
public function getDamage() { public function getDamage() {
@ -48,6 +60,8 @@ class PlayerHitStructure {
} }
/** /**
* Get the shooter points
*
* @return int * @return int
*/ */
public function getShooterPoints() { public function getShooterPoints() {
@ -55,9 +69,12 @@ class PlayerHitStructure {
} }
/** /**
* Get the weapon
*
* @return int * @return int
*/ */
public function getWeapon() { //TODO any way of returning type "Weapon?" public function getWeapon() {
// TODO: any way of returning type "Weapon?"
return $this->weapon; return $this->weapon;
} }
} }

View File

@ -81,7 +81,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
$action = $actionArray[0] . '.' . $actionArray[1]; $action = $actionArray[0] . '.' . $actionArray[1];
$login = $callback[1][1]; $login = $callback[1][1];
$player = $this->maniaControl->getPlayerManager()->getPlayer($login); $player = $this->maniaControl->getPlayerManager()->getPlayer($login);
$mapId = (int)$actionArray[2]; $mapId = (int) $actionArray[2];
switch ($action) { switch ($action) {
case self::ACTION_GET_MAPS_FROM_AUTHOR: case self::ACTION_GET_MAPS_FROM_AUTHOR: