Converts the input to the specified options.

Options is
```
array(
key => null|newKey|array('key' => newKey, 'type' => string, 'parse' => callable)
)
```
@param array  $input
@param array  $options
@return array
431171
static function applyOptions(array $input, array $options) {
        $data = array();
        
        foreach($input as $key => $val) {
            if(!isset($options[$key])) {
                continue;
            }
            
            if(\is_array($options[$key])) {
                if(!empty($options[$key]['parse'])) {
                    $call = $options[$key]['parse'];
                    $val = $call($val);
                }
                
                if(!empty($options[$key]['type'])) {
                    $val = self::typecastVariable($val, $options[$key]['type']);
                }
                
                $key = $options[$key]['key'] ?? $key;
            } elseif(!empty($options[$key])) {
                $key = $options[$key];
            }
            
            $data[$key] = $val;
        }
        
        return $data;
    }
98956
public function parse($input = null, $options = 0)
    {
        if (!is_null($input)) {
            $this->setInput($input);
        }

        if (0 !== $options) {
            $this->options = $options;
        }

        if (is_null($this->input)) {
            throw new EofException('End of input stream, or no input supplied');
        }

        switch ($this->input['name']) {
            case '{'.self::XCAL_NAMESPACE.'}icalendar':
                $this->root = new VCalendar([], false);
                $this->pointer = &$this->input['value'][0];
                $this->parseVCalendarComponents($this->root);
                break;

            case '{'.self::XCARD_NAMESPACE.'}vcards':
                foreach ($this->input['value'] as &$vCard) {
                    $this->root = new VCard(['version' => '4.0'], false);
                    $this->pointer = &$vCard;
                    $this->parseVCardComponents($this->root);

                    // We just parse the first <vcard /> element.
                    break;
                }
                break;

            default:
                throw new ParseException('Unsupported XML standard');
        }

        return $this->root;
    }
604528
protected function _setOptions(&$input, $param)
    {
        if ($param->hasOptions() && !isset($input['empty'])) {
            $input['empty'] = true;
        }

        return $input;
    }
6639
private static function replaceKeys(array &$replacements, array $input)
    {
        $return = [];
        foreach ($input as $key => $value) {
            $key = \str_replace(\array_keys($replacements), \array_values($replacements), $key);

            if (\is_array($value)) {
                $value = self::replaceKeys($replacements, $value);
            }

            $return[$key] = $value;
        }

        return $return;
    }
332317
public function getOutput($input, array $options = array())
    {
        $this->log(sprintf('Getting output from file (%s)', $input));

        return $this->getGenerator()->getOutput($input, $options);
    }
1342462
public function parse($input)
    {
        $sorting = new Sort();

        foreach (explode('|', $input) as $property) {
            if ($property[0] === '-') {
                $sorting->add(new Sort\Desc(substr($property, 1)));
                continue;
            }
            $sorting->add(new Sort\Asc($property));
        }

        return $sorting;
    }
1065363
private function parseFields($input)
    {
        if (is_array($input)) {
            return $input;
        }

        $fields = [];
        foreach (explode(' ', $input) as $value) {
            $elements = explode(':', $value);
            $name = $elements[0];
            if (strlen($name)) {
                $type = isset($elements[1]) ? $elements[1] : 'string';
                preg_match_all('/(.*)\((.*)\)/', $type, $matches);
                $type = isset($matches[1][0]) ? $matches[1][0] : $type;
                $length = isset($matches[2][0]) ? $matches[2][0] : null;

                $fields[$name] = ['fieldName' => $name, 'type' => $type, 'length' => $length];
            }
        }

        return $fields;
    }
535183
public function get(array $input) : array {
		$this->form->form_object->addInput($input);
		$this->form->form_object->process();
		return $this->form->form_object->apiResult();
	}
1125145
public static function parseLines($input): array
    {
        if (is_array($input)) {
            $input = implode(PHP_EOL, $input);
        }

        return Str::parseLines($input);
    }
292587
public function load($input)
    {
        foreach ($this->strategies as $strategy) {
            if ($strategy->supports($input)) {
                return array_map([$this, 'createJsonDefinition'], $strategy->load($input));
            }
        }

        return [];
    }
71500
public function save(array $input) : array {
		$input[\Object\Form\Parent2::BUTTON_SUBMIT_SAVE] = true;
		// we must set entry method
		if (isset($this->form->form_object->collection_object->primary_model->column_prefix)) {
			$input[$this->form->form_object->collection_object->primary_model->column_prefix . 'entry_method'] = 'G';
		}
		$this->form->form_object->addInput($input);
		$this->form->form_object->process();
		return $this->form->form_object->apiResult();
	}
879099
protected function convertArgumentsAndOptionsArrayToRows(array $input): array
	{
		$rows = [];

		foreach($input as $name => $info)
		{
			$rows[] = [$name, $info['description'], var_export($info['optional'], true)];
		}

		return $rows;
	}
126065
private function validateOnlyOne(InputInterface $input, array $options)
    {
        $count = 0;
        foreach ($options as $opt) {
            if ($input->getOption($opt)) {
                $count++;
            }
        }

        if ($count > 1) {
            throw new \InvalidArgumentException('Please specify only one of --' . \implode(', --', $options));
        }
    }
544007
protected function fillArrayInput(array $input, $default = 0)
    {
        if (empty($input)) {
            return [];
        }

        $res = array_fill($default, max(array_keys($input)), null);

        foreach ($input as $index => $value) {
            $res[$index] = $value;
        }

        return $res;
    }
103626
protected function normalize(array $input) : array
    {
        $normalized = [];
        foreach ($this->rules() as $field => $value) {
            $normalized[$field] = $input[$field] ?? '';
        }
        return $normalized;
    }
861109
private function convert($input)
    {
        if (is_array($data = json_decode($input, true))) {
            if (array_key_exists('signatures', $data) || array_key_exists('recipients', $data)) {
                $this->log(LogLevel::DEBUG, 'The input seems to be a JWS or a JWE.');

                return $data;
            } elseif (array_key_exists('signature', $data)) {
                $this->log(LogLevel::DEBUG, 'The input seems to be a flattened JWS.');

                return $this->fromFlattenedSerializationSignatureToSerialization($data);
            } elseif (array_key_exists('ciphertext', $data)) {
                $this->log(LogLevel::DEBUG, 'The input seems to be a flattened JWE.');

                return $this->fromFlattenedSerializationRecipientToSerialization($data);
            }
        } elseif (is_string($input)) {
            $this->log(LogLevel::DEBUG, 'The input may be a compact JWS or JWE.');

            return $this->fromCompactSerializationToSerialization($input);
        }
        $this->log(LogLevel::ERROR, 'The input is not supported');
        throw new \InvalidArgumentException('Unsupported input');
    }
895281
public function convertFromPositive($input)
    {
        $matches = [];

        if (
            !preg_match(
                '
                /^0*(?<carets>\\^*)(?<alpha>[A-Z]*)(?<year>\d+)$/',
                $input,
                $matches
            )
        ) {
            return null;
        }

        if ($matches['alpha'] === '') {
            return $matches['year'];
        }

        if ($matches['carets'] === '') {
            $expectedLength = ord($matches['alpha']) - static::ORD_START + 5;
        } else {
            $len = strlen($matches['carets']);

            $expectedLength = 0;

            for ($i=0; $i < $len; $i++) {
                $expectedLength = $expectedLength * 26;
                $expectedLength += ord($matches['alpha'][$i]) - static::ORD_START;
                $expectedLength++;
            }

            $expectedLength += 30;
        }

        return str_pad($matches['year'], $expectedLength, '0', STR_PAD_RIGHT);
    }