* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Core\Form\ChoiceProvider; use PrestaShop\PrestaShop\Core\Form\FormChoiceProviderInterface; /** * Gets choices for predefined order message types. */ final class CustomerServiceOrderMessagesNameChoiceProvider implements FormChoiceProviderInterface { /** * @var array */ private $orderMessages; public function __construct(array $orderMessages) { $this->orderMessages = $orderMessages; } /** * {@inheritdoc} */ public function getChoices(): array { $result = []; foreach ($this->orderMessages as $orderMessage) { $result[$orderMessage['name']] = $orderMessage['id_order_message']; } return $result; } }