automatewoo/includes/Traits/StringValidator.php
fei-source 47d3c9a8b6 Update to v6.2.2
Source: GrootMade/Festinger Vault
2026-03-15 08:31:15 +08:00

26 lines
473 B
PHP

<?php
namespace AutomateWoo\Traits;
use AutomateWoo\Exceptions\InvalidArgument;
/**
* Class StringValidator
*
* @since 5.1.0
*/
trait StringValidator {
/**
* Validate that an item is a string.
*
* @param mixed $value The value to validate.
*
* @throws InvalidArgument When $value is not a string.
*/
public function validate_is_string( $value ) {
if ( ! is_string( $value ) ) {
throw InvalidArgument::invalid_parameter_type( 'string' );
}
}
}