private function getStreamFromString(string $contents)
    {
        $path = \bin2hex(\random_bytes(16));

        $this->adapter->write($path, $contents);

        \sodium_memzero($contents);

        $streamContent = $this->adapter->readStream($path);

        $this->adapter->delete($path);

        if ($streamContent !== false) {
            return $streamContent;
        }

        throw new RuntimeException('Created file for string content cant be read.');
    }
private function getStreamFromString(string $contents)
    {
        $path = \bin2hex(\random_bytes(16));

        $this->adapter->write($path, $contents);

        \sodium_memzero($contents);

        $streamContent = $this->adapter->readStream($path);

        $this->adapter->delete($path);

        if ($streamContent !== false) {
            return $streamContent;
        }

        throw new RuntimeException('Created file for string content cant be read.');
    }
private function getStreamFromString ( string $ contents ) { $ path = \ bin2hex ( \ random_bytes ( 16 ) ) ; $ this -> adapter -> write ( $ path , $ contents ) ; \ sodium_memzero ( $ contents ) ; $ streamContent = $ this -> adapter -> readStream ( $ path ) ; $ this -> adapter -> delete ( $ path ) ; if ( $ streamContent !== false ) { return $ streamContent ; } throw new RuntimeException ( 'Created file for string content cant be read.' ) ; }
Returns a stream representation of a string.

@param string $contents The string

@throws \Viserio\Component\Contract\Filesystem\Exception\RuntimeException
@throws \Viserio\Component\Contract\Filesystem\Exception\FileNotFoundException
@throws \Viserio\Component\Contract\Filesystem\Exception\FileAccessDeniedException

@return resource
Returns a stream representation of a string .