@@ -1,8 +1,8 @@ discard block |
||
| 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 |
||
| 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 |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @return json $response |
| 50 | 50 | * |
| 51 | 51 | */ |
| 52 | - $this->slimApp->get('/', function (Request $request, Response $response) { |
|
| 52 | + $this->slimApp->get('/', function(Request $request, Response $response) { |
|
| 53 | 53 | return $response->withJson(['message' => 'Welcome to Sweet Emoji'], 200); |
| 54 | 54 | |
| 55 | 55 | }); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @return json $response |
| 65 | 65 | * |
| 66 | 66 | */ |
| 67 | - $this->slimApp->post('/', function (Request $request, Response $response) { |
|
| 67 | + $this->slimApp->post('/', function(Request $request, Response $response) { |
|
| 68 | 68 | return $response->withStatus(404); |
| 69 | 69 | |
| 70 | 70 | }); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @return json $response |
| 80 | 80 | * |
| 81 | 81 | */ |
| 82 | - $this->slimApp->post('/auth/register', function (Request $request, Response $response) use ($auth) { |
|
| 82 | + $this->slimApp->post('/auth/register', function(Request $request, Response $response) use ($auth) { |
|
| 83 | 83 | return $auth->registerUser($request, $response); |
| 84 | 84 | |
| 85 | 85 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @return json $response |
| 96 | 96 | * |
| 97 | 97 | */ |
| 98 | - $this->slimApp->post('/auth/login', function (Request $request, Response $response) use ($auth) { |
|
| 98 | + $this->slimApp->post('/auth/login', function(Request $request, Response $response) use ($auth) { |
|
| 99 | 99 | return $auth->loginUser($request, $response); |
| 100 | 100 | |
| 101 | 101 | }); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | */ |
| 115 | 115 | |
| 116 | - $this->slimApp->get('/auth/logout', function (Request $request, Response $response, $args) use ($auth) { |
|
| 116 | + $this->slimApp->get('/auth/logout', function(Request $request, Response $response, $args) use ($auth) { |
|
| 117 | 117 | return $auth->logoutUser($request, $response, $args); |
| 118 | 118 | |
| 119 | 119 | })->add(new Middleware()); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @return json $response |
| 129 | 129 | * |
| 130 | 130 | */ |
| 131 | - $this->slimApp->get('/emojis', function (Request $request, Response $response) use ($emoji) { |
|
| 131 | + $this->slimApp->get('/emojis', function(Request $request, Response $response) use ($emoji) { |
|
| 132 | 132 | return $emoji->listAllEmoji($response); |
| 133 | 133 | |
| 134 | 134 | }); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @return json $response |
| 144 | 144 | * |
| 145 | 145 | */ |
| 146 | - $this->slimApp->get('/emojis/{id}', function (Request $request, Response $response, $args) use ($emoji) { |
|
| 146 | + $this->slimApp->get('/emojis/{id}', function(Request $request, Response $response, $args) use ($emoji) { |
|
| 147 | 147 | return $emoji->getSingleEmoji($response, $args); |
| 148 | 148 | |
| 149 | 149 | }); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @return json $response |
| 159 | 159 | * |
| 160 | 160 | */ |
| 161 | - $this->slimApp->post('/emojis', function (Request $request, Response $response) use ($emoji) { |
|
| 161 | + $this->slimApp->post('/emojis', function(Request $request, Response $response) use ($emoji) { |
|
| 162 | 162 | return $emoji->createEmoji($request, $response); |
| 163 | 163 | |
| 164 | 164 | })->add(new Middleware()); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @return json $response |
| 178 | 178 | * |
| 179 | 179 | */ |
| 180 | - $this->slimApp->put('/emojis/{id}', function (Request $request, Response $response, $args) use ($emoji) { |
|
| 180 | + $this->slimApp->put('/emojis/{id}', function(Request $request, Response $response, $args) use ($emoji) { |
|
| 181 | 181 | return $emoji->updateEmojiByPutVerb($request, $response, $args); |
| 182 | 182 | |
| 183 | 183 | })->add(new Middleware()); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * @return json $response |
| 195 | 195 | * |
| 196 | 196 | */ |
| 197 | - $this->slimApp->patch('/emojis/{id}', function (Request $request, Response $response, $args) use ($emoji) { |
|
| 197 | + $this->slimApp->patch('/emojis/{id}', function(Request $request, Response $response, $args) use ($emoji) { |
|
| 198 | 198 | return $emoji->updateEmojiByPatchVerb($request, $response, $args); |
| 199 | 199 | |
| 200 | 200 | })->add(new Middleware()); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @return json $response |
| 212 | 212 | * |
| 213 | 213 | */ |
| 214 | - $this->slimApp->delete('/emojis/{id}', function (Request $request, Response $response, $args) use ($emoji) { |
|
| 214 | + $this->slimApp->delete('/emojis/{id}', function(Request $request, Response $response, $args) use ($emoji) { |
|
| 215 | 215 | return $emoji->deleteEmoji($request, $response, $args); |
| 216 | 216 | |
| 217 | 217 | })->add(new Middleware()); |
@@ -232,7 +232,7 @@ |
||
| 232 | 232 | foreach ($emojis as $key => &$value) { |
| 233 | 233 | $value['created_by'] = $value['created_by']['firstname'].' '.$value['created_by']['lastname']; |
| 234 | 234 | $value['category'] = $value['category']['category_name']; |
| 235 | - $value['keywords'] = array_map(function ($key) { return $key['keyword_name']; }, $value['keywords']); |
|
| 235 | + $value['keywords'] = array_map(function($key) { return $key['keyword_name']; }, $value['keywords']); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | return $emojis; |
@@ -254,6 +254,8 @@ |
||
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * This method authenticate and return user id |
| 257 | + * @param Request $request |
|
| 258 | + * @param Response $response |
|
| 257 | 259 | */ |
| 258 | 260 | public function getCurrentUserId($request, $response) |
| 259 | 261 | { |
@@ -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 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | */ |
| 55 | 55 | public static function loadEnv() |
| 56 | 56 | { |
| 57 | - if (! getenv('APP_ENV')) { |
|
| 57 | + if (!getenv('APP_ENV')) { |
|
| 58 | 58 | $dotenv = new Dotenv(__DIR__.'/../../'); |
| 59 | 59 | $dotenv->load(); |
| 60 | 60 | } |