| Total Complexity | 5 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | abstract class AbstractTranslation implements TranslationInterface |
||
| 13 | { |
||
| 14 | protected ?TranslatableInterface $translatable = null; |
||
| 15 | protected ?string $locale = null; |
||
| 16 | /** |
||
| 17 | * @codeCoverageIgnore |
||
| 18 | */ |
||
| 19 | public function getTranslatable(): ?TranslatableInterface |
||
| 20 | { |
||
| 21 | return $this->translatable; |
||
| 22 | } |
||
| 23 | |||
| 24 | public function setTranslatable(?TranslatableInterface $translatable): void |
||
| 25 | { |
||
| 26 | if ($translatable === $this->translatable) { |
||
| 27 | return; |
||
| 28 | } |
||
| 29 | |||
| 30 | $previousTranslatable = $this->translatable; |
||
| 31 | $this->translatable = $translatable; |
||
| 32 | |||
| 33 | $previousTranslatable?->removeTranslation($this); |
||
| 34 | |||
| 35 | $translatable?->addTranslation($this); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @codeCoverageIgnore |
||
| 40 | */ |
||
| 41 | public function getLocale(): ?string |
||
| 42 | { |
||
| 43 | return $this->locale; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @codeCoverageIgnore |
||
| 48 | */ |
||
| 49 | public function setLocale(?string $locale): void |
||
| 52 | } |
||
| 53 | } |
||
| 54 |