Automattic\WooCommerce\Vendor\Sabberworm\CSS

OutputFormatter::commentspublicWC 1.0

  • @param array<Commentable> $aComments
  • @return string

Method of the class: OutputFormatter{}

No Hooks.

Returns

null. Nothing (null).

Usage

$OutputFormatter = new OutputFormatter();
$OutputFormatter->comments( $oCommentable );
$oCommentable(Commentable) (required)
.

OutputFormatter::comments() code WC 10.4.3

public function comments(Commentable $oCommentable)
{
    if (!$this->oFormat->bRenderComments) {
        return '';
    }

    $sResult = '';
    $aComments = $oCommentable->getComments();
    $iLastCommentIndex = count($aComments) - 1;

    foreach ($aComments as $i => $oComment) {
        $sResult .= $oComment->render($this->oFormat);
        $sResult .= $i === $iLastCommentIndex ? $this->spaceAfterBlocks() : $this->spaceBetweenBlocks();
    }
    return $sResult;
}