@param string $pr

@return \Bitbucket\Api\Repositories\Users\PullRequests\Comments
963438
public function comments(string $pr)
    {
        return new Comments($this->getHttpClient(), $this->username, $this->repo, $pr);
    }
41912
public function getSurveyResults($post) {
        $comments = $this->getComments();

        $table  = \MUtil_Html::create()->table(['class' => 'browser table']);
        $header = $table->thead()->tr();
        $header->th($this->_('Source Survey'));
        $header->th($this->_('Target Survey'));

        $header = $table->thead()->tr();
        $header->th($this->surveys[$this->sourceSurveyId]);
        $header->th($this->surveys[$this->targetSurveyId]);

        $tableBody = $table->tbody();
        $row       = $tableBody->tr();
        $row->td($this->getSurveyStatistics($this->sourceSurveyId));
        $row->td($this->getSurveyStatistics($this->targetSurveyId));
        $tableBody->tr()->td(['colspan' => 2]);

        if ($this->formData['copy_answers'] == 1) {
            $sourceSurveyData = $this->getSurveyData($this->sourceSurveyId);
            $targetSurveyData = $this->getSurveyData($this->targetSurveyId);

            $compareResultSummary = $this->getCompareResultSummary($post, $sourceSurveyData, $targetSurveyData);

            $tableBody->tr()->th($this->_('Summary'), ['colspan' => 2]);
            $tableBody->tr()->td($compareResultSummary, ['colspan' => 2]);
        }

        if ($comments) {
            $tableBody->tr()->th($this->_('Comments'), ['colspan' => 2]);
            $tableBody->tr()->td($comments, ['colspan' => 2]);
        }

        return $table;
    }
1155567
public static function get_comments() {
        global $DB, $USER;

        $comments = array();
        $records = $DB->get_records('assignfeedback_editpdf_quick', array('userid'=>$USER->id));

        return $records;
    }
55847
public function comments(string $issue)
    {
        return new Comments($this->getHttpClient(), $this->username, $this->repo, $issue);
    }
1363250
private function Strip_Comment($_address)
    {
        $_pattern = "/\([^()]*\)/";
        while ( preg_match($_pattern, $_address) )
            $_address = preg_replace($_pattern, '', $_address);
        return $_address;
    }
1030035
private boolean containsComment(GHPullRequest ghPullRequest, String expectedBody) {
        List<GHIssueComment> prComments;
        try {
            prComments = ghPullRequest.getComments();
        } catch (IOException e) {
            LOGGER.log(Level.WARNING, "Failed to get comments for PR " + ghPullRequest, e);
            // return false in case of an error - probably safer to have multiple comments than possibly none
            return false;
        }
        for (GHIssueComment comment : prComments) {
            if (comment.getBody() != null && comment.getBody().equals(expectedBody)) {
                return true;
            }
        }
        return false;
    }
1051157
public function diff(string $pr)
    {
        return new Diff($this->getHttpClient(), $this->username, $this->repo, $pr);
    }
770073
public function getComment()
    {
        $postParameterBag = $this
            ->request
            ->query;
        $commentId = $postParameterBag->get('comment_id');
    
        if (empty($commentId)) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Some query parameters are missing',
            ], 400);
        }

        $commentReference = new CommentUUID($commentId);
        $comment = $this
            ->commentRepository
            ->findComment($commentReference)
            ->getFirstComment();
    
        if (!$comment instanceof Comment) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Comment not found',
            ], 404);
        }
        
    
        return new JsonResponse([
            'comment' => $comment->toArray(),
            'user' => $this->userCredentialsProvider->toArray(),
        ], 200);
    }
18959
protected function bitbucketWebhook($payload, $project)
    {
        $results = array();
        $status = 'failed';
        foreach ($payload['push']['changes'] as $commit) {
            try {
                $email = $commit['new']['target']['author']['raw'];
                $email = substr($email, 0, strpos($email, '>'));
                $email = substr($email, strpos($email, '<') + 1);

                $results[$commit['new']['target']['hash']] = $this->createBuild(
                    $project,
                    $commit['new']['target']['hash'],
                    $commit['new']['name'],
                    $email,
                    $commit['new']['target']['message']
                );
                $status = 'ok';
            } catch (Exception $ex) {
                $results[$commit['new']['target']['hash']] = array('status' => 'failed', 'error' => $ex->getMessage());
            }
        }

        return array('status' => $status, 'commits' => $results);
    }
746726
public function getCommentVotes(CommentInterface $comment)
    {
        /**
         * @var VoteInterface[] $votes
         */
        $votes = $this
            ->commentVoteObjectDirector
            ->findBy([
                'comment' => $comment,
            ]);

        return VotePackage::create($votes);
    }
122612
public function deleteComment()
    {
        $userIsAllowed = $this
            ->userCredentialsProvider
            ->isAllowed();
        if (!$userIsAllowed) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'The user is not allowed to delete a comment',
            ], 401);
        }

        $sourceUUID = $this->getSourceUUID();
        if (empty($sourceUUID)) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Source UUID header must be defined',
            ], 400);
        }
        
        $authorUUID = $this
            ->userCredentialsProvider
            ->getUUID();
        if (empty($authorUUID)) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Author UUID must be defined',
            ], 400);
        }

        $postParameterBag = $this
            ->request
            ->request;
        $commentId = $postParameterBag->get('comment_id');

        if (empty($commentId)) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Some query parameters are missing',
            ], 400);
        }

        $commentReference = new CommentUUID($commentId);
        $comment = $this
            ->commentRepository
            ->findComment($commentReference)
            ->getFirstComment();

        if (!$comment instanceof Comment) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Comment not found',
            ], 404);
        }

        if (!$this->userCredentialsProvider->isModerator()) {
            if ($comment->getAuthorUUID() !== $authorUUID) {
                return new JsonResponse([
                    'status' => 'Error',
                    'message' => 'You are not authorized to delete this comment',
                ], 401);
            }
        }

        $this
            ->commentRepository
            ->deleteComment($comment);
        $this->flushRepository();

        return new JsonResponse([
            'status' => 'OK',
            'comment' => 'Comment deleted',
        ], 200);
    }
315584
public function storePullRequestComment(PullRequest $pullRequest, $message) {
		$url = $pullRequest->resolveApiUrl(PullRequest::API_URL_COMMENTS);
		$parameters = array(
			'body' => $message,
		);
		$this->getApi()->post($url, json_encode($parameters));
	}
1112197
public function getComment()
    {
        if ($this->comment === null) {
            $match = [];
            preg_match(self::$REGEX_COMMENT, $this->output, $match);
            $this->comment = array_key_exists(2, $match) ? trim($match[2]) : '';
        }

        return $this->comment;
    }
1303783
public function addComment($user, string $comment) : Comment
    {
        return $this->comments()->create([
            'user_id' => $user->id,
            'comment' => $comment,
        ]);
    }
1117298
function get_comments($page) {
        global $DB;

        if ($page == 0) {
            $start = 0;
        } else {
            $start = $page * $this->perpage;
        }
        $comments = array();

        $usernamefields = get_all_user_name_fields(true, 'u');
        $sql = "SELECT c.id, c.contextid, c.itemid, c.component, c.commentarea, c.userid, c.content, $usernamefields, c.timecreated
                  FROM {comments} c
                  JOIN {user} u
                       ON u.id=c.userid
              ORDER BY c.timecreated ASC";
        $rs = $DB->get_recordset_sql($sql, null, $start, $this->perpage);
        $formatoptions = array('overflowdiv' => true, 'blanktarget' => true);
        foreach ($rs as $item) {
            // Set calculated fields
            $item->fullname = fullname($item);
            $item->time = userdate($item->timecreated);
            $item->content = format_text($item->content, FORMAT_MOODLE, $formatoptions);
            // Unset fields not related to the comment
            foreach (get_all_user_name_fields() as $namefield) {
                unset($item->$namefield);
            }
            unset($item->timecreated);
            // Record the comment
            $comments[] = $item;
        }
        $rs->close();

        return $comments;
    }
150939
public function createComment(string $gistId, string $body): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/gists/:gist_id/comments', $gistId),
            Request::METHOD_POST, [
                'body' => $body
            ]);
    }
1149261
public function getComments()
    {
        $args_comments = [
            'post_id' => $this->ID,
            'orderby' => 'comment_date_gmt',
            'status' => static::STATUS_APPROVE,
        ];
        $comments = [];
        foreach (get_comments($args_comments, $this->ID) as $c) {
            $comments[] = Comment::find($c->comment_ID);
        }
        return $comments;
    }