Automattic\WooCommerce\StoreApi\Routes\V1\Ucp

CatalogSearch::decode_cursor │ private │ WC 1.0

Decode a cursor string back into a numeric offset.

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

Хуков нет.

Возвращает

int.

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

// private - только в коде основоного (родительского) класса
$result = $this->decode_cursor( $cursor ): int;
$cursor(строка) (обязательный)
Opaque cursor string.

Код CatalogSearch::decode_cursor() WC 11.3.0

private function decode_cursor( string $cursor ): int {
	if ( '' === $cursor ) {
		return 0;
	}

	$decoded = base64_decode( $cursor, true ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode
	if ( false === $decoded || 0 !== strpos( $decoded, 'offset:' ) ) {
		return 0;
	}

	return max( 0, (int) substr( $decoded, 7 ) );
}