db = $db; } public function process(array $row, int $cnt): void { if (!preg_match('/^C ?\d{2}PA\d{2}$/', $row['service_sw'])) { echo "{$cnt} {$row['service_sw']}-> SKIP SWITCHCODE\n"; return; } $temps = []; $temps['code'] = trim($row['service_sw']); $temps['status'] = SwitchEntity::DEFAULT_STATUS; // Assuming SwitchEntity has a STATUS_DEFAULT constant if (!$this->db->table('switchinfo')->insert($temps)) { throw new \Exception($this->db->error()['message']); } echo "{$cnt} -> {$temps['code']} SWITCHCODE 완료.\n"; } }