refactoring

This commit is contained in:
Saeed Vaziry
2023-08-04 18:28:04 +02:00
parent 8444323cf4
commit 643318fcfc
349 changed files with 3189 additions and 2729 deletions

View File

@ -4,34 +4,24 @@
use App\SSHCommands\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
class UploadToDropboxCommand extends Command
{
protected $src;
protected $dest;
protected $token;
public function __construct($src, $dest, $token)
public function __construct(protected string $src, protected string $dest, protected string $token)
{
$this->src = $src;
$this->dest = $dest;
$this->token = $token;
}
public function file(string $os): string
public function file(): string
{
return File::get(base_path('system/commands/common/storage/upload-to-dropbox.sh'));
return File::get(resource_path('commands/storage/upload-to-dropbox.sh'));
}
public function content(string $os): string
public function content(): string
{
$command = $this->file($os);
$command = Str::replace('__src__', $this->src, $command);
$command = Str::replace('__dest__', $this->dest, $command);
return Str::replace('__token__', $this->token, $command);
return str($this->file())
->replace('__src__', $this->src)
->replace('__dest__', $this->dest)
->replace('__token__', $this->token)
->toString();
}
}