Doc Improvement: Rename variable c/ctx with context (#26)

This commit is contained in:
Abdullah Al Noman Prince 2024-08-29 22:22:08 +06:00 committed by GitHub
parent 9389fdd0ab
commit 3f7bf80329
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -131,7 +131,7 @@ $protectedRoutes->use(BearerAuth::bearerAuth($token, 'Unauthorized request.'));
// Custom token verification function // Custom token verification function
$app->use(BearerAuth::bearerAuth([ $app->use(BearerAuth::bearerAuth([
'verifyToken' => function($token, $ctx) { 'verifyToken' => function($token, $context) {
// Perform custom token verification logic // Perform custom token verification logic
return verifyJWT($token); return verifyJWT($token);
}, },
@ -210,7 +210,7 @@ $app->use(BasicAuth::basicAuth("user:password"));
// Use case 2: Dynamic verification // Use case 2: Dynamic verification
$app->use(BasicAuth::basicAuth([ $app->use(BasicAuth::basicAuth([
"verifyUser" => function ($username, $password, $ctx) { "verifyUser" => function ($username, $password, $context) {
// You could call a database here... // You could call a database here...
$validUsers = [ $validUsers = [
"admin" => "strongpassword", "admin" => "strongpassword",
@ -235,7 +235,7 @@ $app->use(BasicAuth::basicAuth([
); );
// Define routes for the above three use cases // Define routes for the above three use cases
$app->get("/", function (Context $ctx) { $app->get("/", function (Context $context) {
return $context->json([ return $context->json([
"status" => 'success', "status" => 'success',
"message" => "Your authentication is successful!!!" "message" => "Your authentication is successful!!!"
@ -276,7 +276,7 @@ $app->use(RequestId::requestId());
// RequestId::requestId([ // RequestId::requestId([
// "headerName" => "X-Custom-Request-Id", // "headerName" => "X-Custom-Request-Id",
// "limitLength" => 128, // "limitLength" => 128,
// "generator" => function ($ctx) { // "generator" => function ($context) {
// return uniqid("custom-", true); // return uniqid("custom-", true);
// }, // },
// ]) // ])