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

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) {