HEX
Server: LiteSpeed
System: Linux eko108.isimtescil.net 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: uyarreklamcomtr (11202)
PHP: 7.4.33
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/WPError.php.tar
uyarreklam.com.tr/httpdocs/wp-content/plugins/google-listings-and-ads/src/Exception/WPError.php000064400000001603151550774140031635 0ustar00var/www/vhosts<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use RuntimeException;
use WP_Error;

/**
 * Class WPError.
 *
 * Used to convert a WP_Error object to a thrown exception.
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class WPError extends RuntimeException implements GoogleListingsAndAdsException {

	/**
	 * Convert a WP_Error object to a throwable exception.
	 *
	 * @param WP_Error $error The error object.
	 *
	 * @return static
	 */
	public static function from_error( WP_Error $error ) {
		$message     = $error->get_error_message();
		$code        = $error->get_error_code();
		$string_code = '';
		if ( ! is_numeric( $code ) ) {
			$string_code = $code;
			$code        = 0;
		}

		return new static(
			sprintf( 'A WP Error was generated. Code: "%s" Message: "%s".', $string_code, $message ),
			$code
		);
	}
}