Cleans a variable from input

@param string $input
@return string
321259
private function cleanVariable($input)
    {
        if (is_string($input)) {
            if ($this->shouldSanitizeInput) {
                return trim(strip_tags($input));
            } else {
                return trim($input);
            }
        } else {
            return $input;
        }
    }
920119
public function encode($input)
    {
        $parts = explode('.', $input);

        foreach ($parts as &$part) {
            $part = $this->_encodePart($part);
        }

        return implode('.', $parts);
    }
174815
protected function replaceSpecialChars($input)
	{
		if(is_array($input))
		{
			$result = [];
			
			foreach($input as $k => $v)
			{
				$result[$k] = $this->replaceSpecialChars($v);
			}
			
			return $result;
		}
		
		return strtr($input, [
			'\n' => "\n",
			'\t' => "\t"
		]);
	}
956876
protected static function normalizeCheckBoxAndRadio($input)
    {
        $parts = preg_split("/(<.*?>)/", $input, 2, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
        if (isset($parts[1])) {
            return $parts;
        } else {
            return array('', $parts[0]);
        }
    }
232487
protected function cleanObject($input)
	{
		// add to the cleaned list
		$this->parent->isClean($input);

		foreach ($value as $k => $v)
		{
			$value->{$k} = $this->clean($v);
		}
		return $input;
	}
509437
protected function purifyInputs(array $inputs)
    {
        foreach ($inputs as $key => $input) {
            if ($key[0] === '_') {
                unset($inputs[$key]);
            }
        }

        return $inputs;
    }
1209331
protected function cleanOutput($output)
    {
        $output = str_replace($this->extraOutput, null, $output);

        return strtr($output, [
            'stdin: is not a tty' => null,
        ]);
    }
525993
public static function toUnderscorePath($input)
	{
	    $input = self::fromCamelCase($input, false);
	    $input = str_replace('\\', '/', $input);
	    $input = explode('/', $input);
	    $input = array_map(function ($v) {return str_replace(' ', '_', $v);}, $input);
	    $input = strtolower(implode('/', $input));
	    return $input;
	}
234164
public static function toUnderscoreVariable($input)
	{
	    // from camel case to the underscores separated lower string.
	    $input = self::fromCamelCase($input, false);
	    $input = strtolower(self::toUnderscoreSeparated($input));
	    $input = str_replace('\\_', '\\', str_replace('/_', '/', $input));
	    return $input;
	}
835327
private function filterEmptyInput($input)
    {
        foreach ($input as $key => $value)
        {
            if (empty($value))
            {
                unset($input[$key]);
            }
        }

        return $input;
    }
687892
public static function singularize($input) {
		if (self::$pluralizer === null) {
			self::$pluralizer = new StandardEnglishSingularizer();
		}
	
		return self::$pluralizer->getSingularForm($input);
	}
855846
public function input($input = null, $default = null)
    {
        // Get all inputs
        $inputs = array_merge($this->getInputs(), $this->additionalInputs);

        // Exclude reserved inputs
        foreach ($inputs as $key => $value) {
            if (in_array($key, $this->reserved)) {
                unset($inputs[$key]);
            }
        }

        // Return one input
        if ($input) {
            return isset($inputs[$input])? $inputs[$input] : $default;
        }

        // Or the complete array of inputs
        return $inputs;
    }
753820
protected function sanitizeInputs(&$inputs)
    {
        if (!$this->name) {
            return $inputs;
        }

        $inputs = collect($inputs)->filter(function ($input, $key) {
            return Str::startsWith($key, "{$this->name}_");
        })->mapWithKeys(function ($val, $key) {
            $key = str_replace("{$this->name}_", '', $key);

            return [$key => $val];
        })->toArray();
    }
978543
private function removeDotSegments(string $input): string {
        $output = '';

        $patternA = ',^(\.\.?/),';
        $patternB1 = ',^(/\./),';
        $patternB2 = ',^(/\.)$,';
        $patternC = ',^(/\.\./|/\.\.),';
        // $patternD  = ',^(\.\.?)$,';
        $patternE = ',(/*[^/]*),';

        while ($input !== '') {
            if (\preg_match($patternA, $input)) {
                $input = \preg_replace($patternA, '', $input);
            } elseif (\preg_match($patternB1, $input, $match) || \preg_match($patternB2, $input, $match)) {
                $input = preg_replace(",^" . $match[1] . ",", '/', $input);
            } elseif (\preg_match($patternC, $input, $match)) {
                $input = \preg_replace(',^' . \preg_quote($match[1], ',') . ',', '/', $input);
                $output = \preg_replace(',/([^/]+)$,', '', $output);
            } elseif ($input === '.' || $input === '..') { // pattern D
                $input = '';
            } elseif (\preg_match($patternE, $input, $match)) {
                $initialSegment = $match[1];
                $input = \preg_replace(',^' . \preg_quote($initialSegment, ',') . ',', '', $input, 1);
                $output .= $initialSegment;
            }
        }

        return $output;
    }
871028
public static function toCamelCase($input)
    {
        // Convert words to uppercase and then remove spaces.
        $input = self::toSpaceSeparated($input);
        $input = ucwords($input);
        $input = str_ireplace(' ', '', $input);

        return $input;
    }
823011
protected function sanitizeValue($input, Sanitize $sanitize = null)
    {
        if (!isset($sanitize)) {
            $sanitize = $this->sanitize ?: Sanitize::removeTags()->trim()->toType();
        }

        if (is_array($input)) {
            $rawRule = $sanitize->getRawRules();
            $rawRule = current($rawRule);
            if ($rawRule instanceof Attributes) {
                return $sanitize->sanitize($input);
            }
            return Sanitize::attributes($sanitize)->sanitize($input);
        }

        return $sanitize->sanitize($input);
    }
707762
public function cleanURL( $input ) {
		// scheme and www
		$url = preg_replace( '/^((https?:|ftp:)?(\/\/))?(www\.)?/', '', $input );
		// fragment
		$url = preg_replace( '/#.*/', '', $url );
		// trailing slash
		$url = preg_replace( '{/$}', '', $url );

		return $url;
	}