argument('country-code'); $year = $this->argument('year'); if (!is_string($countryCodeStr) || strlen($countryCodeStr) !== 2) { $this->error('Invalid country code. Must be two-letter code'); return 1; } if (!is_numeric($year)) { $this->error('Year must be a numeric value'); return 1; } $countryCode = strtoupper($countryCodeStr); $publicHolidaysStore = $publicHolidaysStateFactory->createStoreForCountry($countryCode); $this->info('Creating public holidays for country code: ' . $countryCodeStr . ' and year: ' . $year); try { $publicHolidaysGenerator = $publicHolidaysGeneratorFactory->createPublicHolidaysGeneratorForCountry($countryCode); } catch (\RuntimeException $e) { $this->error($e->getMessage()); return 1; } $result = $publicHolidaysGenerator->generatePublicHolidaysForYear((int) $year); foreach ($result as $nwdDate) { $publicHolidaysStore->storePublicHoliday($nwdDate); } $this->info('[DONE] Creating public holidays for country code: ' . $countryCode . ' and year: ' . $year); return 0; } }