24 if (\is_numeric($v)) {
26 } elseif ($v !==
'' && UString::isBooleanStr($v)) {
27 $result = UString::getBooleanStr($v);
42 public static function save(array $content,?
string $path=
null,
string $filename=
'.env') {
45 foreach ($content as $k=>$v){
48 $result= \implode(
"\n",$result);
49 return UFileSystem::save($path.$filename,$result);
60 public static function saveText(
string $textContent,?
string $path=
null,
string $filename=
'.env') {
62 return UFileSystem::save($path.$filename,$textContent);
73 public static function addAndSave(array $content,?
string $path=
null,
string $filename=
'.env') {
76 $result=\array_replace_recursive($result,$content);
87 public static function load(?
string $path=
null,
string $filename=
'.env'): array {
89 if(\file_exists($path.$filename)) {
90 return Dotenv::createUnsafeMutable($path,$filename)->load();
95 public static function loadContent(?
string $path=
null,
string $filename=
'.env'): string {
96 $path??=self::$ENV_ROOT;
97 if(\file_exists($path.$filename)) {
98 return \file_get_contents($path.$filename);
static saveText(string $textContent,?string $path=null, string $filename='.env')
Savec a content text on disk.
static load(?string $path=null, string $filename='.env')
Loads an env file an returns an array of key/value pairs.
static addAndSave(array $content,?string $path=null, string $filename='.env')
Adds a content array to an existing env file and saves it to disk.
static save(array $content,?string $path=null, string $filename='.env')
Saves a content array on disk.
static loadContent(?string $path=null, string $filename='.env')
File system utilities Ubiquity\utils\base$UFileSystem This class is part of Ubiquity.