Automattic\WooCommerce\Internal\Abilities
AbilitiesTracking::find_frame
Find the innermost open invocation of an ability in a given execution state.
Matching the state keeps a recursive call that failed without a closing hook from hiding its outer call.
Method of the class: AbilitiesTracking{}
No Hooks.
Returns
int|null. Index in the frames stack, or null when none is open.
Usage
// private - for code of main (parent) class only $result = $this->find_frame( $ability_name, $executing ): ?int;
- $ability_name(string) (required)
- The ability name.
- $executing(true|false) (required)
- Whether the invocation must have started executing.
AbilitiesTracking::find_frame() AbilitiesTracking::find frame code WC 11.3.0
private function find_frame( string $ability_name, bool $executing ): ?int {
for ( $index = count( $this->frames ) - 1; $index >= 0; $index-- ) {
if ( $ability_name === $this->frames[ $index ]['name'] && $executing === $this->frames[ $index ]['executing'] ) {
return $index;
}
}
return null;
}