vito/app/ServerTypes/AbstractType.php
2024-03-06 20:33:33 +01:00

27 lines
574 B
PHP
Executable File

<?php
namespace App\ServerTypes;
use App\Contracts\ServerType;
use App\Models\Server;
use Closure;
abstract class AbstractType implements ServerType
{
protected Server $server;
public function __construct(Server $server)
{
$this->server = $server;
}
protected function progress(int $percentage, ?string $step = null): Closure
{
return function () use ($percentage, $step) {
$this->server->progress = $percentage;
$this->server->progress_step = $step;
$this->server->save();
};
}
}