* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShopBundle\Translation\Api; use Symfony\Contracts\Translation\TranslatorInterface; abstract class AbstractApi { /** * @var TranslatorInterface */ protected $translator; public function setTranslator(TranslatorInterface $translator) { $this->translator = $translator; } public function getFormattedTranslations() { $all = []; foreach ($this->getTranslations() as $key => $translation) { $all[] = [ 'translation_id' => $key, 'name' => $translation, ]; } return $all; } abstract public function getTranslations(); }