Creates a new comment

@param NodeInterface $postNode The post node which will contain the new comment
@param NodeTemplate<RobertLemke.Plugin.Blog:Comment> $newComment
@return string
769766
public function createAction(NodeInterface $postNode, NodeTemplate $newComment)
    {
        # Workaround until we can validate node templates properly:
        if (strlen($newComment->getProperty('author')) < 2) {
            $this->throwStatus(400, 'Your comment was NOT created - please specify your name.');
        }

        if (filter_var($newComment->getProperty('emailAddress'), FILTER_VALIDATE_EMAIL) === false) {
            $this->throwStatus(400, 'Your comment was NOT created - you must specify a valid email address.');
        }

        if (strlen($newComment->getProperty('text')) < 5) {
            $this->throwStatus(400, 'Your comment was NOT created - it was too short.');
        }

        $newComment->setProperty('text', filter_var($newComment->getProperty('text'), FILTER_SANITIZE_STRIPPED));
        $newComment->setProperty('author', filter_var($newComment->getProperty('author'), FILTER_SANITIZE_STRIPPED));
        $newComment->setProperty('emailAddress', filter_var($newComment->getProperty('emailAddress'), FILTER_SANITIZE_STRIPPED));

        $commentNode = $postNode->getNode('comments')->createNodeFromTemplate($newComment, uniqid('comment-'));
        $commentNode->setProperty('spam', false);
        $commentNode->setProperty('datePublished', new \DateTime());

        if ($this->akismetService->isCommentSpam('', $commentNode->getProperty('text'), 'comment', $commentNode->getProperty('author'), $commentNode->getProperty('emailAddress'))) {
            $commentNode->setProperty('spam', true);
        }

        $this->emitCommentCreated($commentNode, $postNode);
        $this->response->setStatus(201);

        return 'Thank you for your comment!';
    }
13681
function comment() {
    var ret = this.seq(
        this.stringf(";"),
        this.manyf(this.choicef(WSP, VCHAR)),
        CRLF);
    return new ast.Comment(ret[2]);
}
393735
public function addComment($orderIncrementId, $status, $comment = null, $notify = null)
    {
        return $this->__createAction('salesOrderAddComment', func_get_args());
    }
1336453
function createComment() {
    $cnt = count( $this->comment );
     if( 0 >= $cnt )
      return;
    $comment = null;
    foreach( $this->comment as $commentPart ) {
      $attributes = $this->_createParams( $commentPart['params'], array( 'ALTREP', 'LANGUAGE' ));
      $content    = $this->_strrep( $commentPart['value'] );
      $comment   .= $this->_createElement( 'COMMENT', $attributes, $content );
    }
    return $comment;
  }
674499
private function findComment($commentId, $authorToken)
    {
        $comment = $this
            ->commentRepository
            ->findOneBy([
                'id' => $commentId,
                'authorToken' => $authorToken,
            ]);

        if (!($comment instanceof CommentInterface)) {
            throw new EntityNotFoundException('Comment not found');
        }

        return $comment;
    }
381917
public function writeComment(string $comment): XmlStreamWriter
    {
        return $this->append(
                function(\DOMNode $parent) use ($comment)
                {
                    $parent->appendChild(
                            $this->doc->createComment($this->encode($comment))
                    );
                },
                'comment'
        );
    }
1235563
public function GetNew($DiscussionID, $LastCommentID) {
      $this->CommentQuery();
      $this->FireEvent('BeforeGetNew');
      $this->OrderBy($this->SQL);
      $Comments = $this->SQL
         ->Where('c.DiscussionID', $DiscussionID)
         ->Where('c.CommentID >', $LastCommentID)
         ->Get();
      
      $this->SetCalculatedFields($Comments);
      return $Comments;
   }
302104
private function createDocComment(Node $node)
    {
        $docComment = $node->getDocComment();
        if (!$docComment) {
            return null;
        }

        $ref            = new RefComment();
        $ref->text      = $docComment->getText();
        $ref->startLine = $docComment->getLine();
        $ref->endLine   = $node->getLine() - 1;

        return $ref;
    }
113557
public function addComment($postId, $comment)
	{
		$token = $this->oauth->getToken();

		// Set parameters.
		$parameters = array(
			'oauth_token' => $token['key'],
		);

		// Set the success response code.
		$this->oauth->setOption('success_code', 201);

		// Set the API base
		$base = '/v1/posts/' . $postId . '/comments';

		// Build xml.
		$xml = '<comment><text>' . $comment . '</text></comment>';

		// Build the request path.
		$path = $this->getOption('api.url') . $base;

		$header['Content-Type'] = 'text/xml';

		// Send the request.
		$response = $this->oauth->oauthRequest($path, 'POST', $parameters, $xml, $header);

		// Return the comment id.
		$response = explode('comments/', $response->headers['Location']);

		return $response[1];
	}
1126246
@Override
    public R visitComment(CommentTree node, P p) {
        return defaultAction(node, p);
    }
38519
public static function create($comment) {
    $block_comment = new LineCommentBlockNode();
    $comment = trim($comment);
    $lines = array_map('rtrim', explode("\n", $comment));
    foreach ($lines as $line) {
      $comment_node = new CommentNode(T_COMMENT, '// ' . $line . "\n");
      $block_comment->addChild($comment_node);
    }
    return $block_comment;
  }
779278
public void buildFieldComments(XMLNode node, Content fieldDocTree) {
        if (!configuration.nocomment) {
            writer.addComments(currentElement, fieldDocTree);
        }
    }
124369
public function create(TextNodeInterface $textNode)
    {
        return $this->formFactory->create(
            'silvestra_text_node',
            $textNode,
            array(
                'method' => 'POST',
                'action' => $this->router->getContext()->getPathInfo(),
            )
        );
    }
189645
protected static Comment transformComment(CSNodeWrapper node) {
        final Comment comment;
        if (node.getNodeType() == CommonConstants.CS_NODE_COMMENT) {
            comment = new Comment(node.getTitle());
        } else {
            throw new IllegalArgumentException("The passed node is not a Comment");
        }

        comment.setUniqueId(node.getId() == null ? null : node.getId().toString());

        return comment;
    }
1147616
func (document *XmlDocument) CreateCommentNode(data string) (comment *CommentNode) {
	dataBytes := GetCString([]byte(data))
	dataPtr := unsafe.Pointer(&dataBytes[0])
	nodePtr := C.xmlNewComment((*C.xmlChar)(dataPtr))
	if nodePtr != nil {
		comment = NewNode(unsafe.Pointer(nodePtr), document).(*CommentNode)
	}
	return
}
63739
public function dispatchCommentCreateEvent(Post $post, Comment $comment)
    {
        $event = new LogCommentCreateEvent($post, $comment, $this->translator);

        return $this->dispatch($event);
    }
158338
public function serialize(Post $post, array $options = [], array $comments = [])
    {
        //serialize comments
        if (isset($options[CommentSerializer::INCLUDE_COMMENTS])) {
            if ($this->hasOption(CommentSerializer::FETCH_COMMENTS, $options)) {
                $comments = $this->serializePostComments($post, $options);
            }
        }
        $commentsNumber = $post->countComments();
        $commentsNumberUnpublished = $post->countUnpublishedComments();

        return [
            'id' => $post->getUuid(),
            'slug' => $post->getSlug(),
            'title' => $post->getTitle(),
            'content' => isset($options['abstract']) && $options['abstract'] ? $post->getAbstract() : $post->getContent(),
            'abstract' => $this->isAbstract($post, $options),
            'creationDate' => $post->getCreationDate() ? DateNormalizer::normalize($post->getCreationDate()) : new \DateTime(),
            'modificationDate' => $post->getModificationDate() ? DateNormalizer::normalize($post->getModificationDate()) : null,
            'publicationDate' => $post->getPublicationDate() ? DateNormalizer::normalize($post->getPublicationDate()) : DateNormalizer::normalize($post->getCreationDate()),
            'viewCounter' => $post->getViewCounter(),
            'author' => $post->getAuthor() ? $this->userSerializer->serialize($post->getAuthor(), [Options::SERIALIZE_MINIMAL]) : null,
            'authorName' => $post->getAuthor() ? $post->getAuthor()->getFullName() : null,
            'authorPicture' => $post->getAuthor()->getPicture(),
            'tags' => $this->serializeTags($post),
            'comments' => $comments,
            'commentsNumber' => $commentsNumber,
            'commentsNumberUnpublished' => $commentsNumberUnpublished,
            'isPublished' => $post->isPublished(),
            'status' => $post->isPublished(false),
            'pinned' => $post->isPinned(),
        ];
    }