public static function getSecureKeyInArray(
        array &$array,
        string $key,
        string $type,
        bool $htmlentities = false,
        bool $inline = true
    ) {
        if (!isset($array[$key])) {
            throw new Exception(
                'The key '.$key.' not exist',
                self::ERR_SECURE_ARRAY_KEY_NOT_EXIST
            );
        }

        $currentClass = get_called_class();
        
        if (!$inline) {
            //Only space, NUL-byte, and vertical tab.
            $data = trim($array[$key], ' \0\x0B');
        } else {
            $data = trim($array[$key]);
        }
        
        return $currentClass::secureData(
            $data,
            $type,
            $htmlentities
        );
    }
public static function getSecureKeyInArray(
        array &$array,
        string $key,
        string $type,
        bool $htmlentities = false,
        bool $inline = true
    ) {
        if (!isset($array[$key])) {
            throw new Exception(
                'The key '.$key.' not exist',
                self::ERR_SECURE_ARRAY_KEY_NOT_EXIST
            );
        }

        $currentClass = get_called_class();
        
        if (!$inline) {
            //Only space, NUL-byte, and vertical tab.
            $data = trim($array[$key], ' \0\x0B');
        } else {
            $data = trim($array[$key]);
        }
        
        return $currentClass::secureData(
            $data,
            $type,
            $htmlentities
        );
    }
public static function getSecureKeyInArray ( array & $ array , string $ key , string $ type , bool $ htmlentities = false , bool $ inline = true ) { if ( ! isset ( $ array [ $ key ] ) ) { throw new Exception ( 'The key ' . $ key . ' not exist' , self :: ERR_SECURE_ARRAY_KEY_NOT_EXIST ) ; } $ currentClass = get_called_class ( ) ; if ( ! $ inline ) { //Only space, NUL-byte, and vertical tab. $ data = trim ( $ array [ $ key ] , ' \0\x0B' ) ; } else { $ data = trim ( $ array [ $ key ] ) ; } return $ currentClass :: secureData ( $ data , $ type , $ htmlentities ) ; }
Securise the value of an array key for a declared type.

@param array &$array The array where is the key
@param string $key The key where is the value to securize
@param string $type The type of data
@param boolean $htmlentities (default: false) If use htmlentities
function to a better security
@param boolean $inline (default: true) If array data are inline

@return mixed

@throws \Exception If the key not exist in array
Securise the value of an array key for a declared type .