@param mixed $input
@param array $messages

@return mixed
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);
    }
614876
public function send($input)
    {
        if (stripos(strrev($input), PHP_EOL) === false) {
            $input = $input . PHP_EOL;
        }

        $this->steps[] = [self::SEND, $input];

        return $this;
    }
594256
private function arrayHasKeys(array $input, array $keys)
    {
        foreach ($keys as $key) {
            if (!array_key_exists($key, $input)) {
                throw new \InvalidArgumentException(sprintf(
                    'Input missing required one or more required keys. Required keys are %s',
                    implode(', ', $keys)
                ));
            }
        }
    }
68586
public function keyToValue(array $input)
    {
        $output = array();

        foreach ($input as $key => $value) {
            $output[] = array($key, $value);
        }

        return $output;
    }
796964
public function validate(array $input = []): ValidationResult
    {
        $results = [];

        foreach ($this->rules as $key => $definition) {

            $rules = $this->parser->parseRulesDefinition($definition);

            $results[$key] = $rules->validate($key, $input);

        }

        return new ValidationResult($results, $this->translator);
    }
1112302
public function resolveMessageArrayToMessageKeys(array $messages, $prefix="")
    {
        $flatArray = [];

        foreach ($messages as $key=>$message) {
            $this->resolveMessageToKeys($message, $key, function($qualifiedKey) use(&$flatArray)
                {
                    $flatArray[] = $qualifiedKey;
                }, $prefix);
        }

        return $flatArray;
    }
821378
protected function validate($input, array &$messages)
    {
        $uniqueValues = [];

        foreach ($input as $element) {
            $uniqueValues[ValueHasher::hash($element)] = true;
        }

        if (count($uniqueValues) !== count($input)) {
            $messages[] = new Message(self::MESSAGE);
        }
    }
335233
public function update(array $input = [])
    {
        DB::beginTransaction();

        try {
            LaravelEvent::fire(static::$name.'.updating', $this);
            $this->beforeUpdate($input);
            $return = parent::update($input);
            $this->afterUpdate($input, $return);
            LaravelEvent::fire(static::$name.'.updated', $this);

            DB::commit();
        } catch (\Exception $e) {
            DB::rollBack();
            throw $e;
        }

        return $return;
    }
775272
protected function getValidationMessagesForElements(array $messages = [])
    {
        $this->getElements()->onlyActive()->each(function ($element) use (&$messages) {
            $element = $this->getElementContainer($element);

            if ($element instanceof Validable) {
                $messages += $element->getValidationMessages();
            }
        });

        return $messages;
    }
1203975
protected function getPrefixedInput($input, $prefix = '')
    {
        if( $prefix == '' ) {
            return $input;
        }

        $results = array();
        foreach( $input as $key => $value ) {
            $results[ $prefix .'_'. $key ] = $value;
        }

        return $results;
    }
474767
public function with_input( array $input = null ) {
		$this->get_session()->flash_input(
			$this->clean_input( ! is_null( $input ) ? $input : $this->get_request()->input() )
		);

		return $this;
	}
102536
protected function purifyInputs(array $inputs)
    {
        $newInputs = [];

        foreach ($inputs as $key => $value) {
            if (is_array($value)) {
                throw new InvalidArgumentException('Input array can NOT contain nested arrays.');
            }

            if (strlen((string)$key) > $this->maxTextLength) {
                throw new TextTooLongException("Input array has at least one key whose name exceeds the max length allowed.");
            }

            if (strlen((string)$value) > $this->maxTextLength) {
                throw new TextTooLongException("Input array has at least one language value whose value exceeds the max length allowed.");
            }

            $newInputs[e($key)] = e($value);
        }

        return $newInputs;
    }
31488
public function check(array $data, array $messages = array())
    {

        // Merge the given messages with the set messages.
        $messages = array_merge($this->_messages, $messages);

        // Check the CSRF token if we have a session object
        if ($this->_session) {

            if (!isset($data['_token']) || $data['_token'] !== $this->_session->getToken()) {

                $this->_errors[] = $messages['csrf'];
                return false;

            }

        }

        // Loop all the set rules and validate
        foreach ($this->_rules as $key => $rules)
        {
            // If the rules are a string, break it apart
            if (is_string($rules))
                $rules = explode('|', $rules);

            // Get the data for the rule
            $input = isset($data[$key]) ? $data[$key] : null;

            // Get the type of the input
            $inputType = $this->getInputType($input);

            // Create a key for messages
            $m_key = str_replace(array('_', '-'), ' ', $key);

            // Loop through each rule and validate
            foreach($rules as $rule) {

                // Turn the rule into an array and explode if it has parameters
                $rule = strpos($rule, ':') !== false ? explode(':', $rule) : array($rule);

                // If the rule is "required", it's a built in rule
                if ($rule[0] == 'required') {

                    if (!$input || empty($input)) {

                        if (isset($messages['required.'.$key])) {
                            $message = $messages['required.'.$key];
                        } else {
                            $message = str_replace(':key', $m_key, $messages['required']);
                        }

                        $this->_errors[] = $message;

                        break;

                    }

                    continue;

                }

                // If it's not a required field we have been given null, skip it
                if (!$input || empty($input))
                    break;

                // Throw an error if we don't have a handler for the rule
                if (!isset(static::$_handlers[$rule[0]]))
                    continue;
                //throw new \Exception('m\Validator: "'.$rule[0].'" is not a valid rule.  No matching handler exists.');

                // Handle lazy loaded handlers
                if (!is_object(static::$_handlers[$rule[0]])) {
                    $handlerName = static::$_handlers[$rule[0]];
                    $handler = new $handlerName();
                    static::$_handlers[$rule[0]] = $handler;
                } else {
                    $handler = static::$_handlers[$rule[0]];
                }

                // If there are parameters, turn them into an array
                $params = (isset($rule[1])) ? explode(',', $rule[1]) : array();

                // Add the input field to the front of the params array
                array_unshift($params, $input);

                // Call the handler and pass it the parameters
                $result = call_user_func_array(array($handler, 'check'.ucfirst($inputType)), $params);

                // If the check failed, log an error and stop validating this field
                if ($result === false) {

                    // Shorthand message keys
                    $ruleFieldName      = $rule[0].'.'.$key;
                    $ruleTypeName       = $rule[0].'.'.$inputType;

                    // Determine which message is available to send
                    if (isset($messages[$ruleFieldName])) {
                        $message = $messages[$ruleFieldName];
                    } elseif (isset($messages[$ruleTypeName])) {
                        $message = $messages[$ruleTypeName];
                    } elseif (isset($messages[$rule[0]])) {
                        $message = $messages[$rule[0]];
                    } else {
                        $message = 'The :key field failed to validate.';
                    }

                    array_shift($params);

                    // Format and log the message
                    $this->_errors[] = $handler->formatMessage($message, $m_key, $params);

                    // Onto the next field
                    break;
                }
            }
        }

        // If we have errors, we failed...
        return count($this->_errors) > 0 ? false : true;
    }
71123
private function getMessageAckIds(array $messages)
    {
        $ackIds = [];
        foreach ($messages as $message) {
            $ackIds[] = $message->ackId();
        }

        return $ackIds;
    }
96031
public function fetch(Input $input)
    {
        return $this->bus->handle(
            $this->messageCreator->create($this->query, $input)
        );
    }
255997
protected function validateInput($input, Configuration $config, array $messages = []): self
    {
        try {
            $config->getValidationRules()->assert($input);
        } catch (NestedValidationException $e) {
            $this->handleValidationException($e, $config, $messages);
        }

        return $this->setValue($config->getKey(), $input, $config->getGroup());
    }
1175010
public function rules($rules = null, $messages = [])
    {
        if ($rules instanceof \Closure) {
            $this->rules = $rules;
        }

        if (is_string($rules)) {
            $rules = array_filter(explode('|', "{$this->rules}|$rules"));

            $this->rules = implode('|', $rules);
        }

        $this->validationMessages = $messages;

        return $this;
    }