Skip to content

Commit

Permalink
added possibility to add another params to the command
Browse files Browse the repository at this point in the history
  • Loading branch information
salvatore-dalessandro committed Jun 29, 2022
1 parent dee022d commit af86750
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions src/P7M.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class P7M
protected $source;
protected $destination;
protected $binPath;
protected $command;
protected $extraParam;

public function __construct(string $binPath = null)
{
Expand Down Expand Up @@ -51,6 +53,20 @@ protected function checkDestination(string $destination)
}
}

public function setCommand(string $command) : self
{
$this->command = $command;

return $this;
}

public function setExtraParam(string $extraParam) : self
{
$this->extraParam = $extraParam;

return $this;
}

public function save()
{

Expand All @@ -67,8 +83,19 @@ public function save()

}

protected function getProcess() {
$options = [$this->binPath, 'smime', '-verify', '-noverify', '-binary', '-in', $this->source, '-inform', 'DER', '-out', $this->destination];
protected function getProcess()
{
$command = 'smime';
if ($this->command) {
$command = $this->command;
}

$options = [$this->binPath, $command, '-verify', '-noverify', '-binary', '-in', $this->source, '-inform', 'DER', '-out', $this->destination];

if ($this->extraParam) {
$options[] = $this->extraParam;
}

return new Process($options);
}

Expand Down

0 comments on commit af86750

Please sign in to comment.