| Server IP : 68.183.124.220 / Your IP : 216.73.217.137 Web Server : Apache/2.4.18 (Ubuntu) System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : gavin ( 1000) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/wp-content/plugins/wordpress-seo/inc/exceptions/ |
Upload File : |
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Internals
*/
/**
* Class WPSEO_Invalid_Argument_Exception.
*/
class WPSEO_Invalid_Argument_Exception extends InvalidArgumentException {
/**
* Creates an invalid empty parameter exception.
*
* @param string $name The name of the parameter.
*
* @return WPSEO_Invalid_Argument_Exception The exception.
*/
public static function empty_parameter( $name ) {
return new self(
sprintf(
/* translators: %1$s expands to the parameter name. */
__( 'The parameter `%1$s` cannot be empty.', 'wordpress-seo' ),
$name
)
);
}
/**
* Creates an invalid parameter exception.
*
* @param mixed $parameter The parameter value of the field.
* @param string $name The name of the field.
* @param string $expected The expected type.
*
* @return WPSEO_Invalid_Argument_Exception The exception.
*/
public static function invalid_parameter_type( $parameter, $name, $expected ) {
return new self(
sprintf(
/* translators: %1$s expands to the parameter name. %2$s expands to the expected type and %3$s expands to the expected type. */
__( 'Invalid type for parameter `%1$s` passed. Expected `%2$s`, but got `%3$s`', 'wordpress-seo' ),
$name,
$expected,
gettype( $parameter )
)
);
}
/**
* Creates an invalid integer parameter exception.
*
* @param mixed $parameter The parameter value of the field.
* @param string $name The name of the field.
*
* @return WPSEO_Invalid_Argument_Exception The exception.
*/
public static function invalid_integer_parameter( $parameter, $name ) {
return self::invalid_parameter_type( $parameter, $name, 'integer' );
}
/**
* Creates an invalid string parameter exception.
*
* @param mixed $parameter The parameter value of the field.
* @param string $name The name of the field.
*
* @return WPSEO_Invalid_Argument_Exception The exception.
*/
public static function invalid_string_parameter( $parameter, $name ) {
return self::invalid_parameter_type( $parameter, $name, 'string' );
}
/**
* Creates an invalid boolean parameter exception.
*
* @param mixed $parameter The parameter value of the field.
* @param string $name The name of the field.
*
* @return WPSEO_Invalid_Argument_Exception The exception.
*/
public static function invalid_boolean_parameter( $parameter, $name ) {
return self::invalid_parameter_type( $parameter, $name, 'boolean' );
}
/**
* Creates an invalid callable parameter exception.
*
* @param mixed $parameter The parameter value of the field.
* @param string $name The name of the field.
*
* @return WPSEO_Invalid_Argument_Exception The exception.
*/
public static function invalid_callable_parameter( $parameter, $name ) {
return self::invalid_parameter_type( $parameter, $name, 'callable' );
}
/**
* Creates an invalid object type exception.
*
* @param string $type The type of the field.
*
* @return WPSEO_Invalid_Argument_Exception The exception.
*/
public static function invalid_type( $type ) {
return new self(
sprintf(
/* translators: %1$s expands to the object type. */
__( 'The object type `%1$s` is invalid', 'wordpress-seo' ),
$type
)
);
}
/**
* Creates an invalid object subtype exception.
*
* @param string $subtype The invalid subtype.
* @param string $type The parent type of the subtype.
*
* @return WPSEO_Invalid_Argument_Exception The exception.
*/
public static function invalid_subtype( $subtype, $type ) {
return new self(
sprintf(
/* translators: %1$s expands to the object subtype. %2$s resolved to the object type. */
__( '`%1$s` is not a valid subtype of `%2$s`', 'wordpress-seo' ),
$subtype,
$type
)
);
}
/**
* Creates an unknown object exception.
*
* @param int $id The ID that was searched for.
* @param string $type The type of object that was being searched for.
*
* @return WPSEO_Invalid_Argument_Exception The exception.
*/
public static function unknown_object( $id, $type ) {
return new self(
sprintf(
/* translators: %1$s expands to the object ID. %2$s resolved to the object type. */
__( 'No object with ID %1$s and %2$s could be found', 'wordpress-seo' ),
$id,
$type
)
);
}
}