> */ public function fetchAll(): array { $stores = []; $offset = 0; do { $response = $this->client->post(Endpoint::STORE_LIST, [ 'offset' => $offset, 'length' => self::PAGE_SIZE, 'platform_code' => [self::PLATFORM_CODE], ]); $list = is_array($response['data']['list'] ?? null) ? $response['data']['list'] : []; foreach ($list as $store) { if (!is_array($store)) { continue; } $platformCode = (int)($store['platform_code'] ?? 0); $storeId = trim((string)($store['store_id'] ?? '')); if ($platformCode <= 0 || $storeId === '') { throw new ApiException('StoreInfoV2 returned a store without platform_code or store_id.', 'invalid_store_data'); } $stores[] = $store; } $received = count($list); $offset += $received; $total = max(0, (int)($response['data']['total'] ?? $offset)); } while ($received > 0 && $offset < $total); return $stores; } }