Activity::count_group()

Description #

Count total items in a group.

Changelog #

VersionDescription
4.1.2Introduced.

Source #

File: includes/class/class-activity.php

	public function count_group() {
		if ( $this->have_group_items() ) {
			$next        = $this->current + 1;
			$count       = 0;
			$current_obj = $this->object;
			$next_obj    = $this->objects[ $next ];

			for ( $i = $next; $i < $this->count; $i++ ) {
				if ( $current_obj->q_id == $next_obj->q_id ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
					++$count;
				} else {
					break;
				}

				if ( $i + 1 < $this->count ) {
					$current_obj = $this->objects[ $i ];
					$next_obj    = $this->objects[ $i + 1 ];
				}
			}
		}

		return $count;
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment