HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/lipovac/wp-content/plugins/the-events-calendar/common/src/Tribe/Utils/Collection.php
<?php
/**
 * Models a generic collection of elements as a linked list.
 *
 * @since 4.9.5
 */

/**
 * Class Tribe__Utils__Collection
 *
 * @since 4.9.5
 */
class Tribe__Utils__Collection extends SplDoublyLinkedList {

	/**
	 * The list of items the collection was initialized with.
	 *
	 * @var array
	 */
	protected $items = array();

	/**
	 * The doubly-linked list that will hold the items handled by the collection.
	 *
	 * @var \SplDoublyLinkedList
	 */
	protected $list;

	/**
	 * Tribe__Utils__Collection constructor.
	 *
	 * @param array $items The array of items to initialize the linked list with.
	 */
	public function __construct( array $items ) {
		$this->items = $items;
		foreach ( $items as $item ) {
			$this->push( $item );
		}
	}

	/**
	 * Runs a callback function on all the collection items and returns the results.
	 *
	 * This is just a wrapper around the `array_map` method.
	 *
	 * @since 4.9.5
	 *
	 * @param callable $callback The callback to run on each collection item.
	 *
	 * @return array An array of results returned by running the callback on all
	 *               collection items.
	 */
	public function map( $callback ) {
		return array_map( $callback, $this->items );
	}
}