Add Net_SFTP_Stream::register() for easier autoloading.

This commit is contained in:
Andreas Fischer 2014-06-27 00:22:41 +02:00
parent f360932343
commit 73f961cb7d

View File

@ -126,6 +126,21 @@ class Net_SFTP_Stream
*/ */
var $notification; var $notification;
/**
* Registers this class as a URL wrapper.
*
* @param optional String $protocol The wrapper name to be registered.
* @return Boolean True on success, false otherwise.
* @access public
*/
static function register($protocol = 'sftp')
{
if (in_array($protocol, stream_get_wrappers(), true)) {
return false;
}
return stream_wrapper_register($protocol, __CLASS__);
}
/** /**
* The Constructor * The Constructor
* *
@ -783,6 +798,4 @@ class Net_SFTP_Stream
} }
} }
if (function_exists('stream_wrapper_register')) { Net_SFTP_Stream::register();
stream_wrapper_register('sftp', 'Net_SFTP_Stream');
}