Automattic\WooCommerce\Internal\Admin\Notes

WooSubscriptionsNotes::has_action_url │ private static │ WC 1.0

Whether a note already has the given action with the given URL.

Lets expired notes saved before a link change pick up the new URL on the next refresh.

Method of the class: WooSubscriptionsNotes{}

No Hooks.

Returns

bool.

Usage

$result = WooSubscriptionsNotes::has_action_url( $note, $action_name, $url ): bool;
$note(Note) (required)
The note to check.
$action_name(string) (required)
The action name.
$url(string) (required)
The expected action URL.

WooSubscriptionsNotes::has_action_url() code WC 11.3.0

private static function has_action_url( Note $note, string $action_name, string $url ): bool {
	foreach ( (array) $note->get_actions() as $action ) {
		if ( isset( $action->name, $action->query ) && $action_name === $action->name ) {
			// Note::add_action() stores the URL through esc_url_raw(), so compare against the same form.
			return esc_url_raw( $url ) === $action->query;
		}
	}

	return false;
}