<commit_before><?php

class TalkCommentMapper extends ApiMapper {
    public function getDefaultFields() {
        $fields = array(
            'rating' => 'rating',
            'comment' => 'comment',
            'user_display_name' => 'full_name',
            'talk_title' => 'talk_title',
            'created_date' => 'date_made'
            );
        return $fields;
    }

    public function getVerboseFields() {
        $fields = array(
            'rating' => 'rating',
            'comment' => 'comment',
            'user_display_name' => 'full_name',
            'talk_title' => 'talk_title',
            'source' => 'source',
            'created_date' => 'date_made'
            );
        return $fields;
    }

    public function getCommentsByTalkId($talk_id, $resultsperpage, $start, $verbose = false) {
        $sql = $this->getBasicSQL();
        $sql .= 'and talk_id = :talk_id';
        $sql .= ' order by tc.date_made';

        $sql .= $this->buildLimit($resultsperpage, $start);
        $stmt = $this->_db->prepare($sql);
        $response = $stmt->execute(array(
            ':talk_id' => $talk_id
            ));
        if($response) {
            $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
            $retval = $this->transformResults($results, $verbose);
            return $retval;
        }
        return false;
    }

    public function getCommentsByEventId($event_id, $resultsperpage, $start, $verbose = false, $sort = NULL) {
        $sql = $this->getBasicSQL();
        $sql .= 'and event_id = :event_id ';

        if($sort == 'newest') {
            $sql .= ' order by tc.date_made desc';
        }

        $sql .= $this->buildLimit($resultsperpage, $start);

        $stmt = $this->_db->prepare($sql);
        $response = $stmt->execute(array(
            ':event_id' => $event_id
            ));
        if($response) {
            $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
            $retval = $this->transformResults($results, $verbose);
            return $retval;
        }
        return false;
    }

    public function getCommentById($comment_id, $verbose = false) {
        $sql = $this->getBasicSQL();
        $sql .= ' and tc.ID = :comment_id ';
        $stmt = $this->_db->prepare($sql);
        $response = $stmt->execute(array(
            ':comment_id' => $comment_id<commit_msg>talk comments on an event should be returned in date order<commit_after><?php

class TalkCommentMapper extends ApiMapper {
    public function getDefaultFields() {
        $fields = array(
            'rating' => 'rating',
            'comment' => 'comment',
            'user_display_name' => 'full_name',
            'talk_title' => 'talk_title',
            'created_date' => 'date_made'
            );
        return $fields;
    }

    public function getVerboseFields() {
        $fields = array(
            'rating' => 'rating',
            'comment' => 'comment',
            'user_display_name' => 'full_name',
            'talk_title' => 'talk_title',
            'source' => 'source',
            'created_date' => 'date_made'
            );
        return $fields;
    }

    public function getCommentsByTalkId($talk_id, $resultsperpage, $start, $verbose = false) {
        $sql = $this->getBasicSQL();
        $sql .= 'and talk_id = :talk_id';
        $sql .= ' order by tc.date_made';

        $sql .= $this->buildLimit($resultsperpage, $start);
        $stmt = $this->_db->prepare($sql);
        $response = $stmt->execute(array(
            ':talk_id' => $talk_id
            ));
        if($response) {
            $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
            $retval = $this->transformResults($results, $verbose);
            return $retval;
        }
        return false;
    }

    public function getCommentsByEventId($event_id, $resultsperpage, $start, $verbose = false, $sort = NULL) {
        $sql = $this->getBasicSQL();
        $sql .= 'and event_id = :event_id ';

        // default to newest
        $sql .= ' order by tc.date_made desc';

        $sql .= $this->buildLimit($resultsperpage, $start);

        $stmt = $this->_db->prepare($sql);
        $response = $stmt->execute(array(
            ':event_id' => $event_id
            ));
        if($response) {
            $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
            $retval = $this->transformResults($results, $verbose);
            return $retval;
        }
        return false;
    }

    public function getCommentById($comment_id, $verbose = false) {
        $sql = $this->getBasicSQL();
        $sql .= ' and tc.ID = :comment_id ';
        $stmt = $this->_db->prepare($sql);
        $response = $stmt->execute(array(
            ':comment_id' => $comment_id
{'fraction_non_alphanumeric': 0.15480728504870817, 'fraction_numerical': 0.0, 'mean_word_length': 1.9816919191919191, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3724308', 'n_tokens_mistral': 1411, 'n_tokens_neox': 1388, 'n_words': 280}