GC_Dependencies::recurse_deps()
最后更新于:2021-11-27 14:33:12
GC_Dependencies::recurse_deps( string[]$queue, string$handle)Recursively search the passed dependency tree for $handle.
参数
- $queue
-
(string[]) (Required) An array of queued _GC_Dependency handles.
- $handle
-
(string) (Required) Name of the item. Should be unique.
响应
(bool) Whether the handle is found after recursively searching the dependency tree.
源文件
文件: gc-includes/class.gc-dependencies.php
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;
return isset( $this->all_queued_deps[ $handle ] );
}