@@ -1,14 +1,14 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Class GatewayEndpoint |
|
| 4 | - * |
|
| 5 | - * @filesource GatewayEndpoint.php |
|
| 6 | - * @created 02.04.2016 |
|
| 7 | - * @package chillerlan\Threema |
|
| 8 | - * @author Smiley <[email protected]> |
|
| 9 | - * @copyright 2016 Smiley |
|
| 10 | - * @license MIT |
|
| 11 | - */ |
|
| 3 | + * Class GatewayEndpoint |
|
| 4 | + * |
|
| 5 | + * @filesource GatewayEndpoint.php |
|
| 6 | + * @created 02.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 | |
@@ -198,7 +198,7 @@ |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
| 201 | - * @param $email |
|
| 201 | + * @param string $email |
|
| 202 | 202 | * |
| 203 | 203 | * @return string |
| 204 | 204 | * @throws \chillerlan\Threema\GatewayException |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | return $this->log2cli($method->invokeArgs($this, $arguments)); |
| 107 | 107 | } |
| 108 | 108 | catch(GatewayException $gatewayException){ |
| 109 | - return $this->log2cli('ERROR: '.$gatewayException->getMessage()); |
|
| 109 | + return $this->log2cli('ERROR: ' . $gatewayException->getMessage()); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @return string |
| 122 | 122 | */ |
| 123 | 123 | protected function log2cli(string $string):string{ |
| 124 | - return PHP_EOL.wordwrap($string, 78, PHP_EOL).PHP_EOL; |
|
| 124 | + return PHP_EOL . wordwrap($string, 78, PHP_EOL) . PHP_EOL; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | if(isset($p[1])){ |
| 165 | 165 | if($p[0] === 'param'){ |
| 166 | 166 | $p = (explode(' ', trim($p[1]), 3)); |
| 167 | - $name = '<'.trim($p[1], ' $').'>'; |
|
| 167 | + $name = '<' . trim($p[1], ' $') . '>'; |
|
| 168 | 168 | $parsed->paramNames[] = $name; |
| 169 | - $doc = isset($p[2]) ? $name.' '.trim($p[2]) : $name; |
|
| 169 | + $doc = isset($p[2]) ? $name . ' ' . trim($p[2]) : $name; |
|
| 170 | 170 | $parsed->paramDoc[] = $doc; |
| 171 | 171 | } |
| 172 | 172 | else if($p[0] === 'return'){ |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | public function help():string{ |
| 189 | 189 | // return info in case no command was found |
| 190 | - $help = 'Threema Gateway CLI tool.'.PHP_EOL; |
|
| 191 | - $help .= 'Crypto: '.$this->threemaGateway->cryptoVersion().PHP_EOL.PHP_EOL; |
|
| 190 | + $help = 'Threema Gateway CLI tool.' . PHP_EOL; |
|
| 191 | + $help .= 'Crypto: ' . $this->threemaGateway->cryptoVersion() . PHP_EOL . PHP_EOL; |
|
| 192 | 192 | |
| 193 | 193 | foreach(self::COMMANDS as $command => $method){ |
| 194 | 194 | $comment = $this->reflection->getMethod($method)->getDocComment(); |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | $comment = trim(array_shift($params)); |
| 199 | 199 | $parsed = $this->parseDocBlock($params); |
| 200 | 200 | |
| 201 | - $help .= PHP_EOL.'threema.php '.$command.' '.$parsed->paramNames.PHP_EOL; |
|
| 202 | - $help .= str_repeat('-', strlen($command) + 12).PHP_EOL; |
|
| 203 | - $help .= PHP_EOL.$comment.PHP_EOL; |
|
| 204 | - $help .= PHP_EOL.$parsed->paramDoc.PHP_EOL; |
|
| 205 | - $help .= PHP_EOL.'Returns: '.$parsed->returnDoc.PHP_EOL.PHP_EOL; |
|
| 201 | + $help .= PHP_EOL . 'threema.php ' . $command . ' ' . $parsed->paramNames . PHP_EOL; |
|
| 202 | + $help .= str_repeat('-', strlen($command) + 12) . PHP_EOL; |
|
| 203 | + $help .= PHP_EOL . $comment . PHP_EOL; |
|
| 204 | + $help .= PHP_EOL . $parsed->paramDoc . PHP_EOL; |
|
| 205 | + $help .= PHP_EOL . 'Returns: ' . $parsed->returnDoc . PHP_EOL . PHP_EOL; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | return $help; |
@@ -218,15 +218,15 @@ discard block |
||
| 218 | 218 | // @todo: check writable |
| 219 | 219 | if(!empty($privateKeyFile) && is_dir(dirname($privateKeyFile))){ |
| 220 | 220 | file_put_contents($privateKeyFile, $keypair->privateKey); |
| 221 | - $message .= 'Private key saved to: '.$privateKeyFile.PHP_EOL; |
|
| 221 | + $message .= 'Private key saved to: ' . $privateKeyFile . PHP_EOL; |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | if(!empty($publicKeyFile) && is_dir(dirname($publicKeyFile))){ |
| 225 | 225 | file_put_contents($publicKeyFile, $keypair->publicKey); |
| 226 | - $message .= 'Public key saved to: '.$publicKeyFile.PHP_EOL; |
|
| 226 | + $message .= 'Public key saved to: ' . $publicKeyFile . PHP_EOL; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - return $message.PHP_EOL.'private:'.$keypair->privateKey.PHP_EOL.'public:'.$keypair->publicKey; |
|
| 229 | + return $message . PHP_EOL . 'private:' . $keypair->privateKey . PHP_EOL . 'public:' . $keypair->publicKey; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |