Skip to content

Commit

Permalink
improvements on class SwooleLibrary
Browse files Browse the repository at this point in the history
  • Loading branch information
deminy committed Dec 11, 2023
1 parent 10cb62b commit 0581d26
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,31 @@ function _array(array $array = []): Swoole\ArrayObject

class SwooleLibrary
{
public static $options = [];
/**
* @var array<string, mixed>
*/
public static array $options = [];
}

function swoole_library_set_options(array $options)
/**
* @param array<string, mixed> $options
*/
function swoole_library_set_options(array $options): void
{
SwooleLibrary::$options = $options;
}

function swoole_library_get_options()
function swoole_library_get_options(): array
{
return SwooleLibrary::$options;
}

function swoole_library_set_option(string $key, $value)
function swoole_library_set_option(string $key, mixed $value): void
{
SwooleLibrary::$options[$key] = $value;
}

function swoole_library_get_option(string $key)
function swoole_library_get_option(string $key): mixed
{
return SwooleLibrary::$options[$key] ?? null;
}
Expand Down

0 comments on commit 0581d26

Please sign in to comment.