Heyday\Vend\TokenManager
This class is responsible for returning the token, saving it into the database, getting the first ever token after setup, and refreshing the token if expired Class TokenManager
Synopsis
class TokenManager
{
- // methods
- public void __construct()
- public bool send()
- public bool setTokens()
- public mixed getToken()
- public static bool hasTokenExpired()
- public bool getFirstToken()
- public bool refreshToken()
Methods
public
- __construct() — Loading all the neede variables
- getFirstToken() — Get the first token. Only ever called the first time from Authorise_Controller.php
- getToken() — Return the token, refresh it if expired
- hasTokenExpired() — Checks if token has expired. Added a minute for extra safety
- refreshToken() — Refresh the token
- send() — Making the curl call to the api and calling setTokens() on success
- setTokens() — set the tokens in the DB