PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.4
Booking for Appointments and Events Calendar – Amelia v2.4.4
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / rmccue / requests / src / Exception / ArgumentCount.php
ameliabooking / vendor / rmccue / requests / src / Exception Last commit date
Http 5 months ago Transport 5 months ago ArgumentCount.php 5 months ago Http.php 5 months ago InvalidArgument.php 5 months ago Transport.php 5 months ago
ArgumentCount.php
48 lines
1 <?php
2
3 namespace AmeliaVendor\WpOrg\Requests\Exception;
4
5 use AmeliaVendor\WpOrg\Requests\Exception;
6
7 /**
8 * Exception for when an incorrect number of arguments are passed to a method.
9 *
10 * Typically, this exception is used when all arguments for a method are optional,
11 * but certain arguments need to be passed together, i.e. a method which can be called
12 * with no arguments or with two arguments, but not with one argument.
13 *
14 * Along the same lines, this exception is also used if a method expects an array
15 * with a certain number of elements and the provided number of elements does not comply.
16 *
17 * @package Requests\Exceptions
18 * @since 2.0.0
19 */
20 final class ArgumentCount extends Exception {
21
22 /**
23 * Create a new argument count exception with a standardized text.
24 *
25 * @param string $expected The argument count expected as a phrase.
26 * For example: `at least 2 arguments` or `exactly 1 argument`.
27 * @param int $received The actual argument count received.
28 * @param string $type Exception type.
29 *
30 * @return \AmeliaVendor\WpOrg\Requests\Exception\ArgumentCount
31 */
32 public static function create($expected, $received, $type) {
33 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace
34 $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
35
36 return new self(
37 sprintf(
38 '%s::%s() expects %s, %d given',
39 $stack[1]['class'],
40 $stack[1]['function'],
41 $expected,
42 $received
43 ),
44 $type
45 );
46 }
47 }
48