File "Idempotent_Request.php"

Full Path: /home/vantageo/public_html/cache/cache/.wp-cli/wp-content/plugins/facebook-for-woocommerce/includes/API/Traits/Idempotent_Request.php
File size: 762 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
/**
 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
 *
 * This source code is licensed under the license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @package FacebookCommerce
 */

namespace WooCommerce\Facebook\API\Traits;

defined( 'ABSPATH' ) || exit;

/**
 * Idempotent request trait.
 *
 * @since 2.1.0
 */
trait Idempotent_Request {


	/** @var string holds the request's idempotency key */
	protected $idempotency_key;


	/**
	 * Gets the value of idempotency key.
	 *
	 * @since 2.1.0
	 *
	 * @return string
	 */
	public function get_idempotency_key() {

		if ( empty( $this->idempotency_key ) ) {

			$this->idempotency_key = wp_generate_uuid4();
		}

		return $this->idempotency_key;
	}
}