Agrega mensaje a cada peticion si se produce un error
@param array $data
@return void
178249
public function setInfo($data=array()) {
        if(isset($data['data'])) $this->info['data'] = $data['data'];
        if(isset($data['status'])) $this->info['status'] = $data['status'];
        if(isset($data['msg'])) $this->info['msg'] = $data['msg'];

    }
144094
private function processData(array $data): void
    {
        foreach ($data['formatters'] as $locale => $f) {
            if (!isset($this->formatters[$locale])) {
                $this->formatters[$locale] = array();
            }
            
            foreach ($f as $formatter => $d) {
                $calendar = \IntlDateFormatter::GREGORIAN;
                if (isset($d['calendar']) && $d['calendar'] === 'traditional') {
                    $calendar = \IntlDateFormatter::TRADITIONAL;
                }
                
                $this->formatters[$locale][$formatter] = new \IntlDateFormatter($locale, null, null, null, $calendar, $d['pattern']);
            }
        }
    }
1347430
protected static function throwEncodingException($data)
    {
        $encodingException = new EncodingException(
            sprintf('JSON encoding failed: %s', json_last_error_msg()),
            json_last_error()
        );

        $encodingException->setEncodingData($data);
        throw $encodingException;
    }
422017
final public function update(array $data)
    {
        $this->query->setStartUpdate($data);

        $this->query->prepare()->bindSetForUpdate($data)->bindWhere()->bindLimit()->execute();

        $this->setRowCount();

        $this->query->close();
    }
1279258
public function handleArray(array $data = []): void
    {
        $this->getForm()->submit($data);
        $this->handleForm($data['page'] ?? null);
    }
233030
public function set(array $data)
    {
        $this->data = [];
        $this->replace = false;

        foreach ($data as $key => $value) {
            $this->add($key, $value);
        }
    }
838722
protected function error($msg = '', $url = '', $data = '', $wait = 3, $header = [])
    {
        $this->jump(CodeConstant::CODE_ERROR, $msg, $url, $data, $wait, $header);
    }
1229933
public function getCreateErrors(array $data, array &$errors = [], $fieldset = null)
    {
        $schema = $this->schema;

        if ($fieldset) {
            $schema = $fieldset;
        }

        $fields = $schema->getFields();
        $table = $schema->getName();
        foreach ($fields as $field) {
            $name = $table . '_' . $field['name'];

            if ($field['field']['type'] === 'fieldset' && isset($data[$name])) {
                if (!isset($errors[$name])) {
                    $errors[$name] = [];
                }

                if (isset($field['field']['attributes']['data-multiple'])
                    && !$field['field']['attributes']['data-multiple']
                ) {
                    $errors[$name] = $this->getCreateErrors(
                        $data[$name],
                        $errors[$name],
                        Fieldset::i($field['field']['parameters'])
                    );

                    if (empty($errors[$name])) {
                        unset($errors[$name]);
                    }

                    continue;
                }

                foreach($data[$name] as $index => $row) {
                    if (!isset($errors[$name][$index])) {
                        $errors[$name][$index] = [];
                    }

                    $errors[$name][$index] = $this->getCreateErrors(
                        $row,
                        $errors[$name][$index],
                        Fieldset::i($field['field']['parameters'])
                    );

                    if (empty($errors[$name][$index])) {
                        unset($errors[$name][$index]);
                    }
                }

                if (empty($errors[$name])) {
                    unset($errors[$name]);
                }

                continue;
            }

            if (isset($field['validation'])) {
                foreach ($field['validation'] as $validation) {
                    if ($validation['method'] === 'required'
                        && (
                            !isset($data[$name])
                            || (
                                is_array($data[$name])
                                && empty($data[$name])
                            )
                            || (
                                !is_array($data[$name])
                                && !strlen('' . $data[$name])
                            )
                        )
                    ) {
                        $errors[$name] = $validation['message'];
                    }
                }
            }
        }

        // is this checker not fieldset specific?
        // if yes let's check relations
        if (!$fieldset) {
            $relations = $this->schema->getRelations();
            foreach ($relations as $relation) {
                if ($relation['many'] != 1) {
                    continue;
                }

                if (!isset($data[$relation['primary2']]) || !is_numeric($data[$relation['primary2']])) {
                    $errors[$relation['primary2']] = sprintf('%s should be valid', $relation['singular']);
                }
            }
        }

        return $this->getOptionalErrors($data, $errors, $fieldset);
    }
1230901
public function set(array $data) {
		foreach ($data as $name => $value) {
			$this->__set($name, $value);
		}
	}
291020
protected function setRequiredFieldErrors($fields = null, $data = null)
    {
        if ($fields === null) {
            $fields =& $this->fields;
        }

        if ($data === null) {
            $data =& $this->data;
        }

        foreach ($fields as $field) {
            if (isset($field['options']['required']) && $field['options']['required'] === true) {
                if (!isset($data[ $field['name'] ]) || $data[ $field['name'] ] == null) {
                    if (isset($field['options']['label'])) {
                        $label = $field['options']['label'];
                    }
                    else {
                        $label = $field['name'];
                    }
                    $this->errors[] = new FormError($field['name'], "Field '{field_label}' must be set", true, array('field_label' => $label));
                }
            }

            if (isset($field['fields'])) {
                $this->setRequiredFieldErrors($field['fields'], $data[ $field['name'] ]);
            }
        }
    }
934210
public function validate( $data, array $rules = [] )
	{
		$this->normalizeData( $data );
		$this->setRules( $rules );

		foreach( $this->rules as $attribute => $rules ) {
			foreach( $rules as $rule ) {
				$this->validateAttribute( $rule, $attribute );

				if( $this->shouldStopValidating( $attribute ))break;
			}
		}

		return $this->errors;
	}
848919
public function invoke(array $data)
	{
		$columns = $this->getColumns() ?: $this->grid->getColumns();

		$csv_data_model = new CsvDataModel($data, $columns, $this->grid->getTranslator());

		if ($this->grid->getPresenter() instanceof Nette\Application\UI\Presenter) {
			$this->grid->getPresenter()->sendResponse(new CSVResponse(
				$csv_data_model->getSimpleData(),
				$this->name,
				$this->output_encoding,
				$this->delimiter,
				$this->include_bom
			));

			exit(0);
		}
	}
1292990
private static function validateUnserializedData(array $data): void
    {
        /** Let's check if there are mandatory fields */
        if (
            false === isset($data['namespace']) ||
            false === isset($data['message'])
        ) {
            throw new \UnexpectedValueException(
                'The serialized data must contains a "namespace" field (indicates the message class) and "message" (indicates the message parameters)'
            );
        }

        /** Let's check if the specified class exists */
        if ('' === $data['namespace'] || false === \class_exists((string) $data['namespace']))
        {
            throw new \UnexpectedValueException(
                \sprintf('Class "%s" not found', $data['namespace'])
            );
        }
    }
569202
protected function displayErrorData($data)
    {
        $this->raiseDebuggerTakeover();

        $debug = new ErrorDebugger();
        $debug->setErrorData($data);
        echo $debug->compile();
    }
242120
private function fixDataType(array &$data): void
    {
        if ('default' === $data['type']) {
            return;
        }

        $valid_var_name = [
            'image' => 'images',
            'video' => 'video',
        ];

        if (!isset($valid_var_name[$data['type']], $data[$valid_var_name[$data['type']]]) || !\is_array($data[$valid_var_name[$data['type']]])) {
            $data['type'] = 'default';
        }
    }
529576
public function fillFromArray(array $data)
	{
		$data = $data + array(
				'style' 		=> null,
				'align' 		=> null,
				'alternate_text' 	=> null,
				'title' 		=> null,
				'description' 	=> null,

				'size_width' 	=> null,
				'size_name' 	=> null,
				'crop_top' 		=> null,
				'crop_left' 	=> null,
				'crop_width' 	=> null,
				'crop_height' 	=> null,

				'size_height' 	=> null,
			);

		$this->imageId = $data['id'];
		$this->align = $data['align'];
		$this->style = $data['style'];
		$this->alternateText = $data['alternate_text'];
		$this->title = $data['title'];
		$this->description = $data['description'];

		$this->sizeName = $data['size_name'];

		$this->setWidth($data['size_width']);
		$this->setHeight($data['size_height']);
		$this->setCropTop($data['crop_top']);
		$this->setCropLeft($data['crop_left']);
		$this->setCropWidth($data['crop_width']);
		$this->setCropHeight($data['crop_height']);
	}
563326
protected function validate(array &$data)
    {
        $messages = [];
        if (isset($data['inserts']) && !empty($data['inserts'])) {
            array_push($messages, ['warning', sprintf('Found %s new files. New, not original files may increase the risk of instability.', count($data['inserts']))]);
        }
        if (isset($data['deletes']) && !empty($data['deletes'])) {
            array_push($messages, ['warning', sprintf('%s files has been deleted. Deleting system files may increase the risk of instability.', count($data['deletes']))]);
        }
        if (isset($data['updates']) && !empty($data['updates'])) {
            array_push($messages, ['warning', sprintf('%s files has been changed. File modifications are unacceptable and can increase the risk of instability.', count($data['updates']))]);
        }
        $data = array_merge($data, ['messages' => $messages]);
        return $data;
    }