protected function chain(Sanitize $sanitize, $input, $attribute) { $callback = function ($value) use($sanitize, $attribute) { if (is_array($value)) { if (!$this->recursive) { return $value; } $this->attributes = is_array($this->attributes) && isset($this->attributes[$attribute]) ? $this->attributes[$attribute] : $this->attributes; return $this->sanitize($value); } return $sanitize->sanitize($value); }; return ArrayHelper::updateValue($input, explode('.', $attribute), $callback); }
protected function processing($row, array $fields, $value) { if (is_array($row)) { $callback = function () use($value) { return $value; }; return ArrayHelper::updateValue($row, $fields, $callback, false); } $r = $row; foreach ($fields as $field) { if (!isset($r->{$field})) { break; } if (is_string($r->{$field})) { $r->{$field} = $value; break; } $r = $r->{$field}; } return $row; }