Initial commit

This commit is contained in:
Rekryt
2024-08-30 15:22:24 +03:00
commit 171e449744
46 changed files with 4638 additions and 0 deletions

33
src/functions.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
namespace OpenCCK;
/**
* @param string $key
* @return ?string
*/
function getEnv(string $key): ?string {
if (!isset($_ENV[$key])) {
return null;
}
if (preg_match('/^"(.*)"$/i', $_ENV[$key], $matches)) {
return $matches[1];
}
return $_ENV[$key];
}
/**
* Debug function
* @param mixed $mixed
* @param bool $exit
* @return void
*/
function dbg(mixed $mixed, bool $exit = true): void {
if (php_sapi_name() == 'cli') {
echo print_r($mixed, true);
} else {
echo '<pre>' . print_r($mixed, true) . '</pre>';
}
if ($exit) {
exit();
}
}