protected function adjustKey($key): string
    {
        if (! $this->strictType) {
            $invalidTypes = array('array', 'object', 'boolean', 'NULL');
            $type = gettype($key);
            if (! in_array($type, $invalidTypes)) {
                $key = (string)$key;
            }
        }
        if (! is_string($key)) {
            throw StrictTypeException::keyTypeError($key);
        }
        $key = trim($key);
        if (strlen($key) === 0) {
            throw InvalidArgumentException::emptyKey();
        }
        if (strlen($key) > 255) {
            // key should not be larger
            //  than 255 character
            throw InvalidArgumentException::keyTooLong($key);
        }
        if (preg_match('/[\[\]\{\}\(\)\/\@\:\\\]/', $key) !== 0) {
            // PSR-16 says those characters not allowed
            throw InvalidArgumentException::invalidKeyCharacter($key);
        }
        $key = $this->webappPrefix . $this->weakHash($key);
        return $key;
    }
protected function adjustKey($key): string
    {
        if (! $this->strictType) {
            $invalidTypes = array('array', 'object', 'boolean', 'NULL');
            $type = gettype($key);
            if (! in_array($type, $invalidTypes)) {
                $key = (string)$key;
            }
        }
        if (! is_string($key)) {
            throw StrictTypeException::keyTypeError($key);
        }
        $key = trim($key);
        if (strlen($key) === 0) {
            throw InvalidArgumentException::emptyKey();
        }
        if (strlen($key) > 255) {
            // key should not be larger
            //  than 255 character
            throw InvalidArgumentException::keyTooLong($key);
        }
        if (preg_match('/[\[\]\{\}\(\)\/\@\:\\\]/', $key) !== 0) {
            // PSR-16 says those characters not allowed
            throw InvalidArgumentException::invalidKeyCharacter($key);
        }
        $key = $this->webappPrefix . $this->weakHash($key);
        return $key;
    }
protected function adjustKey ( $ key ) : string { if ( ! $ this -> strictType ) { $ invalidTypes = array ( 'array' , 'object' , 'boolean' , 'NULL' ) ; $ type = gettype ( $ key ) ; if ( ! in_array ( $ type , $ invalidTypes ) ) { $ key = ( string ) $ key ; } } if ( ! is_string ( $ key ) ) { throw StrictTypeException :: keyTypeError ( $ key ) ; } $ key = trim ( $ key ) ; if ( strlen ( $ key ) === 0 ) { throw InvalidArgumentException :: emptyKey ( ) ; } if ( strlen ( $ key ) > 255 ) { // key should not be larger //  than 255 character throw InvalidArgumentException :: keyTooLong ( $ key ) ; } if ( preg_match ( '/[\[\]\{\}\(\)\/\@\:\\\]/' , $ key ) !== 0 ) { // PSR-16 says those characters not allowed throw InvalidArgumentException :: invalidKeyCharacter ( $ key ) ; } $ key = $ this -> webappPrefix . $ this -> weakHash ( $ key ) ; return $ key ; }
Takes user supplied key and creates internal cache key.

This function takes the user defined cache key, gets the substring of a
hash from the weakHash function, and appends that substring to the WebApp
prefix string to create the actual key that will be used with the cache engine.

@param string $key The user defined cache key to hash.

@throws StrictTypeException
@throws InvalidArgumentException

@psalm-suppress RedundantConditionGivenDocblockType

@return string
Takes user supplied key and creates internal cache key .