protected function buildRuleWhen($type, $not = false)
    {
        return function ($model) use ($type, $not) {
            /* @var $model Record */
            return $not xor in_array($model->type, (array) $type, true);
        };
    }