{@inheritdoc}

@param array  $input
@param array  $metadata     (optional)
@param string $resourceName (optional)

@return array The corrected data
490200
public function correct(array $input, array $metadata = [], $resourceName = null)
    {
        $corrected = $input;

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

        return $corrected;
    }
1058542
protected function parseTable($input)
    {
        $input = (array) $input;

        return array_map(function ($key, $value) {
            $bytes = ['used_memory', 'free_memory', 'wasted_memory', 'buffer_size'];
            $times = ['start_time', 'last_restart_time'];

            if (in_array($key, $bytes)) {
                $value = number_format($value / 1048576, 2).' MB';
            } elseif (in_array($key, $times)) {
                $value = date('Y-m-d H:i:s', $value);
            }

            return [
                'key'       => $key,
                'value'     => $value,
            ];
        }, array_keys($input), $input);
    }
1022510
private function extractIds($input)
    {
        if ($input instanceof Collection) {
            return $input->modelKeys();
        }

        if ($input instanceof Media) {
            return [$input->getKey()];
        }

        return (array) $input;
    }
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;
    }
1191199
private function getPropertyMetadata(ResourceMetadata $resourceMetadata, string $resourceClass, string $io, array $visited, array $options): array
    {
        $data = [];

        foreach ($this->propertyNameCollectionFactory->create($resourceClass, $options) as $propertyName) {
            $propertyMetadata = $this->propertyMetadataFactory->create($resourceClass, $propertyName);
            if (
                ($propertyMetadata->isReadable() && self::OUT_PREFIX === $io) ||
                ($propertyMetadata->isWritable() && self::IN_PREFIX === $io)
            ) {
                $normalizedPropertyName = $this->nameConverter ? $this->nameConverter->normalize($propertyName, $resourceClass) : $propertyName;
                $data[$normalizedPropertyName] = $this->parseProperty($resourceMetadata, $propertyMetadata, $io, null, $visited);
            }
        }

        return $data;
    }
1191238
public function apiStore($input)
    {
        $savedFile = app(FileService::class)->saveClone($input['location'], 'public/images');

        if (!$savedFile) {
            return false;
        }

        $input['is_published'] = 1;
        $input['location'] = $savedFile['name'];
        $input['storage_location'] = config('cms.storage-location');
        $input['original_name'] = $savedFile['original'];

        $image = $this->model->create($input);
        $image->setCaches();

        return $image;
    }
1266894
function resourceData( $resourceObject, $uri, $resourceName, $templateName )
    {
        $resourceData = array();
        $resourceData['uri'] = $uri;
        $resourceData['resource'] = $resourceName;
        $resourceData['template-name'] = $templateName;
        $resourceData['template-filename'] = $templateName;
        $resourceData['handler'] = $resourceObject;
        $resourceData['test-compile'] = $this->TestCompile;
        return $resourceData;
    }
141430
public function input($filename, $input)
    {
        if (substr($filename, strlen($this->_settings['ext']) * -1) !== $this->_settings['ext']) {
            return $input;
        }
        $cmd = $this->_settings['node'] . ' ' . $this->_settings['coffee'] . ' -c -p -s ';
        $env = array('NODE_PATH' => $this->_settings['node_path']);
        return $this->_runCmd($cmd, $input, $env);
    }
1331041
protected function createResourceFile($input)
    {

        $this->call(
            'resource-file:from-database',
            [
                'model-name' => $input->modelName,
                '--table-name' => $input->table,
                '--resource-filename' => $input->resourceFile,
                '--translation-for' => $input->translationFor,
                '--force' => $input->force,
            ]
        );

        return $this;
    }
883727
public function input($filename, $input)
    {
        if (substr($filename, strlen($this->_settings['ext']) * -1) !== $this->_settings['ext']) {
            return $input;
        }

        $tmpfile = tempnam(TMP, 'asset_compress_less');
        $this->_generateScript($tmpfile, $input);

        $bin = $this->_settings['node'] . ' ' . $tmpfile;
        $env = array('NODE_PATH' => $this->_settings['node_path']);
        $return = $this->_runCmd($bin, '', $env);
        unlink($tmpfile);
        return $return;
    }
847179
public function item($resourceKey, array $data)
    {
        if (is_null($resourceKey)) $resourceKey = static::RESOURCE_KEY;
        return $resourceKey ? [$resourceKey => $data]: $data;
    }
115046
protected function getDataMethod(array $fields, $requestFullname, $input)
    {
        if ($input->withFormRequest) {
            return '';
        }

        $stub = $this->getDataMethodStubContent();

        $this->replaceFileSnippet($stub, $this->getFileSnippet($fields, $this->requestVariable))
            ->replaceValidationRules($stub, $this->getValidationRules($fields))
            ->replaceFillables($stub, $this->getFillables($fields))
            ->replaceFileValidationSnippet($stub, $this->getFileValidationSnippet($fields, $input, $this->requestVariable))
            ->replaceBooleadSnippet($stub, $this->getBooleanSnippet($fields, $this->requestVariable))
            ->replaceStringToNullSnippet($stub, $this->getStringToNullSnippet($fields))
            ->replaceRequestNameComment($stub, $this->getRequestNameComment($requestFullname))
            ->replaceMethodVisibilityLevel($stub, 'protected');

        $stub = str_replace(PHP_EOL . PHP_EOL, PHP_EOL, $stub);

        return $stub;
    }
1127834
protected function parseInput($input, array $options = array())
    {
        if ($this->dynamicSettingParser->isDynamicSetting($input)) {
            $parsedSettings = $this->dynamicSettingParser->parseDynamicSetting($input);
            $input = $this->configResolver->getParameter(
                $parsedSettings['param'],
                $parsedSettings['namespace'],
                $parsedSettings['scope']
            );

            if (is_array($input)) {
                $collection = $this->createAssetCollection(array(), $options);
                foreach ($input as $file) {
                    $collection->add(parent::parseInput($file, $options));
                }

                return $collection;
            }
        }

        return parent::parseInput($input, $options);
    }
405878
protected function clean_input( array $input ) {
		foreach ( $input as $key => $value ) {
			if ( is_array( $value ) ) {
				$input[ $key ] = $this->clean_input( $value );
			}

			if ( $value instanceof UploadedFile ) {
				unset( $input[ $key ] );
			}
		}

		return $input;
	}
266205
protected function getUploads($input = '') {

		$global = $this->getGlobals();
		$uploads = array();
		$input = (string) $input;

		if (empty($global) || !isset($global[$input])) {
			// input name was not present in the form
			return $uploads;
		}

		$keys = array_keys($global[$input]);
		$primary_key = $keys[0];

		if (is_array($global[$input][$primary_key])) {
			// multiple file input
			// in case inputs are named (e.g. name="upload[file1]")
			$input_keys = array_keys($global[$input][$primary_key]);

			foreach ($input_keys as $i) {
				$upload = array();
				foreach ($keys as $key) {
					$upload[$key] = $global[$input][$key][$i];
				}
				$uploads[] = $upload;
			}
		} else {
			// regular file input
			$uploads[] = $global[$input];
		}

		return $uploads;
	}
583777
public function transformInput(FieldMetadata $metadata, $value) {

        $repo = $metadata->options['repository'];
        $repo = is_callable($repo) ? $repo() : $repo;

        return $repo->getReference((int)$value);
    }
100292
protected function parse($input): string
    {
        if (!is_array($input)) {
            return json_encode($input);
        }

        $parsed = "";
        foreach ($input as $key => $value) {
            $key = (!is_numeric($key) ? ($key . ": " ) : '');
            if (!is_array($value)) {
                $parsed .= $key . $this->parse($value) . ', ';
            } elseif (is_null(key($value)) || is_numeric(key($value))) {
                $parsed .= $key . "[" . $this->parse($value) . "], ";
            } else {
                $parsed .= $key . "{" . $this->parse($value) . "}, ";
            }
        }

        return rtrim($parsed, ', ');
    }