Fixed execution without params
This commit is contained in:
parent
47930b010f
commit
be12d8d38a
@ -44,6 +44,9 @@ class Environment implements ArrayAccess
|
|||||||
*/
|
*/
|
||||||
public function readFromFile(string $filepath): static
|
public function readFromFile(string $filepath): static
|
||||||
{
|
{
|
||||||
|
if (empty($filepath)) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
$content = file_get_contents(static::$filepath = $filepath);
|
$content = file_get_contents(static::$filepath = $filepath);
|
||||||
$content = json_decode($content, flags: JSON_THROW_ON_ERROR); //TODO try-catch
|
$content = json_decode($content, flags: JSON_THROW_ON_ERROR); //TODO try-catch
|
||||||
$content || throw new JsonException("not a valid environment: $filepath");
|
$content || throw new JsonException("not a valid environment: $filepath");
|
||||||
|
Loading…
Reference in New Issue
Block a user