@@ -146,17 +146,14 @@ public function failure(string $uuid)
146146 *
147147 * @throws \Throwable
148148 */
149- public function success (string $ uuid )
149+ public function success (string $ uuid ): JsonResponse
150150 {
151151 $ server = $ this ->repository ->getByUuid ($ uuid );
152152 $ transfer = $ server ->transfer ;
153153
154154 /** @var \Pterodactyl\Models\Server $server */
155155 $ server = $ this ->connection ->transaction (function () use ($ server , $ transfer ) {
156- $ allocations = [$ transfer ->old_allocation ];
157- if (!empty ($ transfer ->old_additional_allocations )) {
158- array_push ($ allocations , $ transfer ->old_additional_allocations );
159- }
156+ $ allocations = array_merge ([$ transfer ->old_allocation ], $ transfer ->old_additional_allocations );
160157
161158 // Remove the old allocations for the server and re-assign the server to the new
162159 // primary allocation and node.
@@ -173,7 +170,7 @@ public function success(string $uuid)
173170 });
174171
175172 // Delete the server from the old node making sure to point it to the old node so
176- // that we do not delete it from the new node the server was transfered to.
173+ // that we do not delete it from the new node the server was transferred to.
177174 try {
178175 $ this ->daemonServerRepository
179176 ->setServer ($ server )
@@ -199,11 +196,7 @@ protected function processFailedTransfer(ServerTransfer $transfer)
199196 $ this ->connection ->transaction (function () use (&$ transfer ) {
200197 $ transfer ->forceFill (['successful ' => false ])->saveOrFail ();
201198
202- $ allocations = [$ transfer ->new_allocation ];
203- if (!empty ($ transfer ->new_additional_allocations )) {
204- array_push ($ allocations , $ transfer ->new_additional_allocations );
205- }
206-
199+ $ allocations = array_merge ([$ transfer ->new_allocation ], $ transfer ->new_additional_allocations );
207200 Allocation::query ()->whereIn ('id ' , $ allocations )->update (['server_id ' => null ]);
208201 });
209202
0 commit comments