WP_Dependencies::do_items( string|string[]|false $handles = false, int|false $group = false ): string[]
- Since
- 2.6.0, 2.8.0
- Source
wp-includes/class-wp-dependencies.php:121
Description
Processes the items passed to it or the queue, and their dependencies.
Compatibility
- WordPress
- since 2.8.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$handlesstring|string[]|falseoptional- Items to be processed: queue (false), single item (string), or multiple items (array of strings).
Default false.Default:false $groupint|falseoptional- Group level: level (int), no group (false).Default:
false
Return value
string[]- Array of handles of items that have been processed.
Performance profile
How much work a call to WP_Dependencies::do_items() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Scales with input
- Instructions
- 14–16
- Plugin surface
- None
- Called by
- 0
Touches nothing outside its own arguments.
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 36.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What one call costs · 1 distinct outcome
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Dependencies::do_items() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 14–16 | ->all_deps() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 36 | 14–16 | 6 | |
| 8.5 | 36 | 14–16 | 6 | |
| 8.4 | 36 | 14–16 | 6 | 3 fewer instructions than PHP 8.3 |
| 8.3 | 39 | 14–16 | 6 | |
| 8.2 | 39 | 14–16 | 6 | |
| 8.1 | 39 | 14–16 | 6 | 2 fewer instructions than PHP 7.4 |
| 7.4 | 41 | 15–17 | 6 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 2
- WP_Dependencies::all_deps()Determines dependencies.
- WP_Dependencies::do_item()Processes a dependency.
Source code
public function do_items( $handles = false, $group = false ) { /* * If nothing is passed, print the queue. If a string is passed, * print that item. If an array is passed, print those items. */ $handles = false === $handles ? $this->queue : (array) $handles; $this->all_deps( $handles ); foreach ( $this->to_do as $key => $handle ) { if ( ! in_array( $handle, $this->done, true ) && isset( $this->registered[ $handle ] ) ) { /* * Attempt to process the item. If successful, * add the handle to the done array. * * Unset the item from the to_do array. */ if ( $this->do_item( $handle, $group ) ) { $this->done[] = $handle; } unset( $this->to_do[ $key ] ); } } return $this->done; }Changelog
Introduced in 2.6.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
$group parameter.from the docblockAbout this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-includes/class-wp-dependencies.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.