src/MongoDB/Driver/Manager.cpp

void HHVM_METHOD(MongoDBDriverManager, __construct, const String &dsn, const Array &options, const Array &driverOptions)
{
src/MongoDB/Manager.c

PHP_METHOD(Manager, __construct)
{
    php_phongo_manager_t     *intern;
    zend_error_handling       error_handling;
    mongoc_uri_t             *uri;
    char                     *uri_string;
    int                       uri_string_len;
    zval                     *options = NULL;
    bson_t                    bson_options = BSON_INITIALIZER;
    zval                     *driverOptions = NULL;
    (void)return_value; (void)return_value_ptr; (void)return_value_used;

    zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
    intern = (php_phongo_manager_t *)zend_object_store_get_object(getThis() TSRMLS_CC);

    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a!a!", &uri_string, &uri_string_len, &options, &driverOptions) == FAILURE) {
        zend_restore_error_handling(&error_handling TSRMLS_CC);
        return;
    }
    zend_restore_error_handling(&error_handling TSRMLS_CC);

    if (options) {
        zval_to_bson(options, PHONGO_BSON_NONE, &bson_options, NULL TSRMLS_CC);
    }