Tribe__Repository::take( $n )

{@inheritdoc}


Source

File: src/Tribe/Repository.php

	public function take( $n ) {
		$query     = $this->build_query();
		$return_id = 'ids' === $query->get( 'fields', '' );
		$query->set( 'fields', 'ids' );
		$matching_ids = $query->get_posts();

		if ( empty( $matching_ids ) ) {
			return array();
		}

		$spliced = array_splice( $matching_ids, 0, $n );

		return $return_id ? $spliced : array_map( array( $this, 'format_item' ), $spliced );
	}