title | footer |
---|---|
\leantime\domain\services\api |
false |
- Full name:
\leantime\domain\services\api
__construct
public api::__construct(): mixed
Return Value:
public api::getAPIKeyUser(mixed $apiKey): bool|array
Parameters:
Parameter | Type | Description |
---|---|---|
apiKey |
mixed |
Return Value:
createAPIKey - simple service wrapper to create a new user
public api::createAPIKey(array $values): bool|array
TODO: Should accept userModel
Parameters:
Parameter | Type | Description |
---|---|---|
values |
array | basic user values |
Return Value:
returns new user id on success, false on failure
getAPIKeys - gets api keys (users) from user table
public api::getAPIKeys(): array|false
Return Value:
Generate a random string, using a cryptographically secure pseudorandom number generator (random_int)
public api::random_str(int $length = 64, string $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'): string
This function uses type hints now (PHP 7+ only), but it was originally written for PHP 5 as well.
For PHP 7, random_int is a PHP core function For PHP 5.x, depends on https://github.com/paragonie/random_compat
Parameters:
Parameter | Type | Description |
---|---|---|
length |
int | How many characters do we want? |
keyspace |
string | A string of all possible characters to select from |
Return Value:
dispatches an event with context
public static eventhelpers::dispatch_event(string $hook, mixed $available_params = [], string|int $function = null): void
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
hook |
string | |
available_params |
mixed | |
function |
**string | int** |
Return Value:
dispatches a filter with context
public static eventhelpers::dispatch_filter(string $hook, mixed $payload, mixed $available_params = [], string|int $function = null): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
hook |
string | |
payload |
mixed | |
available_params |
mixed | |
function |
**string | int** |
Return Value:
Gets the context of the event
private static eventhelpers::get_event_context(mixed $function): string
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
function |
mixed |
Return Value:
Gets the class context based on path, this uses the same method as the autoloader Helps create unique strings for events/filters
private static eventhelpers::set_class_context(): string
- This method is static.
Return Value:
Gets the caller function name
private static eventhelpers::get_function_context(mixed $functionInt = null): string
This way we don't have to use much memory by using debug_backtrace
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
functionInt |
mixed |
Return Value:
Automatically generated from source code comments on 2023-02-28 using phpDocumentor