1 | <?php |
||
12 | class InteractiveProcessBuilder |
||
13 | { |
||
14 | /** |
||
15 | * Default process timeout, in seconds. |
||
16 | */ |
||
17 | const DEFAULT_TIMEOUT = 60; |
||
18 | |||
19 | /** |
||
20 | * @var InteractiveProcessManager |
||
21 | */ |
||
22 | private $manager; |
||
23 | |||
24 | /** |
||
25 | * @var UserInteraction |
||
26 | */ |
||
27 | private $userInteraction; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $command; |
||
33 | |||
34 | /** |
||
35 | * @var Pipe |
||
36 | */ |
||
37 | private $pipe; |
||
38 | |||
39 | /** |
||
40 | * @var WaitStrategy |
||
41 | */ |
||
42 | private $waitStrategy; |
||
43 | |||
44 | /** |
||
45 | * Timeout of the built process, in seconds. |
||
46 | * |
||
47 | * @var int |
||
48 | */ |
||
49 | private $timeout; |
||
50 | |||
51 | /** |
||
52 | * @param UserInteraction $userInteraction |
||
53 | */ |
||
54 | public function __construct(UserInteraction $userInteraction) |
||
59 | |||
60 | /** |
||
61 | * Set the process command. |
||
62 | * |
||
63 | * @param string $command |
||
64 | * |
||
65 | * @return InteractiveProcessBuilder |
||
66 | */ |
||
67 | public function forCommand($command) |
||
75 | |||
76 | /** |
||
77 | * @return InteractiveProcessBuilder |
||
78 | */ |
||
79 | public function disableOutput() |
||
85 | |||
86 | /** |
||
87 | * @return InteractiveProcessBuilder |
||
88 | */ |
||
89 | public function withoutTimeout() |
||
95 | |||
96 | /** |
||
97 | * Makes the process to call the given callback after the given time. |
||
98 | * |
||
99 | * @param int $milliSeconds |
||
100 | * @param callable $callback |
||
101 | * |
||
102 | * @return InteractiveProcessBuilder |
||
103 | */ |
||
104 | public function ifTakesMoreThan($milliSeconds, callable $callback) |
||
113 | |||
114 | /** |
||
115 | * Get generated process manager. |
||
116 | * |
||
117 | * @return InteractiveProcessManager |
||
118 | */ |
||
119 | public function getManager() |
||
134 | } |
||
135 |