"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/validators/InlineValidator.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).

InlineValidator.php  (yii2-2.0.35):InlineValidator.php  (yii2-2.0.36)
skipping to change at line 61 skipping to change at line 61
* { * {
* return "javascript"; * return "javascript";
* } * }
* ``` * ```
* *
* where `$attribute` refers to the attribute name to be validated. * where `$attribute` refers to the attribute name to be validated.
* *
* Please refer to [[clientValidateAttribute()]] for details on how to retur n client validation code. * Please refer to [[clientValidateAttribute()]] for details on how to retur n client validation code.
*/ */
public $clientValidate; public $clientValidate;
/**
* @var mixed the value of attribute being currently validated.
* @since 2.0.36
*/
public $current;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function validateAttribute($model, $attribute) public function validateAttribute($model, $attribute)
{ {
$method = $this->method; $method = $this->method;
if (is_string($method)) { if (is_string($method)) {
$method = [$model, $method]; $method = [$model, $method];
} elseif ($method instanceof \Closure) {
$method = $this->method->bindTo($model);
}
$current = $this->current;
if ($current === null) {
$current = $model->$attribute;
} }
call_user_func($method, $attribute, $this->params, $this); $method($attribute, $this->params, $this, $current);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function clientValidateAttribute($model, $attribute, $view) public function clientValidateAttribute($model, $attribute, $view)
{ {
if ($this->clientValidate !== null) { if ($this->clientValidate !== null) {
$method = $this->clientValidate; $method = $this->clientValidate;
if (is_string($method)) { if (is_string($method)) {
$method = [$model, $method]; $method = [$model, $method];
} elseif ($method instanceof \Closure) {
$method = $this->method->bindTo($model);
} }
$current = $this->current;
return call_user_func($method, $attribute, $this->params, $this); if ($current === null) {
$current = $model->$attribute;
}
return $method($attribute, $this->params, $this, $current);
} }
return null; return null;
} }
} }
 End of changes. 5 change blocks. 
3 lines changed or deleted 20 lines changed or added

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