Completed
Push — master ( eeb508...81ffa3 )
by smiley
03:01
created
src/BoxKeypair.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 use const SODIUM_CRYPTO_BOX_SECRETKEYBYTES, SODIUM_CRYPTO_BOX_SEEDBYTES;
19 19
 
20
-class BoxKeypair extends CryptoKeypairAbstract{
20
+class BoxKeypair extends CryptoKeypairAbstract {
21 21
 
22 22
 	/**
23 23
 	 * @inheritdoc
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	public function create(string $seed_bin = null):CryptoKeypairInterface{
28 28
 
29
-		if($seed_bin !== null && strlen($seed_bin) !== SODIUM_CRYPTO_BOX_SEEDBYTES){
29
+		if ($seed_bin !== null && strlen($seed_bin) !== SODIUM_CRYPTO_BOX_SEEDBYTES) {
30 30
 			throw new CryptoException('invalid seed length');
31 31
 		}
32 32
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		$this->secret = sodium_crypto_box_secretkey($this->keypair);
38 38
 		$this->public = sodium_crypto_box_publickey($this->keypair);
39 39
 
40
-		if($seed_bin !== null){
40
+		if ($seed_bin !== null) {
41 41
 			sodium_memzero($seed_bin);
42 42
 		}
43 43
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function createFromSecret(string $secret_bin):CryptoKeypairInterface{
54 54
 
55
-		if(strlen($secret_bin) !== SODIUM_CRYPTO_BOX_SECRETKEYBYTES){
55
+		if (strlen($secret_bin) !== SODIUM_CRYPTO_BOX_SECRETKEYBYTES) {
56 56
 			throw new CryptoException('invalid secret key length');
57 57
 		}
58 58
 
Please login to merge, or discard this patch.
src/SignKeypair.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 use const SODIUM_CRYPTO_SIGN_SEEDBYTES;
19 19
 
20
-class SignKeypair extends CryptoKeypairAbstract{
20
+class SignKeypair extends CryptoKeypairAbstract {
21 21
 
22 22
 	/**
23 23
 	 * @inheritdoc
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	public function create(string $seed_bin = null):CryptoKeypairInterface{
28 28
 
29
-		if($seed_bin !== null && strlen($seed_bin) !== SODIUM_CRYPTO_SIGN_SEEDBYTES){
29
+		if ($seed_bin !== null && strlen($seed_bin) !== SODIUM_CRYPTO_SIGN_SEEDBYTES) {
30 30
 			throw new CryptoException('invalid seed length');
31 31
 		}
32 32
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 		sodium_memzero($keypair);
42 42
 
43
-		if($seed_bin !== null){
43
+		if ($seed_bin !== null) {
44 44
 			sodium_memzero($seed_bin);
45 45
 		}
46 46
 
Please login to merge, or discard this patch.
src/CryptoBoxAbstract.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  * @link https://paragonie.com/book/pecl-libsodium/read/00-intro.md
19 19
  * @link https://paragonie.com/book/pecl-libsodium/read/01-quick-start.md
20 20
  */
21
-abstract class CryptoBoxAbstract implements CryptoBoxInterface{
21
+abstract class CryptoBoxAbstract implements CryptoBoxInterface {
22 22
 
23 23
 	/**
24 24
 	 * @var \chillerlan\Cryptobox\CryptoKeypairInterface
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @param \chillerlan\Cryptobox\CryptoKeypairInterface|null $keypair
47 47
 	 */
48
-	public function __construct(CryptoKeypairInterface $keypair = null){
48
+	public function __construct(CryptoKeypairInterface $keypair = null) {
49 49
 		$this->keypair = $keypair;
50 50
 	}
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return mixed|null
56 56
 	 */
57
-	public function __get(string $property){
57
+	public function __get(string $property) {
58 58
 		return property_exists($this, $property) ? $this->{$property} : null;
59 59
 	}
60 60
 
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	protected function checkKeypair(int $secretLength = null, int $publicLength = null):void{
69 69
 
70
-		if($secretLength !== null && (!$this->keypair->secret || strlen($this->keypair->secret) !== $secretLength)){
70
+		if ($secretLength !== null && (!$this->keypair->secret || strlen($this->keypair->secret) !== $secretLength)) {
71 71
 			throw new CryptoException('invalid secret key');
72 72
 		}
73 73
 
74
-		if($publicLength !== null && (!$this->keypair->public || strlen($this->keypair->public) !== $publicLength)){
74
+		if ($publicLength !== null && (!$this->keypair->public || strlen($this->keypair->public) !== $publicLength)) {
75 75
 			throw new CryptoException('invalid public key');
76 76
 		}
77 77
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	protected function checkMessage(string $message):string{
87 87
 		$message = trim($message);
88 88
 
89
-		if(empty($message)){
89
+		if (empty($message)) {
90 90
 			throw new CryptoException('invalid message');
91 91
 		}
92 92
 
Please login to merge, or discard this patch.
src/SealedBox.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 use const SODIUM_CRYPTO_BOX_PUBLICKEYBYTES, SODIUM_CRYPTO_BOX_SECRETKEYBYTES;
19 19
 
20
-class SealedBox extends CryptoBoxAbstract{
20
+class SealedBox extends CryptoBoxAbstract {
21 21
 
22 22
 	/** @inheritdoc */
23 23
 	public function create(string $message):CryptoBoxInterface{
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		sodium_memzero($keypair);
45 45
 		sodium_memzero($box_bin);
46 46
 
47
-		if($this->message !== false){
47
+		if ($this->message !== false) {
48 48
 			return $this;
49 49
 		}
50 50
 
Please login to merge, or discard this patch.
src/SignedMessage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 use const SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES, SODIUM_CRYPTO_SIGN_SECRETKEYBYTES;
18 18
 
19
-class SignedMessage extends CryptoBoxAbstract{
19
+class SignedMessage extends CryptoBoxAbstract {
20 20
 
21 21
 	/** @inheritdoc */
22 22
 	public function create(string $message):CryptoBoxInterface{
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 		sodium_memzero($box_bin);
43 43
 
44
-		if($this->message !== false){
44
+		if ($this->message !== false) {
45 45
 			return $this;
46 46
 		}
47 47
 
Please login to merge, or discard this patch.
src/Box.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 use const SODIUM_CRYPTO_BOX_NONCEBYTES, SODIUM_CRYPTO_BOX_PUBLICKEYBYTES, SODIUM_CRYPTO_BOX_SECRETKEYBYTES;
19 19
 
20
-class Box extends CryptoBoxAbstract{
20
+class Box extends CryptoBoxAbstract {
21 21
 
22 22
 	/**
23 23
 	 * @param string      $message
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		sodium_memzero($keypair);
37 37
 		sodium_memzero($message);
38 38
 
39
-		if($nonce_bin !== null){
39
+		if ($nonce_bin !== null) {
40 40
 			sodium_memzero($nonce_bin);
41 41
 		}
42 42
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		sodium_memzero($box_bin);
61 61
 		sodium_memzero($nonce_bin);
62 62
 
63
-		if($this->message !== false){
63
+		if ($this->message !== false) {
64 64
 			return $this;
65 65
 		}
66 66
 
Please login to merge, or discard this patch.
src/CryptoException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,4 +14,4 @@
 block discarded – undo
14 14
 
15 15
 use Exception;
16 16
 
17
-class CryptoException extends Exception{}
17
+class CryptoException extends Exception {}
Please login to merge, or discard this patch.
src/SecretBox.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 use const SODIUM_CRYPTO_BOX_NONCEBYTES, SODIUM_CRYPTO_BOX_SECRETKEYBYTES;
18 18
 
19
-class SecretBox extends CryptoBoxAbstract{
19
+class SecretBox extends CryptoBoxAbstract {
20 20
 
21 21
 	/**
22 22
 	 * @param string      $message
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 		sodium_memzero($message);
35 35
 
36
-		if($nonce_bin !== null){
36
+		if ($nonce_bin !== null) {
37 37
 			sodium_memzero($nonce_bin);
38 38
 		}
39 39
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 		$this->message = sodium_crypto_secretbox_open($box_bin, $nonce_bin, $this->keypair->secret);
54 54
 
55
-		if($this->message !== false){
55
+		if ($this->message !== false) {
56 56
 			return $this;
57 57
 		}
58 58
 
Please login to merge, or discard this patch.