Automattic\WooCommerce\Internal\Abilities

AbilitiesTracking::create_frame │ private │ WC 1.0

Create the record of an invocation, with the context it started in.

Method of the class: AbilitiesTracking{}

No Hooks.

Returns

array{name: string, channel: string, rest_namespace: string, external_client: string, start: float, executing: bool}.

Usage

// private - for code of main (parent) class only
$result = $this->create_frame( $ability_name, $executing ): array;
$ability_name(string) (required)
The ability name.
$executing(true|false) (required)
Whether execution already started.

AbilitiesTracking::create_frame() code WC 11.3.0

private function create_frame( string $ability_name, bool $executing ): array {
	$channel = $this->get_channel();
	return array(
		'name'            => $ability_name,
		'channel'         => $channel,
		'rest_namespace'  => $this->get_rest_namespace(),
		// Resolved now: the request metadata it reads is gone once the REST request finishes.
		'external_client' => 'mcp' === $channel ? $this->get_external_client() : self::NONE,
		'start'           => microtime( true ),
		'executing'       => $executing,
	);
}