private function encryptStream($resource)
    {
        $out = \fopen('php://temp', 'w+b');

        if ($resource !== false) {
            try {
                File::encrypt($resource, $out, $this->key);
            } catch (FileAccessDenied $exception) {
                throw new FileAccessDeniedException($exception->getMessage(), $exception->getCode(), $exception);
            } catch (FileModified $exception) {
                throw new FileModifiedException($exception->getMessage(), $exception->getCode(), $exception);
            }

            \rewind($out);
        }

        return $out;
    }
private function encryptStream($resource)
    {
        $out = \fopen('php://temp', 'w+b');

        if ($resource !== false) {
            try {
                File::encrypt($resource, $out, $this->key);
            } catch (FileAccessDenied $exception) {
                throw new FileAccessDeniedException($exception->getMessage(), $exception->getCode(), $exception);
            } catch (FileModified $exception) {
                throw new FileModifiedException($exception->getMessage(), $exception->getCode(), $exception);
            }

            \rewind($out);
        }

        return $out;
    }
private function encryptStream ( $ resource ) { $ out = \ fopen ( 'php://temp' , 'w+b' ) ; if ( $ resource !== false ) { try { File :: encrypt ( $ resource , $ out , $ this -> key ) ; } catch ( FileAccessDenied $ exception ) { throw new FileAccessDeniedException ( $ exception -> getMessage ( ) , $ exception -> getCode ( ) , $ exception ) ; } catch ( FileModified $ exception ) { throw new FileModifiedException ( $ exception -> getMessage ( ) , $ exception -> getCode ( ) , $ exception ) ; } \ rewind ( $ out ) ; } return $ out ; }
Encrypts a stream.

@param false|resource $resource the stream to encrypt

@throws \ParagonIE\Halite\Alerts\CannotPerformOperation
@throws \ParagonIE\Halite\Alerts\FileError
@throws \ParagonIE\Halite\Alerts\InvalidDigestLength
@throws \ParagonIE\Halite\Alerts\InvalidKey
@throws \ParagonIE\Halite\Alerts\InvalidMessage
@throws \ParagonIE\Halite\Alerts\InvalidType
@throws \Viserio\Component\Contract\Filesystem\Exception\FileAccessDeniedException
@throws \Viserio\Component\Contract\Filesystem\Exception\FileModifiedException

@return resource
Encrypts a stream .