public function createCommentStructure(
        CommentInterface $comment,
        VotePackage $commentVotePackage = null
    ) {
        $commentStructure = [
            'id' => $comment->getId(),
            'authorName' => $comment->getAuthorName(),
            'authorEmail' => $comment->getAuthorEmail(),
            'content' => $comment->getContent(),
            'context' => $comment->getContext(),
            'createdAt' => $comment->getCreatedAt()->format('Y-m-d H:i:s'),
            'updatedAt' => $comment->getUpdatedAt()->format('Y-m-d H:i:s'),
        ];

        if ($commentVotePackage instanceof VotePackage) {
            $commentStructure = array_merge(
                $commentStructure,
                [
                    'nbVotes' => $commentVotePackage->getNbVotes(),
                    'nbUpVotes' => $commentVotePackage->getNbUpVotes(),
                    'nbDownVotes' => $commentVotePackage->getNbDownVotes(),
                ]
            );
        }

        return $commentStructure;
    }
public function createCommentStructure(
        CommentInterface $comment,
        VotePackage $commentVotePackage = null
    ) {
        $commentStructure = [
            'id' => $comment->getId(),
            'authorName' => $comment->getAuthorName(),
            'authorEmail' => $comment->getAuthorEmail(),
            'content' => $comment->getContent(),
            'context' => $comment->getContext(),
            'createdAt' => $comment->getCreatedAt()->format('Y-m-d H:i:s'),
            'updatedAt' => $comment->getUpdatedAt()->format('Y-m-d H:i:s'),
        ];

        if ($commentVotePackage instanceof VotePackage) {
            $commentStructure = array_merge(
                $commentStructure,
                [
                    'nbVotes' => $commentVotePackage->getNbVotes(),
                    'nbUpVotes' => $commentVotePackage->getNbUpVotes(),
                    'nbDownVotes' => $commentVotePackage->getNbDownVotes(),
                ]
            );
        }

        return $commentStructure;
    }
public function createCommentStructure ( CommentInterface $ comment , VotePackage $ commentVotePackage = null ) { $ commentStructure = [ 'id' => $ comment -> getId ( ) , 'authorName' => $ comment -> getAuthorName ( ) , 'authorEmail' => $ comment -> getAuthorEmail ( ) , 'content' => $ comment -> getContent ( ) , 'context' => $ comment -> getContext ( ) , 'createdAt' => $ comment -> getCreatedAt ( ) -> format ( 'Y-m-d H:i:s' ) , 'updatedAt' => $ comment -> getUpdatedAt ( ) -> format ( 'Y-m-d H:i:s' ) , ] ; if ( $ commentVotePackage instanceof VotePackage ) { $ commentStructure = array_merge ( $ commentStructure , [ 'nbVotes' => $ commentVotePackage -> getNbVotes ( ) , 'nbUpVotes' => $ commentVotePackage -> getNbUpVotes ( ) , 'nbDownVotes' => $ commentVotePackage -> getNbDownVotes ( ) , ] ) ; } return $ commentStructure ; }
Create structure for comment.

@param CommentInterface $comment            Comment
@param VotePackage      $commentVotePackage Vote package

@return array
Create structure for comment .