improved PHPDoc & applied common style

This commit is contained in:
Steffen Schröder
2014-05-03 23:49:58 +02:00
parent 8296e8457c
commit 9aea33951a
14 changed files with 1787 additions and 1883 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
<?php
namespace Dedimania;
use ManiaControl\ManiaControl;
@ -7,11 +8,14 @@ use Maniaplanet\DedicatedServer\Structures\Version;
/**
* ManiaControl Dedimania Plugin DataStructure
*
* @author kremsy and steeffeen
* @copyright ManiaControl Copyright © 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class DedimaniaData {
/*
* Constants
*/
public $game;
public $path;
public $packmask;
@ -27,6 +31,15 @@ class DedimaniaData {
public $directoryAccessChecked = false;
public $serverMaxRank = 30;
/**
* Construct a new Dedimania Data Model
*
* @param string $serverLogin
* @param string $dedimaniaCode
* @param string $path
* @param string $packmask
* @param Version $serverVersion
*/
public function __construct($serverLogin, $dedimaniaCode, $path, $packmask, Version $serverVersion) {
$this->game = "TM2";
$this->login = $serverLogin;
@ -41,7 +54,7 @@ class DedimaniaData {
public function toArray() {
$array = array();
foreach(get_object_vars($this) as $key => $value) {
foreach (get_object_vars($this) as $key => $value) {
if ($key == 'records' || $key == 'sessionId' || $key == 'directoryAccessChecked' || $key == 'serverMaxRank' || $key == 'players') {
continue;
}
@ -62,7 +75,7 @@ class DedimaniaData {
*/
public function getPlayerMaxRank($login) {
$maxRank = $this->serverMaxRank;
foreach($this->players as $player) {
foreach ($this->players as $player) {
/** @var DedimaniaPlayer $player */
if ($player->login === $login) {
if ($player->maxRank > $maxRank) {

View File

@ -1,22 +1,32 @@
<?php
namespace Dedimania;
/**
* ManiaControl Dedimania-Plugin Player DataStructure
*
* @author kremsy and steeffeen
* @copyright ManiaControl Copyright © 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class DedimaniaPlayer {
/*
* Public Properties
*/
public $login = '';
public $maxRank = -1;
public $banned = false;
public $optionsEnabled = false;
public $options = '';
/**
* Construct a new Dedimania Player Model
* @param mixed$player
*/
public function __construct($player) {
if (!$player) return;
if (!$player) {
return;
}
$this->login = $player['Login'];
$this->maxRank = $player['MaxRank'];
@ -28,8 +38,8 @@ class DedimaniaPlayer {
/**
* Construct a new Player by its login and maxRank
*
* @param $login
* @param $maxRank
* @param string $login
* @param int $maxRank
*/
public function constructNewPlayer($login, $maxRank) {
$this->login = $login;

View File

@ -1,16 +1,20 @@
<?php
namespace Dedimania;
use ManiaControl\Formatter;
/**
* ManiaControl Dedimania-Plugin Record DataStructure
*
* @author kremsy and steeffeen
* @copyright ManiaControl Copyright © 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
use ManiaControl\Formatter;
class RecordData {
/*
* Public Properties
*/
public $nullRecord = false;
public $login = '';
public $nickName = '';
@ -25,7 +29,7 @@ class RecordData {
/**
* Construct a Record by a given Record Array
*
* @param $record
* @param array $record
*/
public function __construct($record) {
if (!$record) {
@ -42,13 +46,13 @@ class RecordData {
}
/**
* Constructs a new Record via it's properties
* Construct a new Record via its Properties
*
* @param $login
* @param $nickName
* @param $best
* @param $checkpoints
* @param bool $newRecord
* @param string $login
* @param string $nickName
* @param float $best
* @param int $checkpoints
* @param bool $newRecord
*/
public function constructNewRecord($login, $nickName, $best, $checkpoints, $newRecord = false) {
$this->nullRecord = false;
@ -58,4 +62,4 @@ class RecordData {
$this->checkpoints = $checkpoints;
$this->newRecord = $newRecord;
}
}
}