2024-04-20 00:04:20 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Lib\Editor;
|
|
|
|
|
|
|
|
abstract class ConditionResolver
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array<string, mixed> $block
|
|
|
|
*/
|
|
|
|
abstract public function filterBlock(array $block): bool;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array<string, mixed> $content
|
|
|
|
* @return array<string, mixed>
|
|
|
|
*/
|
|
|
|
public function make(array $content): array
|
|
|
|
{
|
2024-04-20 00:29:32 +02:00
|
|
|
return array_filter(data_get($content, 'blocks', []), fn ($block) => $this->filterBlock($block));
|
2024-04-20 00:04:20 +02:00
|
|
|
}
|
|
|
|
}
|