Normalize the name of an attribute filter

@param  string $key
@return string
553860
public function normalizeKey($key)
	{
		// Built-in/custom filter, normalized to lowercase
		if (preg_match('/^#[a-z_0-9]+$/Di', $key))
		{
			return strtolower($key);
		}

		// Valid callback
		if (is_string($key) && is_callable($key))
		{
			return $key;
		}

		throw new InvalidArgumentException("Invalid filter name '" . $key . "'");
	}
872592
function sanitize_key( $key ) {
		$raw_key = $key;
		$key = strtolower( $key );
		$key = preg_replace( '/[^a-z0-9_\-]/', '', $key );

		return $key;
	}
268454
public function getAttribute($key)
    {

        // query whether the identifier exists or not
        if (isset($this[$uid = $this->maskKey($key)])) {
            return $this[$uid];
        }
    }
903007
protected function normalizeKey($key)
    {
        if ($this->normalization & static::NORMALIZE_TRIM) {
            $key = trim($key);
        }

        if ($this->normalization & static::NORMALIZE_DELIMITERS) {
            $key = static::normalizeKeyDelimiters($key);
        }

        if ($this->normalization & static::NORMALIZE_CASE) {
            $key = strtolower($key);
        }

        if ($this->normalization & static::NORMALIZE_CANONICAL) {
            $key = static::canonicalizeKey($key);
        }

        return $key;
    }
1180570
protected function sanitizeReadableFileName($key)
    {
        $path = '';
        foreach (str_split($key) as $char) {
            $path .= isset(self::$ALLOWED_CHARACTERS[$char]) ? $char : base64_encode($char);
        }
        return $path;
    }
1227585
protected function normalizeHeaderName($name)
    {
        $name = str_replace('-', '_', strtoupper($name));
        if (!in_array($name, ['CONTENT_LENGTH', 'CONTENT_TYPE'])) {
            $name = 'HTTP_' . $name;
        }

        return $name;
    }
469543
protected function prettyHeaderKey(string $key) : string
    {
        return strtr(ucwords(strtr(strtr(strtolower($key), "_", " "), "-", " ")), " ", "-");
    }
492425
public function filterValue($key)
    {
        $this->parseInputOnce();
        return isset($this->filters[$key]) ? $this->filters[$key] : null;
    }
158117
public function getAttribute($key)
    {
        if ( ! isset($this->attr[$key])) {
            return null;
        }
        $value = $this->attr[$key]['value'];
        if (is_string($value) && ! is_null($this->encode)) {
            // convert charset
            $this->attr[$key]['value'] = $this->encode->convert($value);
        }

        return $this->attr[$key];
    }
273756
protected function cleanKey($key)
    {
        return mb_substr(
            $key,
            mb_strlen($this->preDelimiter),
            mb_strlen($key) - mb_strlen($this->postDelimiter) - 1
        );
    }
957881
public static function normalizeSvgAttribute($name) {
        $name = strtolower($name);
        if (isset(static::$svgCaseSensitiveAttributeMap[$name])) {
            $name = static::$svgCaseSensitiveAttributeMap[$name];
        }

        return $name;
    }
752032
protected function _normalizeKey($key)
    {
        try {
            return $this->_normalizeString($key);
        } catch (InvalidArgumentException $e) {
            throw $this->_createOutOfRangeException($this->__('Invalid key'), null, $e, $key);
        }
    }
1082956
public function normalizeKey($key)
    {
        $key = strtolower($key);
        $key = str_replace(array('-', '_'), ' ', $key);
        $key = preg_replace('#^http #', '', $key);
        $key = ucwords($key);
        $key = str_replace(' ', '-', $key);

        return $key;
    }
1187626
protected function normalizeName($name)
    {
        if ($this->hasSuffix($name)) {
            $lenSuffix = strlen($this->suffix);
            $name = substr($name, 0, -$lenSuffix);
        }

        return $name;
    }
698821
protected function &getAttributeValue(string $key)
    {
        if (isset($this->attributes[$key])) {

            return $this->attributes[ $key ];
        }

        $null = null;

        return $null;
    }
71548
protected function getArrayAttributeByKey($key)
    {
        return isset($this->attributes[$key]) ?
                    $this->fromJson($this->attributes[$key]) : [];
    }
43150
private function parseName($key=null)
	{
		$name = $this->get('name');
		if ($name)
		{
			$firstname  = "";
			$middlename = "";
			$lastname   = "";

			$words = array_map('trim', explode(' ', $this->get('name')));
			$count = count($words);

			if ($count == 1)
			{
				$firstname = $words[0];
			}
			else if ($count == 2)
			{
				$firstname = $words[0];
				$lastname  = $words[1];
			}
			else if ($count == 3)
			{
				$firstname  = $words[0];
				$middlename = $words[1];
				$lastname   = $words[2];
			}
			else
			{
				$firstname  = $words[0];
				$lastname   = $words[$count-1];
				$middlename = $words[1];

				for ($i = 2; $i < $count-1; $i++)
				{
					$middlename .= ' ' . $words[$i];
				}
			}
			switch ($key)
			{
				case 'givenName':
					return trim($firstname);
					break;
				case 'middleName':
					return trim($middlename);
					break;
				case 'surname':
					return trim($lastname);
					break;
				default:
					return '';
			}
		}
	}