New Branch Structure
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Stylist\Theme;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Modules\Stylist\Theme\Exceptions\ThemeJsonNotFoundException;
|
||||
|
||||
final class Json
|
||||
{
|
||||
public function __construct(private readonly Filesystem $files) {}
|
||||
|
||||
public function read(string $path): array
|
||||
{
|
||||
$manifest = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'theme.json';
|
||||
|
||||
if (! $this->files->exists($manifest)) {
|
||||
throw ThemeJsonNotFoundException::forPath($path);
|
||||
}
|
||||
|
||||
return json_decode($this->files->get($manifest), true, flags: JSON_THROW_ON_ERROR);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user