{@inheritdoc}

@param array $input
@param array $metadata (optional)
@return array
511161
public function castInput(array $input, array $metadata=[])
    {

        $filtered = [];

        foreach ($input as $key=>$value) {

            // tokens, _method...
            if (starts_with($key,'_')) {
                continue;
            }

            // actions
            if (str_contains($key, '-')) {
                continue;
            }

            if ($this->removeConfirmations && ends_with($key, '_confirmation')) {
                continue;
            }

            $filtered[$key] = $value;
        }

        return NestedArray::toNested($filtered, '__');

    }
1260270
public function create(array $input)
	{
    unset($input['_token']);

    $loggedUserId = $this->AuthenticationManager->getLoggedUserId();
    $organizationId = $this->AuthenticationManager->getCurrentUserOrganizationId();

    $input = eloquent_array_filter_for_insert($input);
		$input = array_add($input, 'organization_id', $organizationId);
    // $input['date'] = $this->Carbon->createFromFormat($this->Lang->get('form.phpShortDateFormat'), $input['date'])->format('Y-m-d');

    $this->DB->transaction(function() use ($input, $loggedUserId, $organizationId)
		{
      $VoucherType = $this->VoucherType->create($input);

      $Journal = $this->Journal->create(array('journalized_id' => $VoucherType->id, 'journalized_type' => $this->VoucherType->getTable(), 'user_id' => $loggedUserId, 'organization_id' => $organizationId));
      $this->Journal->attachDetail($Journal->id, array('note' => $this->Lang->get('decima-accounting::voucher-type-management.addedJournal', array('VoucherType' => $VoucherType->name)), $Journal));
    });

    return json_encode(array('success' => $this->Lang->get('form.defaultSuccessSaveMessage'), 'voucherTypes' => $this->getVoucherTypes()));
  }
836628
public function create(array $input)
    {
        $this->cache->tags($this->getModel())->flush();
        return $this->repository->create($input);
    }
524415
public function cast(array $input, array $metadata = [], $resourceName = null)
    {
        $corrected = $input;

        foreach ($this->buildChain() as $casterName => $parameters) {
            $caster = $this->getExtension($casterName);
            $result = $caster($corrected, $metadata, $resourceName);
            $corrected = &$result;
        }

        return $corrected;
    }
1324682
private function extractIdAndType(EntityMetadata $metadata, array &$data)
    {
        $identifier = $this->extractField(Persister::IDENTIFIER_KEY, $data);
        unset($data[Persister::IDENTIFIER_KEY]);

        $key = Persister::POLYMORPHIC_KEY;
        $type = $this->extractType($metadata, $data);
        if (isset($data[$key])) {
            unset($data[$key]);
        }
        return [$identifier, $type];
    }
1339338
protected function getCommandOptions($input)
    {
        return [
            'model-name' => $this->argument('model-name'),
            '--resource-filename' => $this->option('resource-filename'),
            '--fields' => $this->option('fields'),
            '--translation-for' => $this->option('translation-for'),
            '--relations' => $this->option('relations'),
            '--indexes' => $this->option('indexes'),
        ];
    }
68586
public function keyToValue(array $input)
    {
        $output = array();

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

        return $output;
    }
133581
protected static function populateInputs(
        ElementInterface $input, array $data
    ) {
        if ($input instanceof InputInterface) {
            self::addLabel($input, $data);
            self::addValidators($input, $data);
            self::setFilters($input, $data);
            self::addOptions($input, $data);
            if (isset($data['required'])) {
                $input->setRequired(
                    StaticFilter::filter(Boolean::class, $data['required'])
                );
            }
        }

        self::populateElement($input, $data);
    }
911955
private function combine(array $input)
    {
        $inputLength = count($input);
        if (0 === $inputLength) {
            return false;
        }

        foreach ($this->namePrepData->replaceMaps as $namePrepSource => $namePrepTarget) {
            if ($namePrepTarget[0] !== $input[0]) {
                continue;
            }
            if (count($namePrepTarget) !== $inputLength) {
                continue;
            }
            $hit = false;
            foreach ($input as $k2 => $v2) {
                if ($v2 === $namePrepTarget[$k2]) {
                    $hit = true;
                } else {
                    $hit = false;
                    break;
                }
            }
            if ($hit) {
                return $namePrepSource;
            }
        }

        return false;
    }
65927
protected function parseFilterInput(array $input)
    {
        if (count($input) === 0) {
            return [];
        }

        $allowed = [];
        $model = $this->model;

        if (property_exists($model, 'filterableProperties')) {
            $allowed = $model::$filterableProperties;
        }

        $filter = [];
        foreach ($input as $key => $value) {
            if (is_numeric($key) || !preg_match('/^[A-Za-z0-9_]*$/', $key)) {
                throw new InvalidRequest("Invalid filter parameter: $key");
            }

            // check if in the list of allowed filter properties
            if (!in_array($key, $allowed)) {
                throw new InvalidRequest("Invalid filter parameter: $key");
            }

            $filter[$key] = $value;
        }

        return $filter;
    }
690729
public function transformInput(FieldMetadata $metadata, $value) {
        $isInt = true;
        foreach(array_keys($metadata->options) as $key => $notUsed) {
            if(!is_integer($key)) {
                $isInt = false;
            }
        }

        if($isInt) {
            return (int)$value;
        } else {
            return $value;
        }
    }
302773
public function create($input)
	{
		$mapper = $this->getMapper();
		$admin  = $mapper->getAdmin();

		$model      = $this->getModel();
		$primaryKey = (new $model)->getKeyName();

		$this->setInput($input);

		// Field pre update
		foreach ($mapper->getFields() as $field) {
			$field->preUpdate();
			$input = $this->getInput();

			// Is this a multiple field?
			if ($field->isMultiple()) {
				$value = Value::encode(Config::get('bauhaus::admin.multiple-serializer'), $input[$field->getName()]);
				$this->setInputVariable($field->getName(), $value);
			}

			if ($field->hasSaving()) {
				$saving = $field->getSaving();
				$this->setInputVariable($field->getName(), $saving($input[$field->getName()]));
			}
		}

		// Model before create hook
		if (method_exists($admin, 'beforeCreate')) {
			$admin->beforeCreate($input);
		}

		// Validate
		if (property_exists($model, 'rules')) {
			$validator = Validator::make($this->getInput(), $model::$rules);
			if ($validator->fails()) {
				return $validator;
			}
		}

		// Model create hook
		if (method_exists($admin, 'create')) {
			$model = $admin->create($this->getInput());
		} else {
			$model = $model::create($this->getInput());
		}

		// Set the primary id from the `new` model
		$this->setIdentifier($model->{$primaryKey});

		// Field post update
		foreach ($mapper->getFields() as $field) {
			$field->postUpdate($this->getInput());
		}

		// Model after create hook
		if (method_exists($admin, 'afterCreate')) {
			$result = $admin->afterCreate($this->getInput());

			if ($result instanceof \Illuminate\Http\RedirectResponse) {
				$result->send();
			}
		}

		return $this;
	}
1083683
protected function loadMetadata($metadataIdent)
    {
        $metadataLoader = $this->metadataLoader();
        $metadata       = $metadataLoader->load($metadataIdent, $this->createMetadata());

        return $metadata;
    }
1119711
public static function fromArray($input = null)
    {
        //====================================================================//
        // Safety Check
        if (is_null($input) || !self::isValid($input)) {
            return null;
        }
        //====================================================================//
        // return Encoded CheckSum
        return self::getEncoded($input);
    }
1355870
public function getMetadataQuery($data, $metadata)
    {
        foreach ($metadata as $searchMetadata) {
            $data[] = $this->setData(['metadata' => $searchMetadata], 'input');
        }

        return $data;
    }
1110234
public function markDeleted(array $input) : array {
		$input[\Object\Form\Parent2::BUTTON_SUBMIT_SAVE] = true;
		$input[\Object\Form\Parent2::BUTTON_SUBMIT_MARK_DELETED] = true;
		$this->form->form_object->addInput($input);
		$this->form->form_object->process();
		return $this->form->form_object->apiResult();
	}
63751
protected function prepareInputFilesForParsing(array $input = [])
    {
        $parse = [];
        foreach ($input as $in) {
            $less = realpath(WWW_ROOT . $in);
            // If we have plugin notation (Plugin.less/file.less)
            // ensure to properly load the files
            list($plugin, $basefile) = $this->_View->pluginSplit($in, false);
            if (!empty($plugin)) {
                $less = realpath(Plugin::path($plugin) . 'webroot' . DS . $basefile);

                if ($less !== false) {
                    $parse[$less] = $this->assetBaseUrl($plugin, $basefile);
                    continue;
                }
            }
            if ($less !== false) {
                $parse[$less] = '';
                continue;
            }
            // Plugins without plugin notation (/plugin/less/file.less)
            list($plugin, $basefile) = $this->assetSplit($in);
            if ($file = $this->pluginAssetFile([$plugin, $basefile])) {
                $parse[$file] = $this->assetBaseUrl($plugin, $basefile);
                continue;
            }

            // Will probably throw a not found error
            $parse[$in] = '';
        }

        return $parse;
    }