remove dead code
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Simon Vieille 2024-03-13 09:00:45 +01:00
parent 99d94eb54d
commit 7fe9f79d0e
Signed by: deblan
GPG key ID: 579388D585F70417

View file

@ -1,38 +0,0 @@
<?php
namespace Plugin\Helper;
function loadEnVars(array $map, array $defaults = [])
{
$container = [];
foreach ($map as $key => $value) {
if (is_array($value)) {
$container[$key] = loadEnVars($value);
} else {
$data = getenv($value);
if (false === $data) {
$data = $defaults[$value] ?? null;
}
if (str_ends_with($key, '_at') && ctype_digit($data)) {
$date = new \DateTime();
$date->setTimestamp((int) $data);
$data = $date;
} elseif (str_starts_with($key, 'is_')) {
if (in_array(strtolower($data), ['1', 'true', 'yes'])) {
$data = true;
} elseif (in_array(strtolower($data), ['0', 'false', 'no'])) {
$data = false;
} else {
$data = $defaults[$value] ?? false;
}
}
$container[$key] = $data;
}
}
return $container;
}