text: 
  #ifdef HAVE_CONFIG_H
  #include "../ext_config.h"
  #endif
  
  #include <php.h>
  #include "../php_ext.h"
  #include "../ext.h"
  
  #include <Zend/zend_operators.h>
  #include <Zend/zend_exceptions.h>
  #include <Zend/zend_interfaces.h>
  
  #include "kernel/main.h"
  #include "kernel/memory.h"
  #include "kernel/object.h"
  #include "kernel/array.h"
  #include "kernel/fcall.h"
  #include "kernel/operators.h"
  #include "ext/spl/spl_exceptions.h"
  #include "kernel/exception.h"
  
  
  /**
   * Phalcon\Registry
   *
   * A registry is a container for storing objects and values in the application space.
   * By storing the value in a registry, the same object is always available throughout
   * your application.
   *
   *<code>
   * $registry = new \Phalcon\Registry();
   *
   * // Set value
   * $registry->something = "something";
   * // or
   * $registry["something"] = "something";
   *
   * // Get value
   * $value = $registry->something;
   * // or
   * $value = $registry["something"];
   *
   * // Check if the key exists
   * $exists = isset($registry->something);
   * // or
   * $exists = isset($registry["something"]);
   *
   * // Unset
   * unset($registry->something);
   * // or
   * unset($registry["something"]);
   *</code>
   *
   * In addition to ArrayAccess, Phalcon\Registry also implements Countable
   * (count($registry) will return the number of elements in the registry),
   * Serializable and Iterator (you can iterate over the registry
   * using a foreach loop) interfaces. For PHP 5.4 and higher, JsonSerializable
   * interface is implemented.
   *
   * Phalcon\Registry is very fast (it is typically faster than any userspace
   * implementation of the registry); however, this comes at a price:
   * Phalcon\Registry is a final class and cannot be inherited from.
   *
   * Though Phalcon\Registry exposes methods like __get(), offsetGet(), count() etc,
   * it is not recommended to invoke them manually (these methods exist mainly to
   * match the interfaces the registry implements): $registry->__get("property")
   * is several times slower than $registry->property.
   *
   * Internally all the magic methods (and interfaces except JsonSerializable)
   * are implemented using object handlers or similar techniques: this allows
   * to bypass relatively slow method calls.
   */
  ZEPHIR_INIT_CLASS(Phalcon_Registry) {
  
  	ZEPHIR_REGISTER_CLASS(Phalcon, Registry, phalcon, registry, phalcon_registry_method_entry, ZEND_ACC_FINAL_CLASS);
  
  	zend_declare_property_null(phalcon_registry_ce, SL("_data"), ZEND_ACC_PROTECTED);
  
  	zend_class_implements(phalcon_registry_ce, 1, zend_ce_arrayaccess);
  	zend_class_implements(phalcon_registry_ce, 1, zend_ce_countable);
  	zend_class_implements(phalcon_registry_ce, 1, zend_ce_iterator);
  	return SUCCESS;
  
  }
  
  /**
   * Registry constructor
   */
  PHP_METHOD(Phalcon_Registry, __construct) {
  
  	zval _0;
  	zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&_0);
  
  
  	ZEPHIR_MM_GROW();
  
  	ZEPHIR_INIT_VAR(&_0);
  	array_init(&_0);
  	zephir_update_property_zval(this_ptr, ZEND_STRL("_data"), &_0);
  	ZEPHIR_MM_RESTORE();
  
  }
  
  /**
   * Checks if the element is present in the registry
   */
  PHP_METHOD(Phalcon_Registry, offsetExists) {
  
  	zval *offset, offset_sub, _0;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&offset_sub);
  	ZVAL_UNDEF(&_0);
  #if PHP_VERSION_ID >= 80000
  	bool is_null_true = 1;
  	ZEND_PARSE_PARAMETERS_START(1, 1)
  		Z_PARAM_ZVAL(offset)
  	ZEND_PARSE_PARAMETERS_END();
  
  #endif
  
  
  	zephir_fetch_params_without_memory_grow(1, 0, &offset);
  
  
  
  	zephir_read_property(&_0, this_ptr, ZEND_STRL("_data"), PH_NOISY_CC | PH_READONLY);
  	RETURN_BOOL(zephir_array_isset(&_0, offset));
  
  }
  
  /**
   * Returns an index in the registry
   */
  PHP_METHOD(Phalcon_Registry, offsetGet) {
  
  	zval *offset, offset_sub, _0, _1;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&offset_sub);
  	ZVAL_UNDEF(&_0);
  	ZVAL_UNDEF(&_1);
  #if PHP_VERSION_ID >= 80000
  	bool is_null_true = 1;
  	ZEND_PARSE_PARAMETERS_START(1, 1)
  		Z_PARAM_ZVAL(offset)
  	ZEND_PARSE_PARAMETERS_END();
  
  #endif
  
  
  	zephir_fetch_params_without_memory_grow(1, 0, &offset);
  
  
  
  	zephir_read_property(&_0, this_ptr, ZEND_STRL("_data"), PH_NOISY_CC | PH_READONLY);
  	zephir_array_fetch(&_1, &_0, offset, PH_NOISY | PH_READONLY, "phalcon/registry.zep", 98);
  	RETURN_CTORW(&_1);
  
  }
  
  /**
   * Sets an element in the registry
   */
  PHP_METHOD(Phalcon_Registry, offsetSet) {
  
  	zval *offset, offset_sub, *value, value_sub;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&offset_sub);
  	ZVAL_UNDEF(&value_sub);
  #if PHP_VERSION_ID >= 80000
  	bool is_null_true = 1;
  	ZEND_PARSE_PARAMETERS_START(2, 2)
  		Z_PARAM_ZVAL(offset)
  		Z_PARAM_ZVAL(value)
  	ZEND_PARSE_PARAMETERS_END();
  
  #endif
  
  
  	zephir_fetch_params_without_memory_grow(2, 0, &offset, &value);
  
  
  
  	zephir_update_property_array(this_ptr, SL("_data"), offset, value);
  
  }
  
  /**
   * Unsets an element in the registry
   */
  PHP_METHOD(Phalcon_Registry, offsetUnset) {
  
  	zval *offset, offset_sub, _0;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&offset_sub);
  	ZVAL_UNDEF(&_0);
  #if PHP_VERSION_ID >= 80000
  	bool is_null_true = 1;
  	ZEND_PARSE_PARAMETERS_START(1, 1)
  		Z_PARAM_ZVAL(offset)
  	ZEND_PARSE_PARAMETERS_END();
  
  #endif
  
  
  	zephir_fetch_params_without_memory_grow(1, 0, &offset);
  
  
  
  	zephir_read_property(&_0, this_ptr, ZEND_STRL("_data"), PH_NOISY_CC | PH_READONLY);
  	zephir_array_unset(&_0, offset, PH_SEPARATE);
  
  }
  
  /**
   * Checks how many elements are in the register
   */
  PHP_METHOD(Phalcon_Registry, count) {
  
  	zval _0;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&_0);
  
  
  
  	zephir_read_property(&_0, this_ptr, ZEND_STRL("_data"), PH_NOISY_CC | PH_READONLY);
  	RETURN_LONG(zephir_fast_count_int(&_0));
  
  }
  
  /**
   * Moves cursor to next row in the registry
   */
  PHP_METHOD(Phalcon_Registry, next) {
  
  	zval _0;
  	zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
  	zend_long ZEPHIR_LAST_CALL_STATUS;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&_0);
  
  
  	ZEPHIR_MM_GROW();
  
  	zephir_read_property(&_0, this_ptr, ZEND_STRL("_data"), PH_NOISY_CC | PH_READONLY);
  	ZEPHIR_MAKE_REF(&_0);
  	ZEPHIR_CALL_FUNCTION(NULL, "next", NULL, 346, &_0);
  	ZEPHIR_UNREF(&_0);
  	zephir_check_call_status();
  	ZEPHIR_MM_RESTORE();
  
  }
  
  /**
   * Gets pointer number of active row in the registry
   */
  PHP_METHOD(Phalcon_Registry, key) {
  
  	zval _0;
  	zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
  	zend_long ZEPHIR_LAST_CALL_STATUS;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&_0);
  
  
  	ZEPHIR_MM_GROW();
  
  	zephir_read_property(&_0, this_ptr, ZEND_STRL("_data"), PH_NOISY_CC | PH_READONLY);
  	ZEPHIR_RETURN_CALL_FUNCTION("key", NULL, 347, &_0);
  	zephir_check_call_status();
  	RETURN_MM();
  
  }
  
  /**
   * Rewinds the registry cursor to its beginning
   */
  PHP_METHOD(Phalcon_Registry, rewind) {
  
  	zval _0;
  	zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
  	zend_long ZEPHIR_LAST_CALL_STATUS;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&_0);
  
  
  	ZEPHIR_MM_GROW();
  
  	zephir_read_property(&_0, this_ptr, ZEND_STRL("_data"), PH_NOISY_CC | PH_READONLY);
  	ZEPHIR_MAKE_REF(&_0);
  	ZEPHIR_CALL_FUNCTION(NULL, "reset", NULL, 348, &_0);
  	ZEPHIR_UNREF(&_0);
  	zephir_check_call_status();
  	ZEPHIR_MM_RESTORE();
  
  }
  
  /**
   * Checks if the iterator is valid
   */
  PHP_METHOD(Phalcon_Registry, valid) {
  
  	zval _0, _1;
  	zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
  	zend_long ZEPHIR_LAST_CALL_STATUS;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&_0);
  	ZVAL_UNDEF(&_1);
  
  
  	ZEPHIR_MM_GROW();
  
  	zephir_read_property(&_0, this_ptr, ZEND_STRL("_data"), PH_NOISY_CC | PH_READONLY);
  	ZEPHIR_CALL_FUNCTION(&_1, "key", NULL, 347, &_0);
  	zephir_check_call_status();
  	RETURN_MM_BOOL(Z_TYPE_P(&_1) != IS_NULL);
  
  }
  
  /**
   * Obtains the current value in the internal iterator
   */
  PHP_METHOD(Phalcon_Registry, current) {
  
  	zval _0;
  	zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
  	zend_long ZEPHIR_LAST_CALL_STATUS;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&_0);
  
  
  	ZEPHIR_MM_GROW();
  
  	zephir_read_property(&_0, this_ptr, ZEND_STRL("_data"), PH_NOISY_CC | PH_READONLY);
  	ZEPHIR_RETURN_CALL_FUNCTION("current", NULL, 349, &_0);
  	zephir_check_call_status();
  	RETURN_MM();
  
  }
  
  /**
   * Sets an element in the registry
   */
  PHP_METHOD(Phalcon_Registry, __set) {
  
  	zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
  	zend_long ZEPHIR_LAST_CALL_STATUS;
  	zval *key_param = NULL, *value, value_sub;
  	zval key;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&key);
  	ZVAL_UNDEF(&value_sub);
  #if PHP_VERSION_ID >= 80000
  	bool is_null_true = 1;
  	ZEND_PARSE_PARAMETERS_START(2, 2)
  		Z_PARAM_STR(key)
  		Z_PARAM_ZVAL(value)
  	ZEND_PARSE_PARAMETERS_END();
  
  #endif
  
  
  	ZEPHIR_MM_GROW();
  	zephir_fetch_params(1, 2, 0, &key_param, &value);
  
  	if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) {
  		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string"));
  		RETURN_MM_NULL();
  	}
  	if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) {
  		zephir_get_strval(&key, key_param);
  	} else {
  		ZEPHIR_INIT_VAR(&key);
  		ZVAL_EMPTY_STRING(&key);
  	}
  
  
  	ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetset", NULL, 350, &key, value);
  	zephir_check_call_status();
  	ZEPHIR_MM_RESTORE();
  
  }
  
  /**
   * Returns an index in the registry
   */
  PHP_METHOD(Phalcon_Registry, __get) {
  
  	zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
  	zend_long ZEPHIR_LAST_CALL_STATUS;
  	zval *key_param = NULL;
  	zval key;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&key);
  #if PHP_VERSION_ID >= 80000
  	bool is_null_true = 1;
  	ZEND_PARSE_PARAMETERS_START(1, 1)
  		Z_PARAM_STR(key)
  	ZEND_PARSE_PARAMETERS_END();
  
  #endif
  
  
  	ZEPHIR_MM_GROW();
  	zephir_fetch_params(1, 1, 0, &key_param);
  
  	if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) {
  		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string"));
  		RETURN_MM_NULL();
  	}
  	if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) {
  		zephir_get_strval(&key, key_param);
  	} else {
  		ZEPHIR_INIT_VAR(&key);
  		ZVAL_EMPTY_STRING(&key);
  	}
  
  
  	ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetget", NULL, 351, &key);
  	zephir_check_call_status();
  	RETURN_MM();
  
  }
  
  PHP_METHOD(Phalcon_Registry, __isset) {
  
  	zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
  	zend_long ZEPHIR_LAST_CALL_STATUS;
  	zval *key_param = NULL;
  	zval key;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&key);
  #if PHP_VERSION_ID >= 80000
  	bool is_null_true = 1;
  	ZEND_PARSE_PARAMETERS_START(1, 1)
  		Z_PARAM_STR(key)
  	ZEND_PARSE_PARAMETERS_END();
  
  #endif
  
  
  	ZEPHIR_MM_GROW();
  	zephir_fetch_params(1, 1, 0, &key_param);
  
  	if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) {
  		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string"));
  		RETURN_MM_NULL();
  	}
  	if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) {
  		zephir_get_strval(&key, key_param);
  	} else {
  		ZEPHIR_INIT_VAR(&key);
  		ZVAL_EMPTY_STRING(&key);
  	}
  
  
  	ZEPHIR_RETURN_CALL_METHOD(this_ptr, "offsetexists", NULL, 352, &key);
  	zephir_check_call_status();
  	RETURN_MM();
  
  }
  
  PHP_METHOD(Phalcon_Registry, __unset) {
  
  	zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
  	zend_long ZEPHIR_LAST_CALL_STATUS;
  	zval *key_param = NULL;
  	zval key;
  	zval *this_ptr = getThis();
  
  	ZVAL_UNDEF(&key);
  #if PHP_VERSION_ID >= 80000
  	bool is_null_true = 1;
  	ZEND_PARSE_PARAMETERS_START(1, 1)
  		Z_PARAM_STR(key)
  	ZEND_PARSE_PARAMETERS_END();
  
  #endif
  
  
  	ZEPHIR_MM_GROW();
  	zephir_fetch_params(1, 1, 0, &key_param);
  
  	if (UNEXPECTED(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) {
  		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be of the type string"));
  		RETURN_MM_NULL();
  	}
  	if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) {
  		zephir_get_strval(&key, key_param);
  	} else {
  		ZEPHIR_INIT_VAR(&key);
  		ZVAL_EMPTY_STRING(&key);
  	}
  
  
  	ZEPHIR_CALL_METHOD(NULL, this_ptr, "offsetunset", NULL, 353, &key);
  	zephir_check_call_status();
  	ZEPHIR_MM_RESTORE();
  
  }
  
  