-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathPipe.php
More file actions
36 lines (30 loc) · 787 Bytes
/
Pipe.php
File metadata and controls
36 lines (30 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace Meanbee\Magedbm2\Shell;
use Symfony\Component\Process\Process;
class Pipe implements CommandInterface
{
private $commands = [];
public function command(CommandInterface $command)
{
$this->commands[] = $command;
return $this;
}
/**
* @return string
*/
public function toString(): string
{
return implode(' | ', array_map(function (CommandInterface $command) {
return $command->toString();
}, $this->commands));
}
/**
* @return Process
*
* @throws \Symfony\Component\Process\Exception\RuntimeException
*/
public function toProcess(): Process
{
return Process::fromShellCommandline($this->toString(), null, null, null, 60 * 60 * 12);
}
}