generated from Nodarx/template
feat: initial version
Signed-off-by: Sebastian Krupinski <root@LAPTOP-7DVOR6NC>
This commit was merged in pull request #1.
This commit is contained in:
40
lib/Client/Protocol/Command/Command.php
Normal file
40
lib/Client/Protocol/Command/Command.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Command;
|
||||
|
||||
use Gricob\IMAP\Protocol\Command\Argument\Argument;
|
||||
use Stringable;
|
||||
|
||||
abstract readonly class Command implements Stringable
|
||||
{
|
||||
private string $command;
|
||||
|
||||
/**
|
||||
* @var Argument[]
|
||||
*/
|
||||
private array $arguments;
|
||||
|
||||
public function __construct(
|
||||
string $command,
|
||||
Argument ...$arguments,
|
||||
) {
|
||||
$this->command = $command;
|
||||
$this->arguments = $arguments;
|
||||
}
|
||||
|
||||
public function command(): string
|
||||
{
|
||||
return $this->command;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return sprintf(
|
||||
'%s %s',
|
||||
$this->command,
|
||||
implode(' ', $this->arguments)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user