<commit_before><?php
namespace c;

use Illuminate\Support\Facades\Input;
use Illuminate\Support\Fluent;

abstract class AbstractController extends \Illuminate\Routing\Controller
{
	/**
	 * Get the input from the request.
	 *
	 * @param  mixed $key
	 *
	 * @return mixed
	 */
	protected function input($key = null)
	{
		if ($key !== null) {
			$input = Input::only($key);
		} else {
			$input = Input::all();
		}

		$transformed = $this->getTransformedInput($input);

		if (is_array($key) || $key === null) {
			return $transformed;
		} else {
			return isset($transformed[$key]) ? $transformed[$key] : null;
		}
	}

	/**
	 * Get the transformed input.
	 *
	 * @param  array $input
	 *
	 * @return Illuminte\Support\Fluent
	 */
	protected function getTransformedInput($input)
	{
		$fluent = new Fluent($input);
		$transformed = new Fluent($input);

		foreach ($this->transformInput($fluent) as $k => $v) {
			if (array_key_exists($k, $input)) {
				if ($v instanceof \Closure) {
					$transformed[$k] = $v($input[$k]);
				} else {
					$transformed[$k] = $v;
				}
			}
		}

		return $transformed;
	}

	/**
	 * Transform input.<commit_msg>make input() return array<commit_after><?php
namespace c;

use Illuminate\Support\Facades\Input;
use Illuminate\Support\Fluent;

abstract class AbstractController extends \Illuminate\Routing\Controller
{
	/**
	 * Get the input from the request.
	 *
	 * @param  mixed $key
	 *
	 * @return mixed
	 */
	protected function input($key = null)
	{
		$transformed = $this->fluentInput($key);

		if (is_array($key) || $key === null) {
			return $transformed->toArray();
		} else {
			return isset($transformed[$key]) ? $transformed[$key] : null;
		}
	}

	/**
	 * Get input as a Fluent instance.
	 *
	 * @param  mixed $keys
	 *
	 * @return Illuminate\Support\Fluent
	 */
	protected function fluentInput($keys = null)
	{
		if ($keys !== null) {
			$input = Input::only($keys);
		} else {
			$input = Input::all();
		}

		return $this->getTransformedInput($input);
	}

	/**
	 * Get the transformed input.
	 *
	 * @param  array $input
	 *
	 * @return Illuminte\Support\Fluent
	 */
	protected function getTransformedInput($input)
	{
		$transformed = new Fluent($input);

		foreach ($this->transformInput(new Fluent($input)) as $k => $v) {
			if (array_key_exists($k, $input)) {
				if ($v instanceof \Closure) {
					$transformed[$k] = $v($input[$k]);
				} else {
					$transformed[$k] = $v;
				}
			}
		}

		return $transformed;
	}

	/**
	 * Transform input.
{'fraction_non_alphanumeric': 0.166934835076428, 'fraction_numerical': 0.0, 'mean_word_length': 3.2367972742759794, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3681623', 'n_tokens_mistral': 960, 'n_tokens_neox': 832, 'n_words': 191}