Sindbad~EG File Manager

Current Path : /home/nicedoo/www/wp-content/plugins/flexible-checkout-fields/src/Validator/Rule/
Upload File :
Current File : /home/nicedoo/www/wp-content/plugins/flexible-checkout-fields/src/Validator/Rule/ValueRegexRule.php

<?php

namespace WPDesk\FCF\Free\Validator\Rule;

use WPDesk\FCF\Free\Settings\Option\RegexPhoneOption;
use WPDesk\FCF\Free\Validator\Error\InvalidRegexError;

/**
 * Checks that value is valid.
 */
class ValueRegexRule implements ValidatorRule {

	/**
	 * {@inheritdoc}
	 */
	public function validate_value( string $value, array $field_data ) {
		$validation_regex = $field_data[ RegexPhoneOption::FIELD_NAME ];
		if ( ( $validation_regex === '' ) || ( $value === '' )
			|| preg_match( '/^' . $validation_regex . '$/', $value ) ) {
			return null;
		}

		return new InvalidRegexError( $field_data, $value );
	}
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists