Add Input Method

@param $input_data

@return array

@throws \Exception
190063
public function add($input_data)
    {
        $data['inputs'] = [];

        if (is_array($input_data)) {
            foreach ($input_data as $image) {
                $data['inputs'][] = $this->addNewImage($image);
            }
        } else {
            $data['inputs'][] = $this->addNewImage($input_data);
        }

        $inputResult = $this->getRequest()->request(
            'POST',
            $this->getRequestUrl('inputs'),
            $data
        );

        return $this->getInputsFromResult($inputResult);
    }
332599
function addData($data, $col_id = 0, $row_id = 0) {
        foreach ($data as $row) {
            if ($row === self::CONSOLE_TABLE_HORIZONTAL_RULE) {
                $this->_data[$row_id] = self::CONSOLE_TABLE_HORIZONTAL_RULE;
                $row_id++;
                continue;
            }
            $starting_col = $col_id;
            foreach ($row as $cell) {
                $this->_data[$row_id][$starting_col++] = $cell;
            }
            $this->_updateRowsCols();
            $this->_max_cols = max($this->_max_cols, $starting_col);
            $row_id++;
        }
    }
552806
public static function &createArray($input_xml) {
        $xml = self::getXMLRoot();
        if(is_string($input_xml)) {
            $parsed = $xml->loadXML($input_xml);
            if(!$parsed) {
                throw new \Exception('[XML2Array] Error parsing the XML string.');
            }
        } else {
            if(get_class($input_xml) != 'DOMDocument') {
                throw new \Exception('[XML2Array] The input XML object should be of type: DOMDocument.');
            }
            $xml = self::$xml = $input_xml;
        }
        $array[$xml->documentElement->tagName] = self::convert($xml->documentElement);
        self::$xml = null;    // clear the xml node in the class for 2nd time use.
        return $array;
    }
94469
protected static function addOptions(InputInterface $input, $data)
    {
        if (
            ! $input instanceof ChoiceAwareElementInterface ||
            ! isset($data['options'])
        ) {
            return;
        }

        $input->setOptions($data['options']);
    }
143690
function addCol($col_data, $col_id = 0, $row_id = 0) {
        foreach ($col_data as $col_cell) {
            $this->_data[$row_id++][$col_id] = $col_cell;
        }

        $this->_updateRowsCols();
        $this->_max_cols = max($this->_max_cols, $col_id + 1);
    }
210373
public function fill(array $form_data)
	{
		foreach ( $form_data as $field_name => $field_value ) {
			$form_element = $this->typify($this->getNodeElements($field_name));

			$this->setValue($form_element, $field_value);
		}

		return $this;
	}
445245
protected function build_input($data, array $fields = [] ){
        return parent::build_input($data, $fields).$this->length_helper($data);
    }
232020
public function getAllInput()
    {
        return array_merge(
            $this->input[self::INPUT_METHOD_QUERY],
            $this->input[self::INPUT_METHOD_POST]
        );
    }
496331
protected function onInput($data)
    {
        $ndata = array();
        foreach ($this->params as $colname) {
            if (isset($data[$colname])) {
                $ndata[$colname] = $data[$colname];
            }
        }

        $this->next($ndata);
    }
815662
protected function add_field(\stdClass $data) {
        foreach ($data->fields as $field) {
            $this->_form->addElement($field);
        }

        if (!empty($data->helps)) {
            foreach ($data->helps as $fieldname => $helpdata) {
                $help = array_merge([$fieldname], $helpdata);
                call_user_func_array([$this->_form, 'addHelpButton'], $help);
            }
        }

        if (!empty($data->types)) {
            foreach ($data->types as $fieldname => $type) {
                $this->_form->setType($fieldname, $type);
            }
        }

        if (!empty($data->rules)) {
            foreach ($data->rules as $fieldname => $ruledata) {
                $rule = array_merge([$fieldname], $ruledata);
                call_user_func_array([$this->_form, 'addRule'], $rule);
            }
        }

        if (!empty($data->defaults)) {
            foreach ($data->defaults as $fieldname => $default) {
                $this->_form($fieldname, $default);
            }
        }
    }
344349
public function input()
    {
        return array_replace_recursive($this->query->all(), $this->attributes->all(), $this->request->all());
    }
748041
public function execute($bound_input_params = Array())
    {
        $log = "Executing: " . $this->queryString;

        if (count($bound_input_params) > 0) {

            foreach ($bound_input_params as $key => $val) {
                $log .= "\nBinding Values: " . $key . ' = ' . $val;
            }
        }

        $this->connection->writeToLog($log);
        return parent::execute($bound_input_params);
    }
1278237
public function inputs()
    {
        $aReturn = [];
        foreach ($this->getFieldDefinitions() as $strFieldName => $aField) {
            $skeFormInput = new SkeFormInput(
                $strFieldName,
                $aField['type'] ?? 'text',
                $aField['options'] ?? [],
                $aField['attribs'] ?? []
            );
            // Set value for existing event
            if ($this->skeVent) {
                $skeFormInput->setValue($this->skeVent->getProperty($strFieldName));
                if ($this->skeVent->hasError($strFieldName))
                    $skeFormInput->setError($this->skeVent->getError($strFieldName));
            }
            $aReturn[] = $skeFormInput;
        }
        return $aReturn;
    }
182885
public function execute(array $input_parameters = array())
	{
		$queryString = $this->queryString;
		
		if(count($input_parameters) > 0)
		{
			if(count($this->parameters) > 0 || count($this->parametersBound) > 0)
			{
				throw new LikePDOException("There is have parameters bound");
				return false;
			}
			else
			{
				foreach($input_parameters as $key => $param)
				{
					$value = is_int($param) ? intval($param) : $this->pdo->quote($param, LikePDO::PARAM_STR);
					
					if(is_int($key))
					{
						$position = strpos($queryString, "?");
						
						if(!strstr($queryString, "?"))
						{
							throw new LikePDOException("Statement: Too few parameters");
							return false;
						}
						
						$queryString = substr_replace($queryString, $value, $position, 1);
					}
					else
					{
						$queryString = str_replace($key, $value, $queryString);
					}
				}
			}
		}
		
		if(count($this->parametersBound) > 0)
		{
			foreach($this->parametersBound as $key => $param)
			{
				$value = $this->pdo->quote($param['variable'], $param['data_type']);
				
				if(is_int($key))
				{
					$position = strpos($queryString, "?");
					
					if(!strstr($queryString, "?"))
					{
						throw new LikePDOException("Statement: Too few parameters");
						return false;
					}
					
					$queryString = substr_replace($queryString, $value, $position, 1);
				}
				else
				{
					$queryString = str_replace($key, $value, $queryString);
				}
			}
		}
		
		if(count($this->parameters) > 0)
		{
			foreach($this->parameters as $key => $param)
			{
				$value = $this->pdo->quote($param['value'], $param['data_type']);
				
				if(is_int($key))
				{
					$position = strpos($queryString, "?");
					
					if(!strstr($queryString, "?"))
					{
						throw new LikePDOException("Statement: Too few parameters");
						return false;
					}
					
					$queryString = substr_replace($queryString, $value, $position, 1);
				}
				else
				{
					$queryString = str_replace($key, $value, $queryString);
				}
			}
		}
		
		$this->resource = $this->pdo->driver->query($queryString);
		$this->executed = true;
		$this->rowsAffected = $this->pdo->driver->getRowsAffected();
		$this->columnCount = $this->pdo->driver->getNumFields($this->resource);
		
		if(!$this->resource)
		{
			$this->failed = true;
			
			$this->errorCode = $this->pdo->errorCode();
			$this->errorInfo = $this->pdo->errorInfo();
			
			new LikePDOException("Failed to execute the query ".$this->queryString);
			
			return false;
		}
		
		return true;
	}
293823
public function add($data = [])
	{
		if (isset($data['email']) && isset($data['username']) && isset($data['password'])) {
			// todo asserts
			$create = array(
				'email' => $data['email'],
				'username' => Strings::webalize($data['username']),
				'password' => Passwords::hash($data['password']),
			);

		} else {
			throw new \InvalidArgumentException('We need username, email and password');
		}

		if (isset($data['role'])) {
			$create['role'] = $data['role'];
		} else {
			$create['role'] = 'user';
		}

		if (isset($data['name'])) {
			$create['name'] = $data['name'];
		}

		/** @var \Nette\Http\FileUpload $data ->avatar */
		if ($this->useFiles && $data['avatar'] && $data['avatar']->isOk()) {
			$create['avatar'] = $this->saveImage($data['avatar']);
		}

		$person = $this->repository->insert($create);

		return $person;
	}
1007540
def add_inputs_from_inputstring(self, input_string):
        
        raw_params = input_string.split('\n')
        param_attributes = (self._parse_param_line(rp) for rp in raw_params if len(rp.strip(' \t')) > 0)
        for param, attributes in param_attributes:
            self.add_input(param, attributes)
170486
public function addHeaderArray($header_array) {
    if (!is_array($header_array)) {
      $error = sprintf("Input is not an array (Actual type: %s).",
                       gettype($header_array));
      throw new \InvalidArgumentException($error);
    }

    $error = "";
    foreach($header_array as $key => $value) {
      if (!$this->checkValidHeader($key, $value, $error)) {
        throw new \InvalidArgumentException($error);
      }
    }

    foreach($header_array as $key => $value) {
      $new_header = $this->message->addHeader();
      $new_header->setName($key);
      $new_header->setValue($value);
    }
  }