db = $db; } public function process(array $row, int $cnt): void { if (empty($row['service_sw']) || strlen($row['service_sw']) <= 4 || $row['service_sw'] === '1회성 장비') { echo "{$cnt} -> 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"; } }