Phalcon\Db\Adapter\MongoDB\GridFS\StreamWrapper::register PHP Method

register() public static method

Register the GridFS stream wrapper.
public static register ( string $protocol = 'gridfs' )
$protocol string Protocol to use for stream_wrapper_register()
    public static function register($protocol = 'gridfs')
    {
        if (in_array($protocol, stream_get_wrappers())) {
            stream_wrapper_unregister($protocol);
        }
        stream_wrapper_register($protocol, get_called_class(), \STREAM_IS_URL);
    }

Usage Example

Example #1
0
 /**
  * Registers the GridFS stream wrapper if it is not already registered.
  */
 private function registerStreamWrapper()
 {
     if (in_array(self::$streamWrapperProtocol, stream_get_wrappers())) {
         return;
     }
     StreamWrapper::register(self::$streamWrapperProtocol);
 }