Automattic\WooCommerce\Internal\Abilities

AbilitiesTracking::find_frame │ private │ WC 1.0

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.

Метод класса: AbilitiesTracking{}

Хуков нет.

Возвращает

int|null. Index in the frames stack, or null when none is open.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->find_frame( $ability_name, $executing ): ?int;
$ability_name(строка) (обязательный)
The ability name.
$executing(true|false) (обязательный)
Whether the invocation must have started executing.

Код AbilitiesTracking::find_frame() 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;
}