private function addPlain($email, $ip) { ArgCheck::isEmail($email); ArgCheck::isIp($ip); $data = ['email' => $email, 'ip' => $ip, 'created_gmt' => Time::now()->asSqlTimestamp()]; if ($this->database->insert(self::TABLE_NAME, $data) === false) { throw new \RuntimeException('Unable to add subscriber to the database'); } }
public function createNewJob($post_id) { ArgCheck::isInt($post_id); if ($post_id < 1) { throw new \InvalidArgumentException('postId must be an integer value greater than 0'); } $data = ['offset' => 0, 'post_id' => $post_id, 'next_round_gmt' => Time::now()->plusMinutes(1)->asSqlTimestamp(), 'created_gmt' => Time::now()->asSqlTimestamp()]; if ($this->database->insert(self::TABLE_NAME, $data) === false) { throw new \RuntimeException('Unable to add job to the database'); } }