38 lines
909 B
PHP
38 lines
909 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Dto\Service\ProjectTranslationServiceHash;
|
|
|
|
final class TranslateFields
|
|
{
|
|
private array $fields = [];
|
|
private array $hashes = [];
|
|
|
|
public function add(int $languageId, string $fieldName, string $hash, int $hashId): self
|
|
{
|
|
if (!isset($this->fields[$languageId])) {
|
|
$this->fields[$languageId] = [];
|
|
}
|
|
$this->fields[$languageId][] = $fieldName;
|
|
|
|
if (!isset($this->hashes[$languageId])) {
|
|
$this->hashes[$languageId] = [];
|
|
}
|
|
$this->hashes[$languageId][$fieldName] = [
|
|
'hash' => $hash,
|
|
'hashId' => $hashId,
|
|
];
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getFields(): array
|
|
{
|
|
return $this->fields;
|
|
}
|
|
|
|
public function getHashesByLanguage(int $languageId): array
|
|
{
|
|
return $this->hashes[$languageId] ?? [];
|
|
}
|
|
}
|