-PHP_METHOD(HttpRequestFactory, getGlobalDataShareInstance)
-{
- with_error_handling(EH_THROW, php_http_exception_class_entry) {
- if (SUCCESS == zend_parse_parameters_none()) {
- with_error_handling(EH_THROW, php_http_exception_class_entry) {
- zval *instance = *zend_std_get_static_property(php_http_request_datashare_class_entry, ZEND_STRL("instance"), 0, NULL TSRMLS_CC);
-
- if (Z_TYPE_P(instance) != IS_OBJECT) {
- zval *zdriver;
- zend_object_value ov;
- zend_class_entry *class_entry;
- php_http_request_datashare_t *share;
-
- if (!(class_entry = php_http_request_factory_get_class_entry(getThis(), ZEND_STRL("requestDataShareClass") TSRMLS_CC))) {
- class_entry = php_http_request_datashare_class_entry;
- }
-
- if ((zdriver = zend_read_property(php_http_request_factory_class_entry, getThis(), ZEND_STRL("driver"), 0 TSRMLS_CC))
- && (IS_STRING == Z_TYPE_P(zdriver))
- && (share = php_http_request_datashare_global_get(Z_STRVAL_P(zdriver), Z_STRLEN_P(zdriver) TSRMLS_CC))
- && (SUCCESS == php_http_new(&ov, class_entry, (php_http_new_t) php_http_request_datashare_object_new_ex, php_http_request_datashare_class_entry, share, NULL TSRMLS_CC))
- ) {
- MAKE_STD_ZVAL(instance);
- ZVAL_OBJVAL(instance, ov, 0);
- zend_update_static_property(php_http_request_datashare_class_entry, ZEND_STRL("instance"), instance TSRMLS_CC);
-
- if (PHP_HTTP_G->request_datashare.cookie) {
- zend_update_property_bool(php_http_request_datashare_class_entry, instance, ZEND_STRL("cookie"), PHP_HTTP_G->request_datashare.cookie TSRMLS_CC);
- }
- if (PHP_HTTP_G->request_datashare.dns) {
- zend_update_property_bool(php_http_request_datashare_class_entry, instance, ZEND_STRL("dns"), PHP_HTTP_G->request_datashare.dns TSRMLS_CC);
- }
- }
- }
-
- RETVAL_ZVAL(instance, 1, 0);
- } end_error_handling();
- }
- } end_error_handling();
-}
-
-