"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/validators/Validator.php" between
yii2-2.0.35.tar.gz and yii2-2.0.36.tar.gz

About: Yii 2 is a high-performance component-based PHP framework for developing large-scale Web applications (source).

Validator.php  (yii2-2.0.35):Validator.php  (yii2-2.0.36)
skipping to change at line 211 skipping to change at line 211
* @param \yii\base\Model $model the data model to be validated. * @param \yii\base\Model $model the data model to be validated.
* @param array|string $attributes list of attributes to be validated. This can be either an array of * @param array|string $attributes list of attributes to be validated. This can be either an array of
* the attribute names or a string of comma-separated attribute names. * the attribute names or a string of comma-separated attribute names.
* @param array $params initial values to be applied to the validator proper ties. * @param array $params initial values to be applied to the validator proper ties.
* @return Validator the validator * @return Validator the validator
*/ */
public static function createValidator($type, $model, $attributes, $params = []) public static function createValidator($type, $model, $attributes, $params = [])
{ {
$params['attributes'] = $attributes; $params['attributes'] = $attributes;
if ($type instanceof \Closure || ($model->hasMethod($type) && !isset(sta if ($type instanceof \Closure) {
tic::$builtInValidators[$type]))) {
// method-based validator
$params['class'] = __NAMESPACE__ . '\InlineValidator'; $params['class'] = __NAMESPACE__ . '\InlineValidator';
$params['method'] = $type; $params['method'] = $type;
} elseif (!isset(static::$builtInValidators[$type]) && $model->hasMethod
($type)) {
// method-based validator
$params['class'] = __NAMESPACE__ . '\InlineValidator';
$params['method'] = [$model, $type];
} else { } else {
unset($params['current']);
if (isset(static::$builtInValidators[$type])) { if (isset(static::$builtInValidators[$type])) {
$type = static::$builtInValidators[$type]; $type = static::$builtInValidators[$type];
} }
if (is_array($type)) { if (is_array($type)) {
$params = array_merge($type, $params); $params = array_merge($type, $params);
} else { } else {
$params['class'] = $type; $params['class'] = $type;
} }
} }
 End of changes. 3 change blocks. 
3 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)