mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
feat: recipes zip import support, add trmnlp compatible recipe configuration
Some checks are pending
tests / ci (push) Waiting to run
Some checks are pending
tests / ci (push) Waiting to run
* recipes zip import support * add trmnlp compatible recipe configuration * support for multiple polling urls
This commit is contained in:
parent
a927c0fb97
commit
414ca47cbf
17 changed files with 2409 additions and 125 deletions
61
app/Liquid/FileSystems/InlineTemplatesFileSystem.php
Normal file
61
app/Liquid/FileSystems/InlineTemplatesFileSystem.php
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Liquid\FileSystems;
|
||||
|
||||
use Keepsuit\Liquid\Contracts\LiquidFileSystem;
|
||||
|
||||
/**
|
||||
* A file system that allows registering inline templates defined with the template tag
|
||||
*/
|
||||
class InlineTemplatesFileSystem implements LiquidFileSystem
|
||||
{
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected array $templates = [];
|
||||
|
||||
/**
|
||||
* Register a template with the given name and content
|
||||
*/
|
||||
public function register(string $name, string $content): void
|
||||
{
|
||||
$this->templates[$name] = $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a template exists
|
||||
*/
|
||||
public function hasTemplate(string $templateName): bool
|
||||
{
|
||||
return isset($this->templates[$templateName]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all registered template names
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public function getTemplateNames(): array
|
||||
{
|
||||
return array_keys($this->templates);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all registered templates
|
||||
*/
|
||||
public function clear(): void
|
||||
{
|
||||
$this->templates = [];
|
||||
}
|
||||
|
||||
public function readTemplateFile(string $templateName): string
|
||||
{
|
||||
if (!isset($this->templates[$templateName])) {
|
||||
throw new \InvalidArgumentException("Template '{$templateName}' not found in inline templates");
|
||||
}
|
||||
|
||||
return $this->templates[$templateName];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue