Completed
Push — master ( 4d38d8...65c65a )
by Temitope
02:15
created
src/Auth/Oauth.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
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
      */
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         $tokenId = base64_encode(mcrypt_create_iv(32));
65 65
         $issuedAt = time();
66
-        $notBefore = $issuedAt + 10;  //Adding 10 seconds
66
+        $notBefore = $issuedAt + 10; //Adding 10 seconds
67 67
         $expire = $notBefore + (float) strtotime('+30 days'); // Adding 30 days expiry date
68 68
         $serverName = $_SERVER['HTTP_HOST']; // Retrieve the server name
69 69
 
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
          * Create the token params as an array
73 73
          */
74 74
         $data = [
75
-            'iat'  => $issuedAt,         // Issued at: time when the token was generated
76
-            'jti'  => $tokenId,          // Json Token Id: an unique identifier for the token
77
-            'iss'  => $serverName,       // Issuer
78
-            'nbf'  => $notBefore,        // Not before
79
-            'exp'  => $expire,           // Expire
80
-            'dat'  => $userData,                    // User Information retrieved from the database
75
+            'iat'  => $issuedAt, // Issued at: time when the token was generated
76
+            'jti'  => $tokenId, // Json Token Id: an unique identifier for the token
77
+            'iss'  => $serverName, // Issuer
78
+            'nbf'  => $notBefore, // Not before
79
+            'exp'  => $expire, // Expire
80
+            'dat'  => $userData, // User Information retrieved from the database
81 81
         ];
82 82
 
83 83
         $loadEnv = DatabaseConnection::loadEnv();
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $secretKey = base64_decode(getenv('secret'));
86 86
 
87 87
         $jwt = JWT::encode(
88
-        $data,      //Data to be encoded in the JWT
88
+        $data, //Data to be encoded in the JWT
89 89
         $secretKey, // The signing key
90 90
         'HS512'     // Algorithm used to sign the token
91 91
         );
Please login to merge, or discard this patch.
src/Controller/EmojiController.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -239,6 +239,7 @@
 block discarded – undo
239 239
 
240 240
     /**
241 241
      * This method authenticate and return user id
242
+     * @param Request $request
242 243
      */
243 244
     public function getCurrentUserId($request)
244 245
     {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
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
 namespace Laztopaz\EmojiRestfulAPI;
7 7
 
8 8
 use \Psr\Http\Message\ServerRequestInterface as Request;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
                 $userInfo = (array) $tokenInfo['dat'];
263 263
 
264
-             return $userInfo['id'];
264
+                return $userInfo['id'];
265 265
 
266 266
             }
267 267
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         foreach ($emojis as $key => &$value) {
232 232
             $value['created_by'] = $value['created_by']['firstname'].' '.$value['created_by']['lastname'];
233 233
             $value['category'] = $value['category']['category_name'];
234
-            $value['keywords'] = array_map(function ($key) { return $key['keyword_name']; }, $value['keywords']);
234
+            $value['keywords'] = array_map(function($key) { return $key['keyword_name']; }, $value['keywords']);
235 235
         }
236 236
 
237 237
         return $emojis;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         $authHeader = $request->getHeader('token');
248 248
 
249 249
         try {
250
-            if (is_array($authHeader) && ! empty($authHeader)) {
250
+            if (is_array($authHeader) && !empty($authHeader)) {
251 251
                 $jwtoken = $authHeader[0];
252 252
 
253 253
                 $secretKey = base64_decode(getenv('secret'));
Please login to merge, or discard this patch.
src/Controller/UserController.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      *
13 13
      * @param $data
14 14
      *
15
-     * @return int $statuscode
15
+     * @return string|null $statuscode
16 16
      */
17 17
     public function createUser(array $data)
18 18
     {
Please login to merge, or discard this patch.
src/Database/Schema.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
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
 namespace Laztopaz\EmojiRestfulAPI;
7 7
 
8 8
 use Illuminate\Database\Capsule\Manager as Capsule;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function createUser()
27 27
     {
28
-        Capsule::schema()->create('users', function ($table) {
28
+        Capsule::schema()->create('users', function($table) {
29 29
             $table->increments('id');
30 30
             $table->string('firstname');
31 31
             $table->string('lastname');
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function createKeyword()
43 43
     {
44
-        Capsule::schema()->create('keywords', function ($table) {
44
+        Capsule::schema()->create('keywords', function($table) {
45 45
             $table->increments('id');
46 46
             $table->integer('emoji_id');
47 47
             $table->string('keyword_name');
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function createCategory()
56 56
     {
57
-        Capsule::schema()->create('categories', function ($table) {
57
+        Capsule::schema()->create('categories', function($table) {
58 58
             $table->increments('id');
59 59
             $table->string('category_name');
60 60
             $table->timestamps();
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function createEmoji()
68 68
     {
69
-        Capsule::schema()->create('emojis', function ($table) {
69
+        Capsule::schema()->create('emojis', function($table) {
70 70
             $table->increments('id');
71 71
             $table->string('name');
72 72
             $table->string('char');
Please login to merge, or discard this patch.
src/Auth/Middleware.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Model/Emoji.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Model/User.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Model/Keyword.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Database/DatabaseConnection.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
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
 namespace Laztopaz\EmojiRestfulAPI;
7 7
 
8 8
 use Dotenv\Dotenv;
@@ -48,15 +48,15 @@  discard block
 block discarded – undo
48 48
         $this->capsule->bootEloquent();
49 49
     }
50 50
 
51
-     /**
52
-      * Load Dotenv to grant getenv() access to
53
-      * environment variables in .env file.
54
-      */
55
-     public static function loadEnv()
56
-     {
57
-         if (!getenv('APP_ENV')) {
58
-             $dotenv = new Dotenv(__DIR__.'/../../');
59
-             $dotenv->load();
60
-         }
61
-     }
51
+        /**
52
+         * Load Dotenv to grant getenv() access to
53
+         * environment variables in .env file.
54
+         */
55
+        public static function loadEnv()
56
+        {
57
+            if (!getenv('APP_ENV')) {
58
+                $dotenv = new Dotenv(__DIR__.'/../../');
59
+                $dotenv->load();
60
+            }
61
+        }
62 62
 }
Please login to merge, or discard this patch.