[Process] added some constant to avoid harcoded strings
This commit is contained in:
parent
766b88fd21
commit
c2e8a0a24a
@ -21,6 +21,9 @@ namespace Symfony\Component\Process;
|
||||
*/
|
||||
class Process
|
||||
{
|
||||
const ERR = 'err';
|
||||
const OUT = 'out';
|
||||
|
||||
private $commandline;
|
||||
private $cwd;
|
||||
private $env;
|
||||
@ -93,7 +96,7 @@ class Process
|
||||
$that = $this;
|
||||
$callback = function ($type, $data) use ($that, $callback)
|
||||
{
|
||||
if ('out' == $type) {
|
||||
if (self::OUT == $type) {
|
||||
$that->addOutput($data);
|
||||
} else {
|
||||
$that->addErrorOutput($data);
|
||||
@ -156,7 +159,7 @@ class Process
|
||||
$type = array_search($pipe, $pipes);
|
||||
$data = fread($pipe, 8192);
|
||||
if (strlen($data) > 0) {
|
||||
call_user_func($callback, $type == 1 ? 'out' : 'err', $data);
|
||||
call_user_func($callback, $type == 1 ? self::OUT : self::ERR, $data);
|
||||
}
|
||||
if (false === $data || feof($pipe)) {
|
||||
fclose($pipe);
|
||||
|
Reference in New Issue
Block a user