File "Collection_Interface.php"

Full Path: /home/romayxjt/public_html/wp-content/plugins/the-events-calendar/common/src/Tribe/Utils/Collection_Interface.php
File size: 1.2 KB
MIME-type: text/x-php
Charset: utf-8

<?php
/**
 * A class providing collection methods.
 *
 * For convenience classes implementing this interface should `use Collection_Trait` and implement just the `all`
 * method.
 *
 * @since   4.9.14
 * @package Tribe\Utils
 */

namespace Tribe\Utils;

/**
 * Interface Collection_Interface
 * @since   4.9.14
 * @package Tribe\Utils
 */
interface Collection_Interface extends \ArrayAccess, \SeekableIterator, \Countable, \Serializable, \JsonSerializable {
	/**
	 * Returns all the items in the collection.
	 *
	 * @since 4.9.14
	 *
	 * @return array All the items in the collection.
	 */
	public function all();

	/**
	 * Returns the first item in the collection.
	 *
	 * @since 4.9.14
	 *
	 * @return mixed The first item in the collection.
	 */
	public function first();

	/**
	 * Returns the last item in the collection.
	 *
	 * @since 4.9.14
	 *
	 * @return mixed The last item in the collection.
	 */
	public function last();

	/**
	 * Returns the nth item in the collection.
	 *
	 * @since 4.9.14
	 *
	 * @param int $n The 1-based index of the item to return. It's not 0-based, `1` will return the first item.
	 *
	 * @return mixed|null The nth item in the collection or `null` if not set.
	 */
	public function nth( $n );
}