yii\validators\Validator::isActive PHP Method

isActive() public method

A validator is active if - the validator's on property is empty, or - the validator's on property contains the specified scenario
public isActive ( string $scenario ) : boolean
$scenario string scenario name
return boolean whether the validator applies to the specified scenario.
    public function isActive($scenario)
    {
        return !in_array($scenario, $this->except, true) && (empty($this->on) || in_array($scenario, $this->on, true));
    }