public function createPrivateKeyFile($file, $passphrase = null, $type = null, $bits = null)
    {
        $private = $this->createPrivateKey($passphrase, $type, $bits);

        if (false === @ file_put_contents($file, $private)) {
            $error = error_get_last();

            throw new RuntimeException(sprintf(
                'The private key file "%s" could not be written: %s',
                $file,
                $error['message']
            ));
        }
    }
public function createPrivateKeyFile($file, $passphrase = null, $type = null, $bits = null)
    {
        $private = $this->createPrivateKey($passphrase, $type, $bits);

        if (false === @ file_put_contents($file, $private)) {
            $error = error_get_last();

            throw new RuntimeException(sprintf(
                'The private key file "%s" could not be written: %s',
                $file,
                $error['message']
            ));
        }
    }
public function createPrivateKeyFile ( $ file , $ passphrase = null , $ type = null , $ bits = null ) { $ private = $ this -> createPrivateKey ( $ passphrase , $ type , $ bits ) ; if ( false === @ file_put_contents ( $ file , $ private ) ) { $ error = error_get_last ( ) ; throw new RuntimeException ( sprintf ( 'The private key file "%s" could not be written: %s' , $ file , $ error [ 'message' ] ) ) ; } }
Creates a private key and saves it to a file.

@param string      $file       The file path.
@param null|string $passphrase The passphrase.
@param null|string $type       The key type.
@param null|string $bits       The number of bits.

@throws RuntimeException If the file could not be written.

@api
Creates a private key and saves it to a file .