You are here

Count.php in Voting API 8.3

File

src/Plugin/VoteResultFunction/Count.php
View source
<?php

namespace Drupal\votingapi\Plugin\VoteResultFunction;

use Drupal\votingapi\VoteResultFunctionBase;

/**
 * A sum of a set of votes.
 *
 * @VoteResultFunction(
 *   id = "vote_count",
 *   label = @Translation("Count"),
 *   description = @Translation("The number of votes cast.")
 * )
 */
class Count extends VoteResultFunctionBase {

  /**
   * {@inheritdoc}
   */
  public function calculateResult($votes) {
    return count($votes);
  }

}

Classes

Namesort descending Description
Count A sum of a set of votes.