Skip to content

Commit

Permalink
Merge pull request #1471 from xerc/fix-exmpl
Browse files Browse the repository at this point in the history
Fix return declarations @ example
  • Loading branch information
Sephster authored Feb 5, 2025
2 parents 34a14d3 + 7b8fba9 commit d4ef047
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Example implementations
# Example implementations (via [`Slim 3`](https://github.com/slimphp/Slim/tree/3.x))

## Installation

0. Run `composer install` in this directory to install dependencies
0. Create a private key `openssl genrsa -out private.key 2048`
0. Create a public key `openssl rsa -in private.key -pubout > public.key`
0. `cd` into the public directory
0. Start a PHP server `php -S localhost:4444`
0. Export the public key `openssl rsa -in private.key -pubout > public.key`
0. Start local PHP server `php -S 127.0.0.1:4444 -t public/`

## Testing the client credentials grant example

Expand Down
8 changes: 4 additions & 4 deletions examples/src/Repositories/AuthCodeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@ class AuthCodeRepository implements AuthCodeRepositoryInterface
/**
* {@inheritdoc}
*/
public function persistNewAuthCode(AuthCodeEntityInterface $authCodeEntity)
public function persistNewAuthCode(AuthCodeEntityInterface $authCodeEntity): void
{
// Some logic to persist the auth code to a database
}

/**
* {@inheritdoc}
*/
public function revokeAuthCode($codeId)
public function revokeAuthCode($codeId): void
{
// Some logic to revoke the auth code in a database
}

/**
* {@inheritdoc}
*/
public function isAuthCodeRevoked($codeId)
public function isAuthCodeRevoked($codeId): bool
{
return false; // The auth code has not been revoked
}

/**
* {@inheritdoc}
*/
public function getNewAuthCode()
public function getNewAuthCode(): AuthCodeEntityInterface
{
return new AuthCodeEntity();
}
Expand Down

0 comments on commit d4ef047

Please sign in to comment.