@@ -16,7 +16,6 @@ |
||
16 | 16 | * This method authenticate user and log them in if the supplied |
17 | 17 | * credentials are valid. |
18 | 18 | * |
19 | - * @param array $loginParams |
|
20 | 19 | * |
21 | 20 | * @return json jwt |
22 | 21 | */ |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | return $response->withJson($validateResponse, 400); |
43 | 43 | } |
44 | 44 | |
45 | - if (! $this->verifyUserRegistration($userParams['username'], $userParams['email'])) { |
|
45 | + if (!$this->verifyUserRegistration($userParams['username'], $userParams['email'])) { |
|
46 | 46 | $boolResponse = $user->createUser([ |
47 | 47 | 'firstname' => $userParams['firstname'], |
48 | 48 | 'lastname' => $userParams['lastname'], |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $tokenId = base64_encode(mcrypt_create_iv(32)); |
142 | 142 | $issuedAt = time(); |
143 | 143 | $notBefore = $issuedAt; |
144 | - $expire = (float) strtotime('+30 days'); // Adding 30 days expiry date |
|
144 | + $expire = (float) strtotime('+30 days'); // Adding 30 days expiry date |
|
145 | 145 | $serverName = 'http://localhost:8000/emojis'; // the server name |
146 | 146 | |
147 | 147 | /* |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | * Create the token params as an array |
150 | 150 | */ |
151 | 151 | $data = [ |
152 | - 'iat' => $issuedAt, // Issued at: time when the token was generated |
|
153 | - 'jti' => $tokenId, // Json Token Id: an unique identifier for the token |
|
154 | - 'iss' => $serverName, // Issuer |
|
155 | - 'nbf' => $notBefore, // Not before |
|
156 | - 'exp' => $expire, // Expire |
|
157 | - 'dat' => $userData, // User Information retrieved from the database |
|
152 | + 'iat' => $issuedAt, // Issued at: time when the token was generated |
|
153 | + 'jti' => $tokenId, // Json Token Id: an unique identifier for the token |
|
154 | + 'iss' => $serverName, // Issuer |
|
155 | + 'nbf' => $notBefore, // Not before |
|
156 | + 'exp' => $expire, // Expire |
|
157 | + 'dat' => $userData, // User Information retrieved from the database |
|
158 | 158 | ]; |
159 | 159 | |
160 | 160 | $loadEnv = DatabaseConnection::loadEnv(); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $secretKey = base64_decode(getenv('secret')); |
163 | 163 | |
164 | 164 | $jwt = JWT::encode( |
165 | - $data, //Data to be encoded in the JWT |
|
165 | + $data, //Data to be encoded in the JWT |
|
166 | 166 | $secretKey, // The signing key |
167 | 167 | 'HS512' // Algorithm used to sign the token |
168 | 168 | ); |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Temitope Olotin <[email protected]> |
|
4 | - * @license <https://opensource.org/license/MIT> MIT |
|
5 | - */ |
|
3 | + * @author Temitope Olotin <[email protected]> |
|
4 | + * @license <https://opensource.org/license/MIT> MIT |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | namespace Laztopaz\EmojiRestfulAPI; |
8 | 8 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $authHeader = $request->getHeader('HTTP_AUTHORIZATION'); |
19 | 19 | |
20 | 20 | try { |
21 | - if (is_array($authHeader) && ! empty($authHeader)) { |
|
21 | + if (is_array($authHeader) && !empty($authHeader)) { |
|
22 | 22 | $secretKey = base64_decode(getenv('secret')); |
23 | 23 | $jwt = json_decode($authHeader[0], true); |
24 | 24 | //decode the JWT using the key from config |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Temitope Olotin <[email protected]> |
|
4 | - * @license <https://opensource.org/license/MIT> MIT |
|
5 | - */ |
|
3 | + * @author Temitope Olotin <[email protected]> |
|
4 | + * @license <https://opensource.org/license/MIT> MIT |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | namespace Laztopaz\EmojiRestfulAPI; |
8 | 8 |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Temitope Olotin <[email protected]> |
|
4 | - * @license <https://opensource.org/license/MIT> MIT |
|
5 | - */ |
|
3 | + * @author Temitope Olotin <[email protected]> |
|
4 | + * @license <https://opensource.org/license/MIT> MIT |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | namespace Laztopaz\EmojiRestfulAPI; |
8 | 8 |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Temitope Olotin <[email protected]> |
|
4 | - * @license <https://opensource.org/license/MIT> MIT |
|
5 | - */ |
|
3 | + * @author Temitope Olotin <[email protected]> |
|
4 | + * @license <https://opensource.org/license/MIT> MIT |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | namespace Laztopaz\EmojiRestfulAPI; |
8 | 8 |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Temitope Olotin <[email protected]> |
|
4 | - * @license <https://opensource.org/license/MIT> MIT |
|
5 | - */ |
|
3 | + * @author Temitope Olotin <[email protected]> |
|
4 | + * @license <https://opensource.org/license/MIT> MIT |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | namespace Laztopaz\EmojiRestfulAPI; |
8 | 8 |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Temitope Olotin <[email protected]> |
|
4 | - * @license <https://opensource.org/license/MIT> MIT |
|
5 | - */ |
|
3 | + * @author Temitope Olotin <[email protected]> |
|
4 | + * @license <https://opensource.org/license/MIT> MIT |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | namespace Laztopaz\EmojiRestfulAPI; |
8 | 8 |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Temitope Olotin <[email protected]> |
|
4 | - * @license <https://opensource.org/license/MIT> MIT |
|
5 | - */ |
|
3 | + * @author Temitope Olotin <[email protected]> |
|
4 | + * @license <https://opensource.org/license/MIT> MIT |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | namespace Laztopaz\EmojiRestfulAPI; |
8 | 8 |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function createUser() |
27 | 27 | { |
28 | - if (! Capsule::schema()->hasTable('users')) { |
|
29 | - Capsule::schema()->create('users', function ($table) { |
|
28 | + if (!Capsule::schema()->hasTable('users')) { |
|
29 | + Capsule::schema()->create('users', function($table) { |
|
30 | 30 | $table->increments('id'); |
31 | 31 | $table->string('firstname'); |
32 | 32 | $table->string('lastname'); |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function createKeyword() |
45 | 45 | { |
46 | - if (! Capsule::schema()->hasTable('keywords')) { |
|
47 | - Capsule::schema()->create('keywords', function ($table) { |
|
46 | + if (!Capsule::schema()->hasTable('keywords')) { |
|
47 | + Capsule::schema()->create('keywords', function($table) { |
|
48 | 48 | $table->increments('id'); |
49 | 49 | $table->integer('emoji_id'); |
50 | 50 | $table->string('keyword_name'); |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function createCategory() |
60 | 60 | { |
61 | - if (! Capsule::schema()->hasTable('categories')) { |
|
62 | - Capsule::schema()->create('categories', function ($table) { |
|
61 | + if (!Capsule::schema()->hasTable('categories')) { |
|
62 | + Capsule::schema()->create('categories', function($table) { |
|
63 | 63 | $table->increments('id'); |
64 | 64 | $table->string('category_name'); |
65 | 65 | $table->timestamps(); |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function createEmoji() |
75 | 75 | { |
76 | - if (! Capsule::schema()->hasTable('emojis')) { |
|
77 | - Capsule::schema()->create('emojis', function ($table) { |
|
76 | + if (!Capsule::schema()->hasTable('emojis')) { |
|
77 | + Capsule::schema()->create('emojis', function($table) { |
|
78 | 78 | $table->increments('id'); |
79 | 79 | $table->string('name'); |
80 | 80 | $table->string('char'); |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Temitope Olotin <[email protected]> |
|
4 | - * @license <https://opensource.org/license/MIT> MIT |
|
5 | - */ |
|
3 | + * @author Temitope Olotin <[email protected]> |
|
4 | + * @license <https://opensource.org/license/MIT> MIT |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | namespace Laztopaz\EmojiRestfulAPI; |
8 | 8 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | * |
13 | 13 | * @param $data |
14 | 14 | * |
15 | - * @return bool true |
|
15 | + * @return boolean|null true |
|
16 | 16 | */ |
17 | 17 | public function createUser(array $data) |
18 | 18 | { |