src/controller/admin/class-rating.php
public function get_movie_rating( $votes ) {

		$votations = [];

		foreach ( $votes as $key => $value ) {
			for ( $i = 0; $i < $value; $i++ ) {
				$votations[] = $key;
			}
		}

		if ( count( $votations ) ) {
			$rating = array_sum( $votations ) / count( $votations );
			return round( $rating, 1 );
		}

		return 'N/A';
	}
public function get_movie_rating( $votes ) {

		$votations = [];

		foreach ( $votes as $key => $value ) {
			for ( $i = 0; $i < $value; $i++ ) {
				$votations[] = $key;
			}
		}

		if ( count( $votations ) ) {
			$rating = array_sum( $votations ) / count( $votations );
			return round( $rating, 1 );
		}

		return 'N/A';
	}
public function get_movie_rating ( $ votes ) { $ votations = [ ] ; foreach ( $ votes as $ key => $ value ) { for ( $ i = 0 ; $ i < $ value ; $ i ++ ) { $ votations [ ] = $ key ; } } if ( count ( $ votations ) ) { $ rating = array_sum ( $ votations ) / count ( $ votations ) ; return round ( $ rating , 1 ) ; } return 'N/A' ; }
Calculate rating.

@since 1.0.1

@param array $votes → votes number.

@return int|float|string → rating
Calculate rating .