* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ declare(strict_types=1); namespace PrestaShop\PrestaShop\Core\Domain\State\Command; use PrestaShop\PrestaShop\Core\Domain\State\ValueObject\NoStateId; use PrestaShop\PrestaShop\Core\Domain\State\ValueObject\StateId; /** * Deletes states on bulk action */ class BulkDeleteStateCommand { /** * @var array */ private $stateIds; /** * @param array $stateIds */ public function __construct(array $stateIds) { $this->setStateIds($stateIds); } /** * @return array */ public function getStateIds(): array { return $this->stateIds; } /** * @param array $stateIds */ private function setStateIds(array $stateIds): void { foreach ($stateIds as $stateId) { $this->stateIds[] = $stateId !== NoStateId::NO_STATE_ID_VALUE ? new StateId((int) $stateId) : new NoStateId(); } } }