Reset input key for validation.

@param array $input
@param array $column $column is the column name array set
482617
public function resetInputKey(array &$input, array $column)
    {
        $column = array_flip($column);

        foreach ($input[$this->column] as $key => $value) {
            if (!array_key_exists($key, $column)) {
                continue;
            }

            $newKey = $key.$column[$key];

            /*
             * set new key
             */
            array_set($input, "{$this->column}.$newKey", $value);
            /*
             * forget the old key and value
             */
            array_forget($input, "{$this->column}.$key");
        }
    }
713480
public function setInput($input)
    {
        $this->input    = $input;

        $this->pos      = 0;

        $this->line     = 0;

        $this->linePos  = 0;

        $this->tokenType = TokenType::BOF;

        $this->tokenValue = null;

        $this->length   = strlen($this->input);
    }
542487
protected function _initColumn($column)
    {
        $defaults = [
            'type'  => 'string',
            'array' => false
        ];
        if (is_string($column)) {
            $column = ['type' => $column];
        } elseif (isset($column[0])) {
            $column['type'] = $column[0];
            unset($column[0]);
        }
        $column += $defaults;
        return $column + ['null' => false];
    }
648348
protected function resetInputKey(array &$input, array $column)
    {
        /**
         * flip the column name array set.
         *
         * for example, for the DateRange, the column like as below
         *
         * ["start" => "created_at", "end" => "updated_at"]
         *
         * to:
         *
         * [ "created_at" => "start", "updated_at" => "end" ]
         */
        $column = array_flip($column);

        /**
         * $this->column is the inputs array's node name, default is the relation name.
         *
         * So... $input[$this->column] is the data of this column's inputs data
         *
         * in the HasMany relation, has many data/field set, $set is field set in the below
         */
        foreach ($input[$this->column] as $index => $set) {

            /*
             * foreach the field set to find the corresponding $column
             */
            foreach ($set as $name => $value) {
                /*
                 * if doesn't have column name, continue to the next loop
                 */
                if (!array_key_exists($name, $column)) {
                    continue;
                }

                /**
                 * example:  $newKey = created_atstart.
                 *
                 * Σ( ° △ °|||)︴
                 *
                 * I don't know why a form need range input? Only can imagine is for range search....
                 */
                $newKey = $name.$column[$name];

                /*
                 * set new key
                 */
                Arr::set($input, "{$this->column}.$index.$newKey", $value);
                /*
                 * forget the old key and value
                 */
                Arr::forget($input, "{$this->column}.$index.$name");
            }
        }
    }
716416
public function getValidator(array $input)
    {
        if (!array_key_exists($this->column, $input)) {
            return false;
        }

        $input = array_only($input, $this->column);

        $form = $this->buildNestedForm($this->column, $this->builder);

        $rules = $attributes = [];

        /* @var Field $field */
        foreach ($form->fields() as $field) {
            if (!$fieldRules = $field->getRules()) {
                continue;
            }

            $column = $field->column();

            if (is_array($column)) {
                foreach ($column as $key => $name) {
                    $rules[$name.$key] = $fieldRules;
                }

                $this->resetInputKey($input, $column);
            } else {
                $rules[$column] = $fieldRules;
            }

            $attributes = array_merge(
                $attributes,
                $this->formatValidationAttribute($input, $field->label(), $column)
            );
        }

        array_forget($rules, NestedForm::REMOVE_FLAG_NAME);

        if (empty($rules)) {
            return false;
        }

        $newRules = [];

        foreach ($rules as $column => $rule) {
            foreach (array_keys($input[$this->column]) as $key) {
                $newRules["{$this->column}.$key.$column"] = $rule;
            }
        }

        return Validator::make($input, $newRules, $this->validationMessages, $attributes);
    }
118757
public static function column(Array $input, $columnKey, $indexKey = null)
	{
		$result = array();
		if (null === $indexKey) {
			if (null === $columnKey) {
				$result = array_values($input);
			} else {
				foreach ($input as $row) {
					switch (gettype($row)) {
						case "array":
							$result[] = $row[$columnKey];
							break;
						case "object":
							$result[] = $row->$columnKey;
							break;
					}
				}
			}
		} else {
			if (null === $columnKey) {
				foreach ($input as $row) {
					$result[$row[$indexKey]] = $row;
				}
			} else {
				foreach ($input as $row) {
					$result[$row[$indexKey]] = $row[$columnKey];
				}
			}
		}

		return $result;
	}
405229
protected function validate($input, array &$messages)
    {
        if ($input === '') {
            return;
        }

        $validChars = [];

        foreach ($this->charRanges as $startChar => $endChar) {
            $validChars += array_fill_keys(range($startChar, $endChar), true);
        }

        foreach (str_split($input) as $char) {
            if (!isset($validChars[$char])) {
                $messages[] = new Message(self::MESSAGE, ['valid_chars' => $this->formatCharRanges($this->charRanges)]);
                return;
            }
        }
    }
981357
public function setInput($input)
    {
        $this->input       = preg_replace("/\r\n|\r/", "\n", $input);
        $this->lineno      = 1;
        $this->deferred    = array();
        $this->indentStack = array();
        $this->stash       = array();
    }
181367
public function setColumn($col, $values)
    {
        if (!\is_array($values)) {
            \trigger_error("Values must be an array.", E_USER_ERROR);
            return false;
        }
        if (\is_numeric($col)) {
            \trigger_error("Column must be a letter, eg column D.", E_USER_ERROR);
            return false;
        }

        //todo check array
        $i = 0;
        foreach ($values as $value) {
            $this->setCell($col . ($i + 1), $value);
            $i++;
        }

        return true;
    }
603430
public function validate(string $key, array $scope = [], array $input = []): void
    {
        $value = $key == '*' ? '*' : $scope[$key] ?? null;

        ($this->validate)($value, $key, $scope, $input);
    }
769049
public function setColumns(array $columns): self
    {
        foreach ($columns as $column => list($type, $size)) {
            list($type, $size) = $this->validateColumn($type, $size);
            $columns[$column] = [$type, $size];
        }
        $this->columns = $columns;
        return $this;
    }
1331108
function ResetConfigArray($array_to_reset = '')
  {
      if (!is_array($array_to_reset)) {
        $array_to_reset = $this->_sql_tables_schema['config'];
      }
      // First, we reset all values (we know the key based on the schema)
      reset($array_to_reset);
      while(list($valid_key, $valid_format) = @each($array_to_reset)) {
          $pos = mb_strpos(mb_strtoupper($valid_format), 'DEFAULT');
          $value = "";
          if ($pos !== FALSE) {
              $value = trim(substr($valid_format, $pos + strlen("DEFAULT")));
              if (("'" == substr($value,0,1)) && ("'" == substr($value,-1))) {
                  $value = substr($value,1,-1);
              }
          }
          $this->_config_data[$valid_key] = $value;
      }
  }
984039
private function _initialise(array $input = array())
	{
		foreach ($input as $key => $object)
		{
			if (!is_null($object))
			{
				$this->offsetSet($key, $object);
			}
		}

		$this->rewind();
	}
898128
protected function resetInputKey(array &$input, array $column)
    {
        /**
         * flip the column name array set.
         *
         * for example, for the DateRange, the column like as below
         *
         * ["start" => "created_at", "end" => "updated_at"]
         *
         * to:
         *
         * [ "created_at" => "start", "updated_at" => "end" ]
         */
        $column = array_flip($column);

        /**
         * $this->column is the inputs array's node name, default is the relation name.
         *
         * So... $input[$this->column] is the data of this column's inputs data
         *
         * in the HasMany relation, has many data/field set, $set is field set in the below
         */
        foreach ($input[$this->column] as $index => $set) {
            /*
             * foreach the field set to find the corresponding $column
             */
            foreach ($set as $name => $value) {
                /*
                 * if doesn't have column name, continue to the next loop
                 */
                if (!array_key_exists($name, $column)) {
                    continue;
                }

                /**
                 * example:  $newKey = created_atstart.
                 *
                 * Σ( ° △ °|||)︴
                 *
                 * I don't know why a form need range input? Only can imagine is for range search....
                 */
                $newKey = $name.$column[$name];

                /*
                 * set new key
                 */
                array_set($input, "{$this->column}.$index.$newKey", $value);
                /*
                 * forget the old key and value
                 */
                array_forget($input, "{$this->column}.$index.$name");
            }
        }
    }
329030
protected function onInput($row)
    {
        if (is_array($this->params)) {
            foreach ($this->params as $cName => $cMap) {
                if (isset($this->mapFuncs[$cName])) {
                    $row[$cName] = $this->mapFuncs[$cName]($row[$cName]);
                } else if (is_array($cMap)) {
                    $row[$cName] = Utility::get($cMap, $row[$cName], $row[$cName]);
                }

            }
        } else if (is_callable($this->params)) {
            $func = $this->params;
            $pos = 0;
            foreach ($row as $cName => $value) {
                $row[$cName] = $func($value, $cName, $this->metaData['columns'][$cName], $pos);
                $pos++;
            }
        }
        $this->next($row);
    }
617022
function reset($columns) {
        collapse();
        chain().removeClass(`${namespace}-selected`);
        breadcrumb();

        // Upon reset ensure no value is returned to the calling code.
        settings.reset($columns);
        if (settings.preview) {
            $(`.${namespace}-preview`).remove();
        }
    }
197910
protected function doProcess($input, array &$messages)
    {
        $columns = $input[TableType::COLUMNS_FIELD];
        $rows    = isset($input[TableType::ROWS_FIELD]) ? $input[TableType::ROWS_FIELD] : null;
        $cells   = $input[TableType::CELLS_FIELD];

        if ($rows === null) {
            // If no row keys, replace with incrementing integers
            $i = 1;
            foreach ($cells as $rowKey => $cellRow) {
                $rows[$rowKey] = $i++;
            }
        }

        $tableCellClass   = $this->tableDataCellClass;
        $tableCellClasses = [];

        foreach ($columns as $columnKey => $columnValue) {
            foreach ($rows as $rowKey => $rowValue) {
                $tableCellClasses[] = $tableCellClass::create($columnValue, $rowValue, $cells[$rowKey][$columnKey]);
            }
        }

        return $tableCellClass::collection($tableCellClasses);
    }