GRAYBYTE WORDPRESS FILE MANAGER6556

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/giriqfky/chahida.co.in/wp-content/plugins/woocommerce/src/Internal/Utilities/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/giriqfky/chahida.co.in/wp-content/plugins/woocommerce/src/Internal/Utilities//Types.php
<?php

declare( strict_types = 1 );

namespace Automattic\WooCommerce\Internal\Utilities;

use InvalidArgumentException;

/**
 * Utilities to help ensure type safety.
 */
class Types {
	/**
	 * Checks if $thing is an instance of $desired_type.
	 *
	 * If the check succeeds, $thing will be returned without further modification. If the check fails, then either
	 * an exception will be thrown or, if an $on_failure callback was supplied, it will be invoked to either generate
	 * an appropriate return value or to throw a more specific exception.
	 *
	 * Please note that the failure handler will be passed two arguments:
	 *
	 *     $on_failure( $object, $desired_type )
	 *
	 * @since 9.1.0
	 * @throws InvalidArgumentException If $object does not match $desired_type, and an $on_failure callback was not supplied.
	 *
	 * @param mixed     $thing        The value or reference to be assessed.
	 * @param string    $desired_type What we expect the return type to be, if it is not a WP_Error.
	 * @param ?callable $on_failure   If provided, and if evaluation fails, this will be invoked to generate a return value.
	 *
	 * @return mixed
	 */
	public static function ensure_instance_of( $thing, string $desired_type, ?callable $on_failure = null ) {
		// If everything looks good, return early.
		if ( $thing instanceof $desired_type ) {
			return $thing;
		}

		// Summarize the error for use in logging and in case we have to throw an exception.
		$summary = sprintf(
			'Object was not of expected type %1$s.',
			$desired_type
		);

		// Otherwise, let's log the problem so the site operator has a record of where things went wrong.
		$logger = wc_get_logger();

		if ( $logger ) {
			$logger->error(
				$summary,
				array(
					'source'    => 'wc-type-check-utility',
					'backtrace' => true,
				)
			);
		}

		// Invoke the $on_failure handler, if specified.
		if ( null !== $on_failure ) {
			return $on_failure( $thing, $desired_type );
		}

		throw new InvalidArgumentException( esc_html( $summary ) );
	}
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 10 2025 04:32:19
giriqfky / giriqfky
0755
.htaccess
0.41 KB
July 10 2025 04:32:19
giriqfky / giriqfky
0644
ArrayUtil.php
2.103 KB
January 06 2025 20:19:28
giriqfky / giriqfky
0644
BlocksUtil.php
2.185 KB
May 24 2022 21:38:16
giriqfky / giriqfky
0644
COTMigrationUtil.php
6.037 KB
May 12 2025 21:07:28
giriqfky / giriqfky
0644
DatabaseUtil.php
16.097 KB
September 23 2024 20:44:04
giriqfky / giriqfky
0644
FilesystemUtil.php
5.182 KB
May 12 2025 15:44:58
giriqfky / giriqfky
0644
HtmlSanitizer.php
3.097 KB
April 30 2024 19:35:34
giriqfky / giriqfky
0644
LegacyRestApiStub.php
6.647 KB
December 18 2024 22:19:16
giriqfky / giriqfky
0644
PluginInstaller.php
14.011 KB
December 18 2024 22:19:16
giriqfky / giriqfky
0644
Types.php
1.973 KB
December 16 2024 15:24:32
giriqfky / giriqfky
0644
URL.php
13.104 KB
December 16 2024 15:24:32
giriqfky / giriqfky
0644
URLException.php
0.187 KB
April 20 2022 06:50:54
giriqfky / giriqfky
0644
Users.php
7.636 KB
July 10 2024 21:55:32
giriqfky / giriqfky
0644
WebhookUtil.php
5.368 KB
December 18 2024 22:19:16
giriqfky / giriqfky
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF