Code Duplication    Length = 8-9 lines in 2 locations

src/Executor.php 2 locations

@@ 112-119 (lines=8) @@
109
110
		$process = proc_open($command, $pipeSpec, $pipes);
111
112
		if($options['inputContent']) {
113
			fwrite($pipes[0], $options['inputContent']);
114
115
		} else if($options['inputStream']) {
116
			while($content = fread($options['inputStream'], 8192)) {
117
				fwrite($pipes[0], $content);
118
			}
119
		}
120
		if(isset($pipes[0])) fclose($pipes[0]);
121
122
		$result = array();
@@ 128-136 (lines=9) @@
125
			// If a stream was provided, then pipe all the content
126
			// Doing it this way rather than passing outputStream to $pipeSpec
127
			// Means that streams as well as simple FDs can be used
128
			if($options['outputStream']) {
129
				while($content = fread($pipes[1], 8192)) {
130
					fwrite($options['outputStream'], $content);
131
				}
132
133
			// Otherwise save to a string
134
			} else {
135
				$result['output'] = stream_get_contents($pipes[1]);
136
			}
137
			fclose($pipes[1]);
138
		}
139
		if(isset($pipes[2])) {