WP_Dependencies::recurse_deps

Advertisement

Summery Summery

Recursively search the passed dependency tree for $handle.

Syntax Syntax

WP_Dependencies::recurse_deps( string[] $queue, string $handle )

Parameters Parameters

$queue

(string[]) (Required) An array of queued _WP_Dependency handles.

$handle

(string) (Required) Name of the item. Should be unique.

Return Return

(bool) Whether the handle is found after recursively searching the dependency tree.

Source Source

File: wp-includes/class.wp-dependencies.php

	 * @param string   $handle Name of the item. Should be unique.
	 * @return bool Whether the handle is found after recursively searching the dependency tree.
	 */
	protected function recurse_deps( $queue, $handle ) {
		if ( isset( $this->all_queued_deps ) ) {
			return isset( $this->all_queued_deps[ $handle ] );
		}

		$all_deps = array_fill_keys( $queue, true );
		$queues   = array();
		$done     = array();

		while ( $queue ) {
			foreach ( $queue as $queued ) {
				if ( ! isset( $done[ $queued ] ) && isset( $this->registered[ $queued ] ) ) {
					$deps = $this->registered[ $queued ]->deps;
					if ( $deps ) {
						$all_deps += array_fill_keys( $deps, true );
						array_push( $queues, $deps );
					}
					$done[ $queued ] = true;
				}
			}
			$queue = array_pop( $queues );
		}

		$this->all_queued_deps = $all_deps;

Advertisement

Changelog Changelog

Changelog
Version Description
4.0.0 Introduced.

Advertisement

Leave a Reply

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