1 | <?php |
||
24 | class ProcessManager implements ConfigAwareInterface |
||
25 | { |
||
26 | use ConfigAwareTrait; |
||
27 | |||
28 | protected $transportFactories = []; |
||
29 | |||
30 | public function __construct() |
||
34 | |||
35 | /** |
||
36 | * createDefault creates a Transport manager and add the default transports to it. |
||
37 | */ |
||
38 | public static function createDefault() |
||
47 | |||
48 | /** |
||
49 | * Return a site process configured with an appropriate transport |
||
50 | * |
||
51 | * @param AliasRecord $siteAlias Target for command |
||
52 | * @param array $args Command arguments |
||
53 | * @param array $options Associative array of command options |
||
54 | * @param array $optionsPassedAsArgs Associtive array of options to be passed as arguments (after double-dash) |
||
55 | * @return Process |
||
56 | */ |
||
57 | public function siteProcess(AliasRecord $siteAlias, $args = [], $options = [], $optionsPassedAsArgs = []) |
||
63 | |||
64 | /** |
||
65 | * Create a Process instance from a commandline string. |
||
66 | * @param array $command The command to run and its arguments listed as separate entries |
||
67 | * @param string|null $cwd The working directory or null to use the working dir of the current PHP process |
||
68 | * @param array|null $env The environment variables or null to use the same environment as the current PHP process |
||
69 | * @param mixed|null $input The input as stream resource, scalar or \Traversable, or null for no input |
||
70 | * @param int|float|null $timeout The timeout in seconds or null to disable |
||
71 | * @return Process |
||
72 | */ |
||
73 | public function process($command, $cwd = null, array $env = null, $input = null, $timeout = 60) |
||
77 | |||
78 | /** |
||
79 | * Create a Process instance from a commandline string. |
||
80 | * @param string $command The commandline string to run |
||
81 | * @param string|null $cwd The working directory or null to use the working dir of the current PHP process |
||
82 | * @param array|null $env The environment variables or null to use the same environment as the current PHP process |
||
83 | * @param mixed|null $input The input as stream resource, scalar or \Traversable, or null for no input |
||
84 | * @param int|float|null $timeout The timeout in seconds or null to disable |
||
85 | * @return Process |
||
86 | */ |
||
87 | public function shell($command, $cwd = null, array $env = null, $input = null, $timeout = 60) |
||
91 | |||
92 | /** |
||
93 | * add a transport factory to our factory list |
||
94 | * @param TransportFactoryInterface $factory |
||
95 | */ |
||
96 | public function add(TransportFactoryInterface $factory) |
||
101 | |||
102 | /** |
||
103 | * hasTransport determines if there is a transport that handles the |
||
104 | * provided site alias. |
||
105 | * |
||
106 | * @param AliasRecord $siteAlias |
||
107 | * @return boolean |
||
108 | */ |
||
109 | public function hasTransport(AliasRecord $siteAlias) |
||
113 | |||
114 | /** |
||
115 | * getTransport returns a transport that is applicable to the provided site alias. |
||
116 | * |
||
117 | * @param AliasRecord $siteAlias |
||
118 | * @return TransportInterface |
||
119 | */ |
||
120 | public function getTransport(AliasRecord $siteAlias) |
||
128 | |||
129 | /** |
||
130 | * getTransportFactory returns a factory for the provided site alias. |
||
131 | * |
||
132 | * @param AliasRecord $siteAlias |
||
133 | * @return TransportFactoryInterface |
||
134 | */ |
||
135 | protected function getTransportFactory(AliasRecord $siteAlias) |
||
144 | } |
||
145 |