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

@ -2,17 +2,16 @@
namespace App\SSHCommands\Firewall;
use Illuminate\Support\Str;
trait CommandContent
{
public function content(string $os): string
public function content(): string
{
$command = Str::replace('__type__', $this->type, $this->file($os));
$command = Str::replace('__protocol__', $this->protocol, $command);
$command = Str::replace('__source__', $this->source, $command);
$command = Str::replace('__mask__', $this->mask, $command);
return Str::replace('__port__', $this->port, $command);
return str($this->file())
->replace('__type__', $this->type)
->replace('__protocol__', $this->protocol)
->replace('__source__', $this->source)
->replace('__mask__', $this->mask || $this->mask == 0 ? '/'.$this->mask : '')
->replace('__port__', $this->port)
->toString();
}
}