src/mako/validator/Validator.php
public function addRulesIf(string $field, array $ruleSet, $condition): Validator
	{
		if($condition instanceof Closure)
		{
			$condition = $condition();
		}

		return $condition ? $this->addRules($field, $ruleSet) : $this;
	}
public function addRulesIf(string $field, array $ruleSet, $condition): Validator
	{
		if($condition instanceof Closure)
		{
			$condition = $condition();
		}

		return $condition ? $this->addRules($field, $ruleSet) : $this;
	}
public function addRulesIf ( string $ field , array $ ruleSet , $ condition ) : Validator { if ( $ condition instanceof Closure ) { $ condition = $ condition ( ) ; } return $ condition ? $ this -> addRules ( $ field , $ ruleSet ) : $ this ; }
Adds validation rules to input field if the condition is met.

@param  string                    $field     Input field
@param  array                     $ruleSet   Rule set
@param  bool|\Closure             $condition Condition
@return \mako\validator\Validator
Adds validation rules to input field if the condition is met .