Skip to content

Commit

Permalink
Add load method to Json class
Browse files Browse the repository at this point in the history
  • Loading branch information
ewilan-riviere committed Nov 26, 2023
1 parent 34fb1b9 commit c1c7b7f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Utils/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ public function __construct(
}
}

public function load(string $path): mixed
{
$this->path = $path;
$this->contents = file_get_contents($path);

if (! $this->contents) {
$this->contents = [];
}

return $this->contents;
}

/**
* @return string Pretty json string
*/
Expand Down

0 comments on commit c1c7b7f

Please sign in to comment.