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/NumberMaxRule.php

<?php

namespace WPDesk\FCF\Free\Validator\Rule;

use WPDesk\FCF\Free\Settings\Option\ValueMaxOption;
use WPDesk\FCF\Free\Validator\Error\NumberMaxError;

/**
 * Checks that number meets maximum value requirement.
 */
class NumberMaxRule implements ValidatorRule {

	/**
	 * {@inheritdoc}
	 */
	public function validate_value( string $value, array $field_data ) {
		$number_max = $field_data[ ValueMaxOption::FIELD_NAME ] ?? '';
		if ( ( $value === '' ) || ( $number_max === '' ) || ( $value <= $number_max ) ) {
			return null;
		}

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

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