session->setData(self::SESSION_PREFIX . $token, [ 'entity_type' => $entityType, 'entity_ids' => array_values(array_unique(array_map('intval', $entityIds))), ]); return $token; } /** @return array{entity_type:string,entity_ids:int[]}|null */ public function get(string $token): ?array { if (preg_match('/^[a-f0-9]{32}$/', $token) !== 1) { return null; } $selection = $this->session->getData(self::SESSION_PREFIX . $token); return is_array($selection) ? $selection : null; } public function clear(string $token): void { if (preg_match('/^[a-f0-9]{32}$/', $token) === 1) { $this->session->unsetData(self::SESSION_PREFIX . $token); } } }