Skip to content

Commit 6db4e6c

Browse files
authored
Update CraftyController.php
1 parent 335ee90 commit 6db4e6c

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

CraftyController/CraftyController.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class CraftyController extends \App\SupportedApps implements \App\EnhancedApps
66
{
7-
87
public $config;
98

109
private $token = null;
@@ -18,17 +17,16 @@ public function __construct()
1817
}
1918

2019
public function test()
21-
{
22-
$test = parent::appTest($this->url('api/v2/auth/login'), $this->auth_attrs());
20+
{
21+
$test = parent::appTest($this->url('api/v2/auth/login'), $this->authAttrs());
2322
echo $test->status;
2423
}
2524

2625
public function livestats()
2726
{
2827
$status = "inactive";
29-
$res = parent::execute($this->url('api/v2/auth/login'), $this->auth_attrs());
28+
$res = parent::execute($this->url('api/v2/auth/login'), $this->authAttrs());
3029
$data = json_decode($res->getBody());
31-
3230
if ($data->status == 'ok') {
3331
$this->token = $data->data->token;
3432
}
@@ -41,19 +39,21 @@ public function livestats()
4139
$online = 0;
4240

4341
foreach ($details->data as $server) {
44-
$server_res = parent::execute($this->url('api/v2/servers/' . $server->server_id . '/stats'), attrs: $this->attrs(), overridemethod: 'GET');
42+
$server_res = parent::execute($this->url('api/v2/servers/' . $server->server_id . '/stats'),
43+
attrs: $this->attrs(),
44+
overridemethod: 'GET');
4545
$server_details = json_decode($server_res->getBody());
46-
if ($server_details->data->running == True)
46+
if ($server_details->data->running == true) {
4747
$online++;
48+
}
4849
}
4950

5051
$vars['servers_online'] = $online;
5152

5253
return parent::getLiveStats($status, $vars);
53-
5454
}
5555

56-
private function auth_attrs()
56+
private function authAttrs()
5757
{
5858
return [
5959
"body" => json_encode([
@@ -64,7 +64,7 @@ private function auth_attrs()
6464
];
6565
}
6666

67-
67+
6868
public function attrs()
6969
{
7070
$attrs["headers"] = [
@@ -78,7 +78,7 @@ public function attrs()
7878

7979
public function url($endpoint)
8080
{
81-
$api_url = parent::normaliseurl($this->config->url).$endpoint;
81+
$api_url = parent::normaliseurl($this->config->url) . $endpoint;
8282
return $api_url;
8383
}
8484
}

0 commit comments

Comments
 (0)