Completed
Push — master ( 59d00e...88e4b3 )
by Temitope
02:33
created
src/Auth/Oauth.php 3 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.
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.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $tokenId = base64_encode(mcrypt_create_iv(32));
67 67
         $issuedAt = time();
68
-        $notBefore = $issuedAt;  //Adding 10 seconds
68
+        $notBefore = $issuedAt; //Adding 10 seconds
69 69
         $expire = $notBefore + (float) strtotime('+30 days'); // Adding 30 days expiry date
70 70
         $serverName = "http://sweatemoji.com/api"; // Retrieve the server name
71 71
 
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
          * Create the token params as an array
75 75
          */
76 76
         $data = [
77
-            'iat'  => $issuedAt,         // Issued at: time when the token was generated
78
-            'jti'  => $tokenId,          // Json Token Id: an unique identifier for the token
79
-            'iss'  => $serverName,       // Issuer
80
-            'nbf'  => $notBefore,        // Not before
81
-            'exp'  => $expire,           // Expire
77
+            'iat'  => $issuedAt, // Issued at: time when the token was generated
78
+            'jti'  => $tokenId, // Json Token Id: an unique identifier for the token
79
+            'iss'  => $serverName, // Issuer
80
+            'nbf'  => $notBefore, // Not before
81
+            'exp'  => $expire, // Expire
82 82
 
83 83
             'dat'  => $userData                   // User Information retrieved from the database
84 84
         ];
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         $secretKey = base64_decode(getenv('secret'));
89 89
 
90 90
         $jwt = JWT::encode(
91
-        $data,      //Data to be encoded in the JWT
91
+        $data, //Data to be encoded in the JWT
92 92
         $secretKey, // The signing key
93 93
         'HS512'     // Algorithm used to sign the token
94 94
         );
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.
src/Route/SlimRouteApp.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             'settings' => [
32 32
             'debug' => true,
33 33
             'displayErrorDetails' => true,
34
-            ],]);
34
+            ], ]);
35 35
         
36 36
         $this->runEmojiRoute();
37 37
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         * @return json $response
57 57
         *
58 58
         */
59
-        $this->slimApp->get('/', function (Request $request, Response $response) {
59
+        $this->slimApp->get('/', function(Request $request, Response $response) {
60 60
             return $response->withJson(['status'], 404);
61 61
 
62 62
         });
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         * @return json $response
72 72
         *
73 73
         */
74
-        $this->slimApp->post('/', function (Request $request, Response $response) {
74
+        $this->slimApp->post('/', function(Request $request, Response $response) {
75 75
             return $response->withJson(['status'], 404);
76 76
 
77 77
         });
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         * @return json $response
87 87
         *
88 88
         */
89
-        $this->slimApp->post('/auth/login', function (Request $request, Response $response) use ($auth) {
89
+        $this->slimApp->post('/auth/login', function(Request $request, Response $response) use ($auth) {
90 90
             return $auth->loginUser($request, $response);
91 91
 
92 92
         });
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         *
105 105
         */
106 106
 
107
-        $this->slimApp->get('/auth/logout', function (Request $request, Response $response, $args) use ($auth) {
107
+        $this->slimApp->get('/auth/logout', function(Request $request, Response $response, $args) use ($auth) {
108 108
             return $auth->logoutUser($request, $response, $args)->withJson(['status'], 200);
109 109
 
110 110
         })->add(new Middleware());
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         * @return json $response
120 120
         *
121 121
         */
122
-        $this->slimApp->get('/emojis', function (Request $request, Response $response) use ($emoji) {
122
+        $this->slimApp->get('/emojis', function(Request $request, Response $response) use ($emoji) {
123 123
             return $emoji->listAllEmoji($response);
124 124
 
125 125
         });
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         * @return json $response
135 135
         *
136 136
         */
137
-        $this->slimApp->get('/emojis/{id}', function (Request $request, Response $response, $args) use ($emoji) {
137
+        $this->slimApp->get('/emojis/{id}', function(Request $request, Response $response, $args) use ($emoji) {
138 138
             return  $emoji->getSingleEmoji($response, $args)->withJson(['status'], 200);
139 139
 
140 140
         });
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         * @return json $response
150 150
         *
151 151
         */
152
-        $this->slimApp->post('/emojis', function (Request $request, Response $response) use ($emoji) {
152
+        $this->slimApp->post('/emojis', function(Request $request, Response $response) use ($emoji) {
153 153
             return $emoji->createEmoji($request, $response)->withJson(['status'], 200);
154 154
 
155 155
         })->add(new Middleware());
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         * @return json $response
169 169
         *
170 170
         */
171
-        $this->slimApp->put('/emojis/{id}', function (Request $request, Response $response, $args) use ($emoji) {
171
+        $this->slimApp->put('/emojis/{id}', function(Request $request, Response $response, $args) use ($emoji) {
172 172
             return $emoji->updateEmojiByPutVerb($request, $response, $args);
173 173
 
174 174
         })->add(new Middleware());
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         * @return json $response
186 186
         *
187 187
         */
188
-        $this->slimApp->patch('/emojis/{id}', function (Request $request, Response $response, $args) use ($emoji) {
188
+        $this->slimApp->patch('/emojis/{id}', function(Request $request, Response $response, $args) use ($emoji) {
189 189
             return $emoji->updateEmojiByPatchVerb($request, $response, $args);
190 190
 
191 191
         })->add(new Middleware());
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         * @return json $response
203 203
         *
204 204
         */
205
-        $this->slimApp->delete('/emojis/{id}', function (Request $request, Response $response, $args) use ($emoji) {
205
+        $this->slimApp->delete('/emojis/{id}', function(Request $request, Response $response, $args) use ($emoji) {
206 206
             return $emoji->deleteEmoji($request, $response, $args);
207 207
 
208 208
         })->add(new Middleware());
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
 
7 7
 namespace Laztopaz\EmojiRestfulAPI;
8 8
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         $auth = $this->auth;
47 47
         $emoji = $this->emoji;
48 48
 
49
-       /*
49
+        /*
50 50
         * This verb returns error 404
51 51
         *
52 52
         * @param $request
Please login to merge, or discard this patch.