WpOrg\Requests\Exception

ArgumentCount::create()public staticWP 1.0

Create a new argument count exception with a standardized text.

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

Хуков нет.

Возвращает

\WpOrg\Requests\Exception\ArgumentCount.

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

$result = ArgumentCount::create( $expected, $received, $type );
$expected(строка) (обязательный)
The argument count expected as a phrase. For example: at least 2 arguments or exactly 1 argument.
$received(int) (обязательный)
The actual argument count received.
$type(строка) (обязательный)
Exception type.

Код ArgumentCount::create() WP 6.6.1

public static function create($expected, $received, $type) {
	// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace
	$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);

	return new self(
		sprintf(
			'%s::%s() expects %s, %d given',
			$stack[1]['class'],
			$stack[1]['function'],
			$expected,
			$received
		),
		$type
	);
}