TrackManiaControl/application/plugins/Dedimania/DedimaniaData.php

54 lines
1.2 KiB
PHP
Raw Normal View History

2014-02-14 19:22:11 +01:00
<?php
/**
* Created by PhpStorm.
* User: Lukas
* Date: 14.02.14
* Time: 17:16
*/
namespace Dedimania;
2014-02-15 01:03:25 +01:00
use ManiaControl\ManiaControl;
use Maniaplanet\DedicatedServer\Structures\Version;
2014-02-14 19:22:11 +01:00
/**
* Dedimania Structure
*
* @author kremsy & steeffeen
*/
class DedimaniaData {
2014-02-15 01:03:25 +01:00
public $game;
public $path;
public $packmask;
public $serverVersion;
public $serverBuild;
public $tool;
public $version;
public $login;
public $code;
2014-02-16 22:38:14 +01:00
public $sessionId = '';
public $records = array();
2014-02-15 01:03:25 +01:00
public function __construct($serverLogin, $dedimaniaCode, $path, $packmask, Version $serverVersion) {
$this->game = "TM2";
$this->login = $serverLogin;
$this->code = $dedimaniaCode;
$this->version = ManiaControl::VERSION;
$this->tool = "ManiaControl";
$this->path = $path;
$this->packmask = $packmask;
$this->serverVersion = $serverVersion->version;
$this->serverBuild = $serverVersion->build;
}
2014-02-14 19:22:11 +01:00
2014-02-15 01:03:25 +01:00
public function toArray() {
$array = array();
2014-02-16 22:38:14 +01:00
foreach(get_object_vars($this) as $key => $value) {
if ($key == 'records' || $key == 'sessionId') {
continue;
}
2014-02-15 01:03:25 +01:00
$array[ucfirst($key)] = $value;
2014-02-16 22:38:14 +01:00
}
2014-02-15 01:03:25 +01:00
return $array;
2014-02-14 19:22:11 +01:00
}
}