framework/validators/Validator.php
public function isActive($scenario)
    {
        return !in_array($scenario, $this->except, true) && (empty($this->on) || in_array($scenario, $this->on, true));
    }
public function isActive($scenario)
    {
        return !in_array($scenario, $this->except, true) && (empty($this->on) || in_array($scenario, $this->on, true));
    }
Returns a value indicating whether the validator is active for the given scenario and attribute.

A validator is active if

- the validator's `on` property is empty, or
- the validator's `on` property contains the specified scenario

@param string $scenario scenario name
@return bool whether the validator applies to the specified scenario.