getRecords() as $comment) { array_push($ids, $comment->ID); $this->updateComment($comment); } $response = new HTTPResponse(json_encode([ 'done' => true, 'records' => $ids, ])); $response->addHeader('Content-Type', 'application/json'); return $response; } /** * @param Comment $comment * * @return Comment */ abstract public function updateComment($comment); }