Skip to content

Commit d2dfd2b

Browse files
author
Muhammad Umer Farooq
authored
Merge pull request #4 from Lablnet/analysis-XWvMLj
Apply fixes from StyleCI
2 parents 8a80098 + 14697da commit d2dfd2b

File tree

5 files changed

+33
-32
lines changed

5 files changed

+33
-32
lines changed

example/index.php

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
<?php
2-
use Lablnet\Encryption;
3-
require '../vendor/autoload.php';
4-
5-
$encryption = new Encryption("daskfasdjf432f4sd54ggfadgfs4df564asd");
6-
7-
//Encrypt the message
8-
$encrypt = $encryption->encrypt("This is a text");
9-
10-
echo "Encrypted text: ".$encrypt;
11-
echo "<br\>";
12-
13-
//Decrypt the message
14-
$decrypt = $encryption->decrypt($encrypt);
15-
echo "Decrypted/plain text: ".$decrypt;
1+
<?php
2+
3+
use Lablnet\Encryption;
4+
5+
require '../vendor/autoload.php';
6+
7+
$encryption = new Encryption('daskfasdjf432f4sd54ggfadgfs4df564asd');
8+
9+
//Encrypt the message
10+
$encrypt = $encryption->encrypt('This is a text');
11+
12+
echo 'Encrypted text: '.$encrypt;
13+
echo "<br\>";
14+
15+
//Decrypt the message
16+
$decrypt = $encryption->decrypt($encrypt);
17+
echo 'Decrypted/plain text: '.$decrypt;

src/Adapter/OpenSslEncryption.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
class OpenSslEncryption
2020
{
21-
2221
/**
2322
* Store the cipher iv.
2423
*

src/Adapter/SodiumEncryption.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct($key)
3030
}
3131

3232
//should use user define key.
33-
$this->key = substr(hash('sha512', $key),0, 32);
33+
$this->key = substr(hash('sha512', $key), 0, 32);
3434
}
3535

3636
/**

src/Encryption.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class Encryption
3333
* @note This property is not a part of Zest Framework.
3434
*
3535
* @var mixed
36-
*/
37-
private $key = '';
38-
36+
*/
37+
private $key = '';
38+
3939
/**
4040
* __construct.
4141
*
@@ -44,7 +44,7 @@ class Encryption
4444
public function __construct($key, $adapter = null)
4545
{
4646
($adapter !== null) ? $this->setAdapter($adapter) : $this->setAdapter('openssl');
47-
$this->setKey($key);
47+
$this->setKey($key);
4848
}
4949

5050
/**
@@ -74,7 +74,7 @@ public function setAdapter($adapter)
7474

7575
return $this;
7676
}
77-
77+
7878
/**
7979
* Set the encryption key for openSSL.
8080
*
@@ -83,14 +83,14 @@ public function setAdapter($adapter)
8383
* @note This method is not a part of Zest Framework.
8484
*
8585
* @return mixed
86-
*/
87-
public function setKey($key)
88-
{
89-
$this->key = $key;
90-
91-
return $this;
92-
}
93-
86+
*/
87+
public function setKey($key)
88+
{
89+
$this->key = $key;
90+
91+
return $this;
92+
}
93+
9494
/**
9595
* Encrypt the message.
9696
*

tests/EncryptionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class EncryptionTest extends TestCase
2323
{
2424
public function testEncryptAndDecryptWithOpenSsl()
2525
{
26-
$encryption = new Encryption('12345678990-=====-===','openssl');
26+
$encryption = new Encryption('12345678990-=====-===', 'openssl');
2727
$encryptedString = $encryption->encrypt('plain-text');
2828
$decryptedString = $encryption->decrypt($encryptedString);
2929

@@ -34,7 +34,7 @@ public function testEncryptAndDecryptWithOpenSsl()
3434

3535
public function testEncryptAndDecryptWithSodium()
3636
{
37-
$encryption = new Encryption('euyq74tjfdskjFDSGq74','sodium');
37+
$encryption = new Encryption('euyq74tjfdskjFDSGq74', 'sodium');
3838
$encryptedString = $encryption->encrypt('plain-text');
3939
$decryptedString = $encryption->decrypt($encryptedString);
4040

0 commit comments

Comments
 (0)