@@ -1,14 +1,14 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Class CLIRunner |
|
| 4 | - * |
|
| 5 | - * @filesource CLIRunner.php |
|
| 6 | - * @created 01.04.2016 |
|
| 7 | - * @package chillerlan\Threema |
|
| 8 | - * @author Smiley <[email protected]> |
|
| 9 | - * @copyright 2016 Smiley |
|
| 10 | - * @license MIT |
|
| 11 | - */ |
|
| 3 | + * Class CLIRunner |
|
| 4 | + * |
|
| 5 | + * @filesource CLIRunner.php |
|
| 6 | + * @created 01.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 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | return $this->log2cli($method->invokeArgs($this, $arguments)); |
| 104 | 104 | } |
| 105 | 105 | catch(GatewayException $gatewayException){ |
| 106 | - return $this->log2cli('ERROR: '.$gatewayException->getMessage()); |
|
| 106 | + return $this->log2cli('ERROR: ' . $gatewayException->getMessage()); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @return string |
| 119 | 119 | */ |
| 120 | 120 | protected function log2cli(string $string):string{ |
| 121 | - return PHP_EOL.wordwrap($string, 78, PHP_EOL).PHP_EOL; |
|
| 121 | + return PHP_EOL . wordwrap($string, 78, PHP_EOL) . PHP_EOL; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function help():string{ |
| 148 | 148 | // return info in case no command was found |
| 149 | - $help = 'Threema Gateway CLI tool.'.PHP_EOL; |
|
| 150 | - $help .= 'Crypto: '.$this->threemaGateway->cryptoVersion().PHP_EOL.PHP_EOL; |
|
| 149 | + $help = 'Threema Gateway CLI tool.' . PHP_EOL; |
|
| 150 | + $help .= 'Crypto: ' . $this->threemaGateway->cryptoVersion() . PHP_EOL . PHP_EOL; |
|
| 151 | 151 | |
| 152 | 152 | foreach(self::COMMANDS as $command => $method){ |
| 153 | 153 | $comment = $this->reflection->getMethod($method)->getDocComment(); |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | if(isset($p[1])){ |
| 166 | 166 | if($p[0] === 'param'){ |
| 167 | 167 | $p = (explode(' ', trim($p[1]), 3)); |
| 168 | - $name = '<'.trim($p[1], ' $').'>'; |
|
| 168 | + $name = '<' . trim($p[1], ' $') . '>'; |
|
| 169 | 169 | $paramNames[] = $name; |
| 170 | - $doc = isset($p[2]) ? $name.' '.trim($p[2]) : $name; |
|
| 170 | + $doc = isset($p[2]) ? $name . ' ' . trim($p[2]) : $name; |
|
| 171 | 171 | $paramDoc[] = $doc; |
| 172 | 172 | } |
| 173 | 173 | else if($p[0] === 'return'){ |
@@ -179,11 +179,11 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - $help .= PHP_EOL.'threema.php '.$command.' '.implode(' ', $paramNames).PHP_EOL; |
|
| 183 | - $help .= str_repeat('-', strlen($command)+12).PHP_EOL; |
|
| 184 | - $help .= PHP_EOL.$comment.PHP_EOL; |
|
| 185 | - $help .= PHP_EOL.implode(PHP_EOL, $paramDoc).PHP_EOL; |
|
| 186 | - $help .= PHP_EOL.'Returns: '.$returnDoc.PHP_EOL.PHP_EOL; |
|
| 182 | + $help .= PHP_EOL . 'threema.php ' . $command . ' ' . implode(' ', $paramNames) . PHP_EOL; |
|
| 183 | + $help .= str_repeat('-', strlen($command) + 12) . PHP_EOL; |
|
| 184 | + $help .= PHP_EOL . $comment . PHP_EOL; |
|
| 185 | + $help .= PHP_EOL . implode(PHP_EOL, $paramDoc) . PHP_EOL; |
|
| 186 | + $help .= PHP_EOL . 'Returns: ' . $returnDoc . PHP_EOL . PHP_EOL; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | return $help; |
@@ -198,15 +198,15 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | if(is_dir(dirname($privateKeyFile))){ |
| 200 | 200 | file_put_contents($privateKeyFile, $keypair->privateKey); |
| 201 | - $message .= 'Private key saved to: '.$privateKeyFile.PHP_EOL; |
|
| 201 | + $message .= 'Private key saved to: ' . $privateKeyFile . PHP_EOL; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | if(is_dir(dirname($publicKeyFile))){ |
| 205 | 205 | file_put_contents($publicKeyFile, $keypair->publicKey); |
| 206 | - $message .= 'Public key saved to: '.$publicKeyFile.PHP_EOL; |
|
| 206 | + $message .= 'Public key saved to: ' . $publicKeyFile . PHP_EOL; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - return $message.PHP_EOL.'private:'.$keypair->privateKey.PHP_EOL.'public:'.$keypair->publicKey; |
|
| 209 | + return $message . PHP_EOL . 'private:' . $keypair->privateKey . PHP_EOL . 'public:' . $keypair->publicKey; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |