This commit is contained in:
2023-10-04 13:32:30 +03:00
parent 215d238505
commit 1ca5f4e521
82 changed files with 519 additions and 1889 deletions
+11 -5
View File
@@ -21,15 +21,21 @@ final class ChannelService
public static function fromConfig(): ChannelService
{
$configJson = file_get_contents(storage_path("lucent.config.json"));
$configArray = json_decode($configJson, true);
if(file_exists(storage_path("lucent.config.json"))){
$configJson = file_get_contents(storage_path("lucent.config.json"));
$configArray = json_decode($configJson, true);
}else{
$configArray = null;
}
$schemaService = new SchemaService();
$schemasCollection = (new Collection($configArray["schemas"]))->map([$schemaService, 'fromArray']);
$schemasCollection = (new Collection($configArray["schemas"] ?? []))->map([$schemaService, 'fromArray']);
$channel = new Channel(
name: $configArray["name"],
url: rtrim($configArray["url"], "/"),
name: $configArray["name"] ?? "",
url: rtrim($configArray["url"] ?? "", "/"),
schemas: $schemasCollection,
imageFilters: $configArray["imageFilters"] ?? [],
);