protected function prepareForWrite(string $data) : string
    {
        if ($this->usesEncryption) {
            if ($this->encrypter === null) {
                throw new LogicException('Encrypter not set in session handler');
            }

            try {
                return $this->encrypter->encrypt($data);
            } catch (SessionEncryptionException $ex) {
                return '';
            }
        } else {
            return $data;
        }
    }
protected function prepareForWrite(string $data) : string
    {
        if ($this->usesEncryption) {
            if ($this->encrypter === null) {
                throw new LogicException('Encrypter not set in session handler');
            }

            try {
                return $this->encrypter->encrypt($data);
            } catch (SessionEncryptionException $ex) {
                return '';
            }
        } else {
            return $data;
        }
    }
protected function prepareForWrite ( string $ data ) : string { if ( $ this -> usesEncryption ) { if ( $ this -> encrypter === null ) { throw new LogicException ( 'Encrypter not set in session handler' ) ; } try { return $ this -> encrypter -> encrypt ( $ data ) ; } catch ( SessionEncryptionException $ ex ) { return '' ; } } else { return $ data ; } }
Prepares data to be written to storage

@param string $data The data to prepare
@return string The prepared data
@throws LogicException Thrown if using encryption but an encrypter has not been set
Prepares data to be written to storage