protected function getFilePathFromKey($key)
    {
        $key = basename($key);
        $badChars = ['-', '.', '_', '\\', '*', '\"', '?', '[', ']', ':', ';', '|', '=', ','];
        $key = str_replace($badChars, '/', $key);
        while (strpos($key, '//') !== false) {
            $key = str_replace('//', '/', $key);
        }

        $directoryToCreate = $this->config['cacheDirectory'];

        $endOfDirectory = strrpos($key, '/');

        if ($endOfDirectory !== false) {
            $directoryToCreate = $this->config['cacheDirectory'].substr($key, 0, $endOfDirectory);
        }

        if (!file_exists($directoryToCreate)) {
            $result = mkdir($directoryToCreate, 0777, true);
            if (!$result) {
                return false;
            }
        }

        $filePath = $this->config['cacheDirectory'].$key.'.'.$this->config['fileExtension'];

        return $filePath;
    }
protected function getFilePathFromKey($key)
    {
        $key = basename($key);
        $badChars = ['-', '.', '_', '\\', '*', '\"', '?', '[', ']', ':', ';', '|', '=', ','];
        $key = str_replace($badChars, '/', $key);
        while (strpos($key, '//') !== false) {
            $key = str_replace('//', '/', $key);
        }

        $directoryToCreate = $this->config['cacheDirectory'];

        $endOfDirectory = strrpos($key, '/');

        if ($endOfDirectory !== false) {
            $directoryToCreate = $this->config['cacheDirectory'].substr($key, 0, $endOfDirectory);
        }

        if (!file_exists($directoryToCreate)) {
            $result = mkdir($directoryToCreate, 0777, true);
            if (!$result) {
                return false;
            }
        }

        $filePath = $this->config['cacheDirectory'].$key.'.'.$this->config['fileExtension'];

        return $filePath;
    }
protected function getFilePathFromKey ( $ key ) { $ key = basename ( $ key ) ; $ badChars = [ '-' , '.' , '_' , '\\' , '*' , '\"' , '?' , '[' , ']' , ':' , ';' , '|' , '=' , ',' ] ; $ key = str_replace ( $ badChars , '/' , $ key ) ; while ( strpos ( $ key , '//' ) !== false ) { $ key = str_replace ( '//' , '/' , $ key ) ; } $ directoryToCreate = $ this -> config [ 'cacheDirectory' ] ; $ endOfDirectory = strrpos ( $ key , '/' ) ; if ( $ endOfDirectory !== false ) { $ directoryToCreate = $ this -> config [ 'cacheDirectory' ] . substr ( $ key , 0 , $ endOfDirectory ) ; } if ( ! file_exists ( $ directoryToCreate ) ) { $ result = mkdir ( $ directoryToCreate , 0777 , true ) ; if ( ! $ result ) { return false ; } } $ filePath = $ this -> config [ 'cacheDirectory' ] . $ key . '.' . $ this -> config [ 'fileExtension' ] ; return $ filePath ; }
Returns the file path from a given cache key, creating the relevant directory structure if necessary.

@param string $key

@return string
Returns the file path from a given cache key creating the relevant directory structure if necessary .