Automattic\WooCommerce\Internal\Abilities
AbilitiesTracking::close_frame
Finish tracking the innermost open invocation of an ability.
Invocations opened after it are calls that failed without a closing hook. On WordPress 7.0, a failed recursive call of the same ability can't be told apart from the outer call, so their outcomes can swap; counts stay right.
Метод класса: AbilitiesTracking{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->close_frame( $ability_name, $executing, $result ): void;
- $ability_name(разное) (обязательный)
- The ability name.
- $executing(true|false) (обязательный)
- Execution state the invocation must be in; hooks before and after execution share filters with other callers.
- $result(разное) (обязательный)
- Null for success, a WP_Error for failure, or a short-circuited result.
Код AbilitiesTracking::close_frame() AbilitiesTracking::close frame WC 11.3.0
private function close_frame( $ability_name, bool $executing, $result ): void {
if ( ! self::is_tracked_ability( $ability_name ) ) {
return;
}
$index = $this->find_frame( $ability_name, $executing );
if ( null === $index ) {
return;
}
$frame = $this->frames[ $index ];
foreach ( array_splice( $this->frames, $index ) as $offset => $closed_frame ) {
if ( $offset > 0 ) {
$this->add_event( $closed_frame, null, false );
}
}
// Only executed calls report a duration, so it always measures execution.
$this->add_event( $frame, is_wp_error( $result ) ? $result : true, $frame['executing'] );
}