This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace Esun\Translation\Model\Entity;
use Esun\Translation\Api\TranslatableEntityInterface;
class EntityPool
{
/**
* @param array<string, TranslatableEntityInterface> $entities
*/
public function __construct(private readonly array $entities = [])
{
}
public function get(string $type): TranslatableEntityInterface
{
if (!isset($this->entities[$type])) {
throw new \InvalidArgumentException(sprintf('Unsupported translation entity type "%s".', $type));
}
return $this->entities[$type];
}
/**
* @return string[]
*/
public function getTypes(): array
{
return array_keys($this->entities);
}
}