Completed
Push — 123 ( d13f38 )
by Vasily
05:11
created
app-examples/ExampleWithMySQL.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	 * Creates Request.
24 24
 	 * @param object Request.
25 25
 	 * @param object Upstream application instance.
26
-	 * @return object Request.
26
+	 * @return ExampleWithMySQLRequest Request.
27 27
 	 */
28 28
 	public function beginRequest($req, $upstream) {
29 29
 		
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @return integer Status.
79 79
 	 */
80 80
 	public function run() {		
81
-		try {$this->header('Content-Type: text/html');} catch (Exception $e) {}
81
+		try {$this->header('Content-Type: text/html'); } catch (Exception $e) {}
82 82
 			
83 83
 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
84 84
 <html xmlns="http://www.w3.org/1999/xhtml">
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 } else {
101 101
 	echo '<h1>Something went wrong! We have no result.</h1>';
102 102
 }
103
-echo '<br />Request (http) took: '.round(microtime(TRUE) - $this->attrs->server['REQUEST_TIME_FLOAT'],6);
103
+echo '<br />Request (http) took: ' . round(microtime(TRUE) - $this->attrs->server['REQUEST_TIME_FLOAT'], 6);
104 104
 ?>
105 105
 </body>
106 106
 </html>
Please login to merge, or discard this patch.
app-examples/ExampleWithPostgreSQL.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 	 * Creates Request.
13 13
 	 * @param object Request.
14 14
 	 * @param object Upstream application instance.
15
-	 * @return object Request.
15
+	 * @return ExampleWithPostgreSQLRequest Request.
16 16
 	 */
17 17
 	 public function beginRequest($req, $upstream) {
18 18
 		return new ExampleWithPostgreSQLRequest($this, $upstream, $req);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 	 * @return integer Status.
54 54
 	 */
55 55
 	public function run() {
56
-		try {$this->header('Content-Type: text/html');} catch (Exception $e) {}
56
+		try {$this->header('Content-Type: text/html'); } catch (Exception $e) {}
57 57
 		?>
58 58
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
59 59
 <html xmlns="http://www.w3.org/1999/xhtml">
Please login to merge, or discard this patch.
app-examples/ExampleWithRedis.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	 * Creates Request.
25 25
 	 * @param object Request.
26 26
 	 * @param object Upstream application instance.
27
-	 * @return object Request.
27
+	 * @return ExampleWithRedisRequest Request.
28 28
 	 */
29 29
 	public function beginRequest($req, $upstream) {
30 30
 		return new ExampleWithRedisRequest($this, $upstream, $req);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		
57 57
 			$redis->lrange('mylist', 0, 10, function($redis) use ($name, $job) { // calling lrange Redis command
58 58
 				
59
-				$job->setResult($name, $redis->result);  // setting job result
59
+				$job->setResult($name, $redis->result); // setting job result
60 60
 				
61 61
 			});
62 62
 		});
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @return integer Status.
72 72
 	 */
73 73
 	public function run() {		
74
-		try {$this->header('Content-Type: text/html');} catch (Exception $e) {}
74
+		try {$this->header('Content-Type: text/html'); } catch (Exception $e) {}
75 75
 ?>
76 76
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
77 77
 <html xmlns="http://www.w3.org/1999/xhtml">
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 } else {
89 89
 	echo '<h1>Something went wrong! We have no result.</h1>';
90 90
 }
91
-echo '<br />Request (http) took: '.round(microtime(TRUE) - $this->attrs->server['REQUEST_TIME_FLOAT'],6);
91
+echo '<br />Request (http) took: ' . round(microtime(TRUE) - $this->attrs->server['REQUEST_TIME_FLOAT'], 6);
92 92
 ?>
93 93
 </body>
94 94
 </html>
Please login to merge, or discard this patch.
app-web/CGI.php 3 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * Creates Request.
51 51
 	 * @param object Request.
52 52
 	 * @param object Upstream application instance.
53
-	 * @return object Request.
53
+	 * @return CGIRequest Request.
54 54
 	 */
55 55
 	public function beginRequest($req, $upstream) {
56 56
 		return new CGIRequest($this, $upstream, $req);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 	/**
127 127
 	 * Called when request iterated.
128
-	 * @return void
128
+	 * @return integer
129 129
 	 */
130 130
 	public function run() {
131 131
 		if (!$this->proc) {
@@ -155,6 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 	/**
157 157
 	 * Called when the request aborted.
158
+	 * @param AsyncProcess $process
158 159
 	 * @return void
159 160
 	 */
160 161
 	public function onWrite($process) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 class CGI extends AppInstance {
10 10
 
11
-	public $binPath = 'php-cgi';   // Default bin-path
11
+	public $binPath = 'php-cgi'; // Default bin-path
12 12
 	public $binAliases = array(
13 13
 		'php5'   => '/usr/local/php/bin/php-cgi',
14 14
 		'php6'   => '/usr/local/php6/bin/php-cgi',
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 		'ruby'   => '/usr/local/bin/ruby',
18 18
 	);
19 19
 
20
-	public $chroot = '/';          // default chroot
20
+	public $chroot = '/'; // default chroot
21 21
 
22 22
 	/**
23 23
 	 * Setting default config options
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 
72 72
 		$this->proc = new AsyncProcess;
73 73
 		$this->proc->readPacketSize = $this->appInstance->readPacketSize;
74
-		$this->proc->onReadData(array($this,'onReadData'));
75
-		$this->proc->onWrite(array($this,'onWrite'));
74
+		$this->proc->onReadData(array($this, 'onReadData'));
75
+		$this->proc->onWrite(array($this, 'onWrite'));
76 76
 		$this->proc->binPath = $this->appInstance->binPath;
77 77
 		$this->proc->chroot = $this->appInstance->chroot;
78 78
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@  discard block
 block discarded – undo
79 79
 		if (isset($this->attrs->server['BINPATH'])) {
80 80
 			if (isset($this->appInstance->binAliases[$this->attrs->server['BINPATH']])) {
81 81
 				$this->proc->binPath = $this->appInstance->binAliases[$this->attrs->server['BINPATH']];
82
-			}
83
-			elseif ($this->appInstance->config->allowoverridebinpath->value) {
82
+			} elseif ($this->appInstance->config->allowoverridebinpath->value) {
84 83
 				$this->proc->binPath = $this->attrs->server['BINPATH'];
85 84
 			}
86 85
 		}
@@ -111,8 +110,7 @@  discard block
 block discarded – undo
111 110
 			&& $this->appInstance->config->allowoverridecwd->value
112 111
 		) {
113 112
 			$this->proc->cwd = $this->attrs->server['CWD'];
114
-		}
115
-		elseif ($this->appInstance->config->cwd->value !== NULL) {
113
+		} elseif ($this->appInstance->config->cwd->value !== NULL) {
116 114
 			$this->proc->cwd = $this->appInstance->config->cwd->value;
117 115
 		} else {
118 116
 			$this->proc->cwd = dirname($this->attrs->server['SCRIPT_FILENAME']);
Please login to merge, or discard this patch.
app-web/FileReader.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 	 * Creates Request.
37 37
 	 * @param object Request.
38 38
 	 * @param object Upstream application instance.
39
-	 * @return object Request.
39
+	 * @return FileReaderRequest Request.
40 40
 	 */
41 41
 	public function beginRequest($req, $upstream) {
42 42
 		return new FileReaderRequest($this, $upstream, $req);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 				}
76 76
 				if ($stat['type'] === 'd') {
77 77
 					if (!FS::$supported) {
78
-						$req->file(rtrim($path,'/') . '/index.html');
78
+						$req->file(rtrim($path, '/') . '/index.html');
79 79
 					}
80
-					else $job('readdir', function ($name, $job) use ($path, $req) {
81
-						FS::readdir(rtrim($path,'/'), function ($path, $dir) use ($job, $req) {
80
+					else $job('readdir', function($name, $job) use ($path, $req) {
81
+						FS::readdir(rtrim($path, '/'), function($path, $dir) use ($job, $req) {
82 82
 							$found = false;
83 83
 							if (is_array($dir)) {
84 84
 								foreach ($dir['dents'] as $file) {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		try {
115 115
 			$req->header('404 Not Found');
116 116
 			$req->header('Content-Type: text/html');
117
-		} catch (RequestHeadersAlreadySent $e ) {}
117
+		} catch (RequestHeadersAlreadySent $e) {}
118 118
 		$req->out('File not found.');
119 119
 	}
120 120
 	public function file($path) {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		}
126 126
 		$req = $this;
127 127
 		$job = $this->job;
128
-		$job('readfile', function ($name, $job) use ($req, $path) {
128
+		$job('readfile', function($name, $job) use ($req, $path) {
129 129
 			$req->sendfile($path, function($file, $success) use ($job, $name) {
130 130
 				$job->setResult($name);
131 131
 			});
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,10 +76,11 @@
 block discarded – undo
76 76
 				if ($stat['type'] === 'd') {
77 77
 					if (!FS::$supported) {
78 78
 						$req->file(rtrim($path,'/') . '/index.html');
79
-					}
80
-					else $job('readdir', function ($name, $job) use ($path, $req) {
79
+					} else {
80
+						$job('readdir', function ($name, $job) use ($path, $req) {
81 81
 						FS::readdir(rtrim($path,'/'), function ($path, $dir) use ($job, $req) {
82 82
 							$found = false;
83
+					}
83 84
 							if (is_array($dir)) {
84 85
 								foreach ($dir['dents'] as $file) {
85 86
 									if ($file['type'] === EIO_DT_REG) { // is file
Please login to merge, or discard this patch.
app-web/WebSocketOverCOMET.php 3 patches
Doc Comments   +9 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * Creates Request.
49 49
 	 * @param object Request.
50 50
 	 * @param object Upstream application instance.
51
-	 * @return object Request.
51
+	 * @return WebSocketOverCOMET_Request Request.
52 52
 	 */
53 53
 	public function beginRequest($req, $upstream) {
54 54
 		$req = new WebSocketOverCOMET_Request($this, $upstream, $req);
@@ -120,6 +120,11 @@  discard block
 block discarded – undo
120 120
 	public $finished = false;
121 121
 	public $timeout = 30; // 30
122 122
 	public $server;
123
+
124
+	/**
125
+	 * @param WebSocketOverCOMET $appInstance
126
+	 * @param string $authKey
127
+	 */
123 128
 	public function __construct($route, $appInstance, $authKey) {
124 129
 		$this->polling = new SplStack;
125 130
 		$this->callbacks = new StackCallbacks;
@@ -166,6 +171,9 @@  discard block
 block discarded – undo
166 171
 		}
167 172
 	}
168 173
 
174
+	/**
175
+	 * @param double $b
176
+	 */
169 177
 	public function compareFloats($a, $b, $precision = 3) {
170 178
 		$k = pow(10, $precision);
171 179
 		$a = round($a * $k) / $k;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		} else {
65 65
 			$body = '<script type="text/javascript">';
66 66
 			foreach ($packets as $packet) {
67
-				$body .= 'WebSocket.onmessage('.json_encode(array('type' => $packet[0], 'data' => $packet[1])). ");\n";
67
+				$body .= 'WebSocket.onmessage(' . json_encode(array('type' => $packet[0], 'data' => $packet[1])) . ");\n";
68 68
 			}
69 69
 			$body .= "</script>\n";
70 70
 		}
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @return void
182 182
 	 */
183 183
 	public function flushBufferedPackets($ts = NULL) {
184
-		if ($this->polling->isEmpty()|| !sizeof($this->bufferedPackets)) {
184
+		if ($this->polling->isEmpty() || !sizeof($this->bufferedPackets)) {
185 185
 			return;
186 186
 		}
187 187
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 			else {
273 273
 				list ($workerId, $this->reqIdAuthKey) = explode('.', $id, 2);
274 274
 				$workerId = (int) $workerId;
275
-				$this->appInstance->directCall($workerId, 'c2s', array($this->reqIdAuthKey,	$data));
275
+				$this->appInstance->directCall($workerId, 'c2s', array($this->reqIdAuthKey, $data));
276 276
 			}
277 277
 			if (sizeof($ret)) {
278 278
 				echo json_encode($ret);
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -262,14 +262,12 @@  discard block
 block discarded – undo
262 262
 			$id = self::getString($_REQUEST['_id']);
263 263
 			if (strpos($id, '.') === false) {
264 264
 					$ret['error'] = 'Bad cookie.';
265
-			}
266
-			elseif (
265
+			} elseif (
267 266
 				!isset($_REQUEST['data']) 
268 267
 				|| !is_string($_REQUEST['data'])
269 268
 			) {
270 269
 				$ret['error'] = 'No data.';
271
-			}
272
-			else {
270
+			} else {
273 271
 				list ($workerId, $this->reqIdAuthKey) = explode('.', $id, 2);
274 272
 				$workerId = (int) $workerId;
275 273
 				$this->appInstance->directCall($workerId, 'c2s', array($this->reqIdAuthKey,	$data));
@@ -331,8 +329,7 @@  discard block
 block discarded – undo
331 329
 			$id = self::getString($_REQUEST['_id']);
332 330
 			if (strpos($id, '.') === false) {
333 331
 				$ret['error'] = 'Bad cookie.';
334
-			}
335
-			else {
332
+			} else {
336 333
 				list ($workerId, $this->reqIdAuthKey) = explode('.', $id, 2);
337 334
 				$workerId = (int) $workerId;
338 335
 				$this->appInstance->directCall($workerId, 'poll', array(
Please login to merge, or discard this patch.
lib/AppInstance.php 4 patches
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	/**
88 88
 	 * Function to get default config options from application
89 89
 	 * Override to set your own
90
-	 * @return array|false
90
+	 * @return boolean
91 91
 	 */
92 92
 	protected function getConfigDefaults() {
93 93
 		return false;
@@ -113,6 +113,7 @@  discard block
 block discarded – undo
113 113
 	 * @param string Method name.
114 114
 	 * @param array Arguments.
115 115
 	 * @param mixed Callback.
116
+	 * @param string $method
116 117
 	 * @return boolean Success.
117 118
 	 */
118 119
 	public function broadcastCall($method, $args = array(), $cb = NULL) {
@@ -250,7 +251,7 @@  discard block
 block discarded – undo
250 251
 	/** 
251 252
 	 * Shutdown the application instance
252 253
 	 * @param boolean Graceful?
253
-	 * @return void
254
+	 * @return boolean
254 255
 	 */
255 256
 	public function shutdown($graceful = false) {
256 257
 		return $this->onShutdown($graceful);
@@ -275,7 +276,7 @@  discard block
 block discarded – undo
275 276
 	/**
276 277
 	 * Handle the worker status
277 278
 	 * @param int Status code @todo use constants in method
278
-	 * @return boolean Result
279
+	 * @return null|boolean Result
279 280
 	 */
280 281
 	public function handleStatus($ret) {
281 282
 		if ($ret === self::EVENT_CONFIG_UPDATED) {
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 	
163 163
 
164 164
  	/**
165
-	 * Process default config
166
-	 * @todo move it to Daemon_Config class
167
-	 * @param array {"setting": "value"}
168
-	 * @return void
169
-	 */
165
+ 	 * Process default config
166
+ 	 * @todo move it to Daemon_Config class
167
+ 	 * @param array {"setting": "value"}
168
+ 	 * @return void
169
+ 	 */
170 170
 	public function processDefaultConfig($settings = array()) {
171 171
 		foreach ($settings as $k => $v) {
172 172
 			$k = strtolower(str_replace('-', '', $k));
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		}
237 237
 		$className = $this->requestClass;
238 238
 		return new $className($this, $upstream, $req);
239
-    }
239
+	}
240 240
 
241 241
 	/**
242 242
 	 * Log something
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class AppInstance {
11 11
 
12
-	public $status = 0;        // runtime status
13
-	public $passphrase;        // optional passphrase
14
-	public $ready = FALSE;     // ready to start?
15
-	public $name;              // name of instance
12
+	public $status = 0; // runtime status
13
+	public $passphrase; // optional passphrase
14
+	public $ready = FALSE; // ready to start?
15
+	public $name; // name of instance
16 16
 	public $config;
17 17
 	public $enableRPC = false;
18 18
 	public $requestClass;
@@ -172,16 +172,16 @@  discard block
 block discarded – undo
172 172
 			$k = strtolower(str_replace('-', '', $k));
173 173
 
174 174
 			if (!isset($this->config->{$k})) {
175
-			  if (is_scalar($v))	{
175
+			  if (is_scalar($v)) {
176 176
 					$this->config->{$k} = new Daemon_ConfigEntry($v);
177 177
 				} else {
178 178
 					$this->config->{$k} = $v;
179 179
 				}
180 180
 			} elseif ($v instanceof Daemon_ConfigSection) {
181 181
 			// @todo
182
-			}	else {
182
+			} else {
183 183
 				$current = $this->config->{$k};
184
-			  if (is_scalar($v))	{
184
+			  if (is_scalar($v)) {
185 185
 					$this->config->{$k} = new Daemon_ConfigEntry($v);
186 186
 				} else {
187 187
 					$this->config->{$k} = $v;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@
 block discarded – undo
179 179
 				}
180 180
 			} elseif ($v instanceof Daemon_ConfigSection) {
181 181
 			// @todo
182
-			}	else {
182
+			} else {
183 183
 				$current = $this->config->{$k};
184 184
 			  if (is_scalar($v))	{
185 185
 					$this->config->{$k} = new Daemon_ConfigEntry($v);
Please login to merge, or discard this patch.
lib/AsyncProcess.php 2 patches
Doc Comments   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	/**
72 72
 	 * Sets an array of arguments
73 73
 	 * @param array Arguments
74
-	 * @return object AsyncProccess
74
+	 * @return AsyncProcess AsyncProccess
75 75
 	 */
76 76
 	public function setArgs($args = NULL) {
77 77
 		$this->args = $args;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	/**
83 83
 	 * Set a hash of environment's variables
84 84
 	 * @param array Hash of environment's variables
85
-	 * @return object AsyncProccess
85
+	 * @return AsyncProcess AsyncProccess
86 86
 	 */
87 87
 	public function setEnv($env = NULL) {
88 88
 		$this->env = $env;
@@ -93,7 +93,8 @@  discard block
 block discarded – undo
93 93
 	/**
94 94
 	 * Set priority.
95 95
 	 * @param integer Priority
96
-	 * @return object AsyncProccess
96
+	 * @param integer $nice
97
+	 * @return AsyncProcess AsyncProccess
97 98
 	 */
98 99
 	public function nice($nice = NULL) {
99 100
 		$this->nice = $nice;
@@ -106,7 +107,8 @@  discard block
 block discarded – undo
106 107
 	 * @param string Optional. Binpath.
107 108
 	 * @param array Optional. Arguments.
108 109
 	 * @param array Optional. Hash of environment's variables.
109
-	 * @return object AsyncProccess
110
+	 * @param string $binPath
111
+	 * @return AsyncProcess AsyncProccess
110 112
 	 */
111 113
 	public function execute($binPath = NULL, $args = NULL, $env = NULL) {
112 114
 		if ($binPath !== NULL) {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -41,21 +41,21 @@  discard block
 block discarded – undo
41 41
 	public $outputErrors = false;
42 42
 
43 43
 	// @todo make methods setUser and setGroup, variables change to $user and $group with null values
44
-	public $setUser;                               // optinal SUID.
45
-	public $setGroup;                              // optional SGID.
44
+	public $setUser; // optinal SUID.
45
+	public $setGroup; // optional SGID.
46 46
 
47 47
 	// @todo the same, make a method setChroot
48
-	public $chroot = '/';                          // optional chroot.
48
+	public $chroot = '/'; // optional chroot.
49 49
 
50
-	public $env = array();                         // hash of environment's variables
50
+	public $env = array(); // hash of environment's variables
51 51
 
52 52
 	// @todo setCwd
53
-	public $cwd;                                   // optional chdir
54
-	public $errlogfile = '/tmp/cgi-errorlog.log';  // path to error logfile
55
-	public $args;                                  // array of arguments
53
+	public $cwd; // optional chdir
54
+	public $errlogfile = '/tmp/cgi-errorlog.log'; // path to error logfile
55
+	public $args; // array of arguments
56 56
 
57 57
 	// @todo setNice
58
-	public $nice;                                  // optional priority
58
+	public $nice; // optional priority
59 59
  
60 60
 	/**
61 61
 	 * AsyncProcess constructor
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 				&& isset($this->setGroup) 
141 141
 				&& ($this->setUser !== $this->setGroup)
142 142
 			) {
143
-				$this->cmd = 'sudo -g ' . escapeshellarg($this->setGroup). '  -u ' . escapeshellarg($this->setUser) . ' ' . $this->cmd;
143
+				$this->cmd = 'sudo -g ' . escapeshellarg($this->setGroup) . '  -u ' . escapeshellarg($this->setUser) . ' ' . $this->cmd;
144 144
 			} else {
145 145
 				$this->cmd = 'su ' . escapeshellarg($this->setGroup) . ' -c ' . escapeshellarg($this->cmd);
146 146
 			}
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 		}
156 156
 
157 157
 		$pipesDescr = array(
158
-			0 => array('pipe', 'r'),  // stdin is a pipe that the child will read from
159
-			1 => array('pipe', 'w'),  // stdout is a pipe that the child will write to
158
+			0 => array('pipe', 'r'), // stdin is a pipe that the child will read from
159
+			1 => array('pipe', 'w'), // stdout is a pipe that the child will write to
160 160
 		);
161 161
 
162 162
 		if (
Please login to merge, or discard this patch.
lib/AsyncStream.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -33,6 +33,9 @@  discard block
 block discarded – undo
33 33
 	public $filePath;
34 34
 	public $useSockets = true;
35 35
 
36
+	/**
37
+	 * @param string $readFD
38
+	 */
36 39
 	public function __construct($readFD = NULL, $writeFD = NULL) {
37 40
 		$this->initStream($readFD, $writeFD);
38 41
 	}
@@ -275,6 +278,9 @@  discard block
 block discarded – undo
275 278
 		return $this;
276 279
 	}
277 280
 
281
+	/**
282
+	 * @param Closure $cb
283
+	 */
278 284
 	public function onEOF($cb = NULL) {
279 285
 		$this->onEOF = $cb;
280 286
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		return $r;
51 51
 	}
52 52
 	
53
-	public function initStream($readFD = NULL,$writeFD = NULL) {
53
+	public function initStream($readFD = NULL, $writeFD = NULL) {
54 54
 		if (is_string($readFD)) {
55 55
 			$u = parse_url($url = $readFD);
56 56
 		
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		}
105 105
 	
106 106
 		if ($readFD !== NULL) {
107
-			$this->setFD($readFD,$writeFD);
107
+			$this->setFD($readFD, $writeFD);
108 108
 		}
109 109
 
110 110
 		return $readFD !== FALSE;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		}
171 171
 
172 172
 		if (!is_resource($this->writeFD)) {
173
-			throw new BadStreamDescriptorException('wrong writeFD',1);
173
+			throw new BadStreamDescriptorException('wrong writeFD', 1);
174 174
 		}
175 175
 
176 176
 		if ($this->writeBuf === NULL) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@  discard block
 block discarded – undo
65 65
 						$readFD = FALSE;
66 66
 					}
67 67
 				}
68
-			}
69
-			elseif (
68
+			} elseif (
70 69
 				($u['scheme'] === 'tcp') 
71 70
 				|| ($u['scheme'] === 'tcpstream')
72 71
 			) {
@@ -83,8 +82,7 @@  discard block
 block discarded – undo
83 82
 						$readFD = FALSE;
84 83
 					}
85 84
 				}
86
-			}
87
-			elseif ($u['scheme'] === 'udp') {
85
+			} elseif ($u['scheme'] === 'udp') {
88 86
 				if (!$this->useSockets) {
89 87
 					$readFD = stream_socket_client($readFD, $errno, $errstr, 1);
90 88
 				} else {
@@ -95,8 +93,7 @@  discard block
 block discarded – undo
95 93
 						$readFD = FALSE;
96 94
 					}
97 95
 				}
98
-			}
99
-			elseif ($u['scheme'] === 'file') {
96
+			} elseif ($u['scheme'] === 'file') {
100 97
 				$this->filePath = substr($url, 7);
101 98
 				$readFD = @fopen($this->filePath, 'r');
102 99
 				$this->fileMode = TRUE;
@@ -435,8 +432,7 @@  discard block
 block discarded – undo
435 432
 			)
436 433
 		) {
437 434
 			$this->onEofEvent();
438
-		}
439
-		elseif (
435
+		} elseif (
440 436
 			!$this->EOF 
441 437
 			&& $this->noEvents
442 438
 		) {
@@ -461,8 +457,7 @@  discard block
 block discarded – undo
461 457
 			}
462 458
 
463 459
 			$this->eof();
464
-		}
465
-		elseif ($this->onRead !== NULL) {
460
+		} elseif ($this->onRead !== NULL) {
466 461
 			call_user_func($this->onRead, $this);
467 462
 		}
468 463
 	}
Please login to merge, or discard this patch.