Skip to content

Commit a661f71

Browse files
committed
fix styleci issues
1 parent cc0d54e commit a661f71

File tree

3 files changed

+43
-39
lines changed

3 files changed

+43
-39
lines changed

app/Http/Controllers/Admin/NodesController.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ public function deleteNode(Request $request, $id)
279279
]);
280280
}
281281

282-
public function getConfigurationToken(Request $request, $id) {
282+
public function getConfigurationToken(Request $request, $id)
283+
{
283284
// Check if Node exists. Will lead to 404 if not.
284285
Models\Node::findOrFail($id);
285286

@@ -290,10 +291,10 @@ public function getConfigurationToken(Request $request, $id) {
290291
$token->expires_at = Carbon::now()->addMinutes(5); // Expire in 5 Minutes
291292
$token->save();
292293

293-
$token_response = array(
294+
$token_response = [
294295
'token' => $token->token,
295-
'expires_at' => $token->expires_at->toDateTimeString()
296-
);
296+
'expires_at' => $token->expires_at->toDateTimeString(),
297+
];
297298

298299
return response(json_encode($token_response), 200)
299300
->header('Content-Type', 'application/json');

app/Http/Controllers/Remote/RemoteController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
use Illuminate\Http\Request;
3030
use Pterodactyl\Http\Controllers\Controller;
3131
use Pterodactyl\Services\NotificationService;
32-
use Pterodactyl\Models\NodeConfigurationToken;
3332

3433
class RemoteController extends Controller
3534
{
@@ -110,20 +109,21 @@ public function event(Request $request)
110109
return response('', 201);
111110
}
112111

113-
public function getConfiguration(Request $request, $tokenString) {
112+
public function getConfiguration(Request $request, $tokenString)
113+
{
114114
// Try to query the token and the node from the database
115115
try {
116116
$token = Models\NodeConfigurationToken::where('token', $tokenString)->firstOrFail();
117117
$node = Models\Node::findOrFail($token->node);
118-
} catch(\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
119-
return response(json_encode(array('error' => 'token_invalid')), 403)
118+
} catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
119+
return response(json_encode(['error' => 'token_invalid']), 403)
120120
->header('Content-Type', 'application/json');
121121
}
122122

123123
// Check if token is expired
124124
if ($token->expires_at->lt(Carbon::now())) {
125125
$token->delete();
126-
return response(json_encode(array('error' => 'token_expired')), 403)
126+
return response(json_encode(['error' => 'token_expired']), 403)
127127
->header('Content-Type', 'application/json');
128128
}
129129

app/Models/Node.php

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -119,55 +119,58 @@ public static function guzzleRequest($node)
119119
}
120120

121121
/**
122-
* Returns the configuration in JSON format
122+
* Returns the configuration in JSON format.
123123
*
124-
* @param boolean $pretty Wether to pretty print the JSON or not
124+
* @param bool $pretty Wether to pretty print the JSON or not
125125
* @return string The configration in JSON format
126126
*/
127-
public function getConfigurationAsJson($pretty = false) {
128-
$config = array(
129-
'web' => array(
127+
public function getConfigurationAsJson($pretty = false)
128+
{
129+
$config = [
130+
'web' => [
130131
'host' => '0.0.0.0',
131132
'listen' => $this->daemonListen,
132-
'ssl' => array(
133+
'ssl' => [
133134
'enabled' => $this->scheme === 'https',
134135
'certificate' => '/etc/letsencrypt/live/localhost/fullchain.pem',
135-
'key' => '/etc/letsencrypt/live/localhost/privkey.pem'
136-
)
137-
),
138-
'docker' => array(
136+
'key' => '/etc/letsencrypt/live/localhost/privkey.pem',
137+
],
138+
],
139+
'docker' => [
139140
'socket' => '/var/run/docker.sock',
140-
'autoupdate_images' => true
141-
),
142-
'sftp' => array(
141+
'autoupdate_images' => true,
142+
],
143+
'sftp' => [
143144
'path' => $this->daemonBase,
144145
'port' => $this->daemonSFTP,
145-
'container' => 'ptdl-sftp'
146-
),
147-
'query' => array(
146+
'container' => 'ptdl-sftp',
147+
],
148+
'query' => [
148149
'kill_on_fail' => true,
149-
'fail_limit' => 5
150-
),
151-
'logger' => array(
150+
'fail_limit' => 5,
151+
],
152+
'logger' => [
152153
'path' => 'logs/',
153154
'src' => false,
154155
'level' => 'info',
155156
'period' => '1d',
156-
'count' => 3
157-
),
158-
'remote' => array(
157+
'count' => 3,
158+
],
159+
'remote' => [
159160
'base' => config('app.url'),
160161
'download' => route('remote.download'),
161-
'installed' => route('remote.install')
162-
),
163-
'uploads' => array(
164-
'size_limit' => $this->upload_size
165-
),
166-
'keys' => array($this->daemonSecret)
167-
);
162+
'installed' => route('remote.install'),
163+
],
164+
'uploads' => [
165+
'size_limit' => $this->upload_size,
166+
],
167+
'keys' => [$this->daemonSecret],
168+
];
168169

169170
$json_options = JSON_UNESCAPED_SLASHES;
170-
if ($pretty) $json_options |= JSON_PRETTY_PRINT;
171+
if ($pretty) {
172+
$json_options |= JSON_PRETTY_PRINT;
173+
}
171174

172175
return json_encode($config, $json_options);
173176
}

0 commit comments

Comments
 (0)