Skip to content

Commit 5ac19dd

Browse files
author
Alexander Birkner
committed
Update Wed Apr 6 16:17:05 CEST 2016
1 parent ebebf3a commit 5ac19dd

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

lib/Nitrapi/Services/Gameservers/Gameserver.php

+9
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ public function getDetails() {
3939
return new GameserverDetails($this->info['gameserver']);
4040
}
4141

42+
/**
43+
* Returns available features from the gameserver
44+
*
45+
* @return GameserverFeatures
46+
*/
47+
public function getFeatures() {
48+
return new GameserverFeatures($this->info['gameserver']['game_specific']['features']);
49+
}
50+
4251
public function getCustomerSettings() {
4352
return new CustomerSettings($this, $this->info['gameserver']['settings']);
4453
}

lib/Nitrapi/Services/Gameservers/GameserverDetails.php

+42
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ public function getStatus() {
2020
return (string)$this->data['status'];
2121
}
2222

23+
/**
24+
* @return bool
25+
*/
26+
public function isManagedRoot() {
27+
return isset($this->data['managed_root']);
28+
}
29+
30+
/**
31+
* @return array
32+
*/
33+
public function getManagedRoot() {
34+
if (!$this->isManagedRoot()) return [];
35+
return $this->data['managed_root'];
36+
}
37+
2338
/**
2439
* Returns the username
2540
*
@@ -245,4 +260,31 @@ public function getQuota() {
245260
public function getWebsocketToken() {
246261
return $this->data['websocket_token'];
247262
}
263+
264+
/**
265+
* Returns the gameserver game path
266+
*
267+
* @return string
268+
*/
269+
public function getPath() {
270+
return $this->data['game_specific']['path'];
271+
}
272+
273+
/**
274+
* Returns the log files of the server
275+
*
276+
* @return array
277+
*/
278+
public function getLogFiles() {
279+
return $this->data['game_specific']['log_files'];
280+
}
281+
282+
/**
283+
* Returns the config files of the server
284+
*
285+
* @return array
286+
*/
287+
public function getConfigFiles() {
288+
return $this->data['game_specific']['config_files'];
289+
}
248290
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace Nitrapi\Services\Gameservers;
4+
5+
6+
class GameserverFeatures
7+
{
8+
protected $data;
9+
10+
public function __construct(array &$data) {
11+
$this->data = $data;
12+
}
13+
14+
public function hasBackups() {
15+
return $this->data['has_backups'];
16+
}
17+
18+
public function hasApplicationServer() {
19+
return $this->data['has_application_server'];
20+
}
21+
22+
public function hasFileBrowser() {
23+
return $this->data['has_file_browser'];
24+
}
25+
26+
public function hasExpertMode() {
27+
return $this->data['has_expert_mode'];
28+
}
29+
30+
public function hasPluginSystem() {
31+
return $this->data['has_plugin_system'];
32+
}
33+
34+
public function hasDatabase() {
35+
return $this->data['has_database'];
36+
}
37+
38+
public function hasRestartMessageSupport() {
39+
return $this->data['has_restart_message_support'];
40+
}
41+
42+
public function hasFTP() {
43+
return $this->data['has_ftp'];
44+
}
45+
}

0 commit comments

Comments
 (0)