Completed
Push — master ( f7b062...534c81 )
by smiley
02:36
created
src/CLIRunnerInterface.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Interface CLIRunnerInterface
4
- *
5
- * @filesource   CLIRunnerInterface.php
6
- * @created      03.04.2016
7
- * @package      chillerlan\Threema
8
- * @author       Smiley <[email protected]>
9
- * @copyright    2016 Smiley
10
- * @license      MIT
11
- */
3
+	 * Interface CLIRunnerInterface
4
+	 *
5
+	 * @filesource   CLIRunnerInterface.php
6
+	 * @created      03.04.2016
7
+	 * @package      chillerlan\Threema
8
+	 * @author       Smiley <[email protected]>
9
+	 * @copyright    2016 Smiley
10
+	 * @license      MIT
11
+	 */
12 12
 
13 13
 namespace chillerlan\Threema;
14 14
 
Please login to merge, or discard this patch.
src/CLIRunner.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 				return $this->log2cli($method->invokeArgs($this, $arguments));
102 102
 			}
103 103
 			catch(GatewayException $gatewayException){
104
-				return $this->log2cli('ERROR: '.$gatewayException->getMessage());
104
+				return $this->log2cli('ERROR: ' . $gatewayException->getMessage());
105 105
 			}
106 106
 		}
107 107
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @return string
117 117
 	 */
118 118
 	protected function log2cli(string $string):string{
119
-		return PHP_EOL.wordwrap($string, 78, PHP_EOL).PHP_EOL;
119
+		return PHP_EOL . wordwrap($string, 78, PHP_EOL) . PHP_EOL;
120 120
 	}
121 121
 
122 122
 	/**
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 			if(isset($p[1])){
160 160
 				if($p[0] === 'param'){
161 161
 					$p                    = (explode(' ', trim($p[1]), 3));
162
-					$name                 = '<'.trim($p[1], ' $').'>';
162
+					$name                 = '<' . trim($p[1], ' $') . '>';
163 163
 					$parsed->paramNames[] = $name;
164
-					$doc                  = isset($p[2]) ? $name.' '.trim($p[2]) : $name;
164
+					$doc                  = isset($p[2]) ? $name . ' ' . trim($p[2]) : $name;
165 165
 					$parsed->paramDoc[]   = $doc;
166 166
 				}
167 167
 				else if($p[0] === 'return'){
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	public function help():string{
184 184
 		// return info in case no command was found
185
-		$help = 'Threema Gateway CLI tool.'.PHP_EOL;
186
-		$help .= 'Crypto: '.$this->threemaGateway->cryptoVersion().PHP_EOL.PHP_EOL;
185
+		$help = 'Threema Gateway CLI tool.' . PHP_EOL;
186
+		$help .= 'Crypto: ' . $this->threemaGateway->cryptoVersion() . PHP_EOL . PHP_EOL;
187 187
 
188 188
 		foreach(self::COMMANDS as $command => $method){
189 189
 			$comment = $this->reflection->getMethod($method)->getDocComment();
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 			$comment = trim(array_shift($params));
194 194
 			$parsed  = $this->parseDocBlock($params);
195 195
 
196
-			$help .= PHP_EOL.'threema.php '.$command.' '.$parsed->paramNames.PHP_EOL;
197
-			$help .= str_repeat('-', strlen($command) + 12).PHP_EOL;
198
-			$help .= PHP_EOL.$comment.PHP_EOL;
199
-			$help .= PHP_EOL.$parsed->paramDoc.PHP_EOL;
200
-			$help .= PHP_EOL.'Returns: '.$parsed->returnDoc.PHP_EOL.PHP_EOL;
196
+			$help .= PHP_EOL . 'threema.php ' . $command . ' ' . $parsed->paramNames . PHP_EOL;
197
+			$help .= str_repeat('-', strlen($command) + 12) . PHP_EOL;
198
+			$help .= PHP_EOL . $comment . PHP_EOL;
199
+			$help .= PHP_EOL . $parsed->paramDoc . PHP_EOL;
200
+			$help .= PHP_EOL . 'Returns: ' . $parsed->returnDoc . PHP_EOL . PHP_EOL;
201 201
 		}
202 202
 
203 203
 		return $help;
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
 		// @todo: check writable
214 214
 		if(is_dir(dirname($path))){
215 215
 			$bytes = file_put_contents($path, $data);
216
-			return $bytes.' bytes written to: '.$path.PHP_EOL;
216
+			return $bytes . ' bytes written to: ' . $path . PHP_EOL;
217 217
 		}
218 218
 		// or is not writable
219
-		return $path.' does not exist'; // @codeCoverageIgnore
219
+		return $path . ' does not exist'; // @codeCoverageIgnore
220 220
 	}
221 221
 
222 222
 	/**
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 	public function getKeypair(string $privateKeyFile = null, string $publicKeyFile = null):string{
226 226
 		$keypair  = $this->cryptoInterface->getKeypair();
227 227
 		$message  = !empty($privateKeyFile) ? $this->writeFile($privateKeyFile, $keypair->privateKey) : '';
228
-		$message .= !empty($publicKeyFile)  ? $this->writeFile($publicKeyFile, $keypair->publicKey)   : '';
228
+		$message .= !empty($publicKeyFile) ? $this->writeFile($publicKeyFile, $keypair->publicKey) : '';
229 229
 
230
-		return $message.PHP_EOL.'private:'.$keypair->privateKey.PHP_EOL.'public:'.$keypair->publicKey;
230
+		return $message . PHP_EOL . 'private:' . $keypair->privateKey . PHP_EOL . 'public:' . $keypair->publicKey;
231 231
 	}
232 232
 
233 233
 	/**
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	public function encryptFile(string $privateKey, string $publicKey, string $plaintextFile, string $encryptedFile):string{
286 286
 		$encrypted = $this->cryptoInterface->encrypt(file_get_contents($plaintextFile), $privateKey, $publicKey);
287
-		return $this->writeFile($encryptedFile, $encrypted->nonce."\n".$encrypted->box);
287
+		return $this->writeFile($encryptedFile, $encrypted->nonce . "\n" . $encrypted->box);
288 288
 	}
289 289
 
290 290
 	/**
Please login to merge, or discard this patch.