diff --git a/build/php7/32bits/phalcon.zep.c b/build/php7/32bits/phalcon.zep.c index c2152917b7e..988227391c5 100644 --- a/build/php7/32bits/phalcon.zep.c +++ b/build/php7/32bits/phalcon.zep.c @@ -2560,28 +2560,28 @@ static int zephir_method_exists_ex(zval *object, const char *method_name, unsign #define ZEPHIR_MAX_ARRAY_LEVELS 16 -static void ZEPHIR_FASTCALL zephir_create_array(zval *return_value, uint size, int initialize); +static void ZEPHIR_FASTCALL zephir_create_array(zval *return_value, zend_uint size, int initialize); static void ZEPHIR_FASTCALL zephir_ensure_array(zval *probable_array); /** Combined isset/fetch */ static int zephir_array_isset_fetch(zval *fetched, const zval *arr, zval *index, int readonly); -static int zephir_array_isset_string_fetch(zval *fetched, const zval *arr, char *index, uint index_length, int readonly); +static int zephir_array_isset_string_fetch(zval *fetched, const zval *arr, char *index, zend_uint index_length, int readonly); static int zephir_array_isset_long_fetch(zval *fetched, const zval *arr, unsigned long index, int readonly); /** Check for index existence */ static int ZEPHIR_FASTCALL zephir_array_isset(const zval *arr, zval *index); static int ZEPHIR_FASTCALL zephir_array_isset_long(const zval *arr, unsigned long index); -static int ZEPHIR_FASTCALL zephir_array_isset_string(const zval *arr, const char *index, uint index_length); +static int ZEPHIR_FASTCALL zephir_array_isset_string(const zval *arr, const char *index, zend_uint index_length); /** Unset existing indexes */ static int ZEPHIR_FASTCALL zephir_array_unset(zval *arr, zval *index, int flags); static int ZEPHIR_FASTCALL zephir_array_unset_long(zval *arr, unsigned long index, int flags); -static int ZEPHIR_FASTCALL zephir_array_unset_string(zval *arr, const char *index, uint index_length, int flags); +static int ZEPHIR_FASTCALL zephir_array_unset_string(zval *arr, const char *index, zend_uint index_length, int flags); /** Fetch items from arrays */ static int zephir_array_fetch(zval *return_value, zval *arr, zval *index, int flags ZEPHIR_DEBUG_PARAMS); -static int zephir_array_fetch_string(zval *return_value, zval *arr, const char *index, uint index_length, int flags ZEPHIR_DEBUG_PARAMS); +static int zephir_array_fetch_string(zval *return_value, zval *arr, const char *index, zend_uint index_length, int flags ZEPHIR_DEBUG_PARAMS); static int zephir_array_fetch_long(zval *return_value, zval *arr, unsigned long index, int flags ZEPHIR_DEBUG_PARAMS); /** Append elements to arrays */ @@ -2590,7 +2590,7 @@ static void zephir_merge_append(zval *left, zval *values); /** Modify array */ static int zephir_array_update_zval(zval *arr, zval *index, zval *value, int flags); -static int zephir_array_update_string(zval *arr, const char *index, uint index_length, zval *value, int flags); +static int zephir_array_update_string(zval *arr, const char *index, zend_uint index_length, zval *value, int flags); static int zephir_array_update_long(zval *arr, unsigned long index, zval *value, int flags ZEPHIR_DEBUG_PARAMS); static void zephir_array_keys(zval *return_value, zval *arr); @@ -2941,27 +2941,27 @@ typedef enum _zephir_call_type { ZEPHIR_LAST_CALL_STATUS = zephir_call_user_func_array_noex(return_value, handler, params); \ } while (0) -static int zephir_call_func_aparams(zval *return_value_ptr, const char *func_name, uint func_length, +static int zephir_call_func_aparams(zval *return_value_ptr, const char *func_name, zend_uint func_length, zephir_fcall_cache_entry **cache_entry, int cache_slot, - uint param_count, zval **params); + zend_uint param_count, zval **params); static int zephir_call_zval_func_aparams(zval *return_value_ptr, zval *func_name, zephir_fcall_cache_entry **cache_entry, int cache_slot, - uint param_count, zval **params) ZEPHIR_ATTR_WARN_UNUSED_RESULT; + zend_uint param_count, zval **params) ZEPHIR_ATTR_WARN_UNUSED_RESULT; static int zephir_call_class_method_aparams(zval *return_value_ptr, zend_class_entry *ce, zephir_call_type type, zval *object, const char *method_name, - uint method_len, + zend_uint method_len, zephir_fcall_cache_entry **cache_entry, int cache_slot, - uint param_count, + zend_uint param_count, zval **params) ZEPHIR_ATTR_WARN_UNUSED_RESULT; ZEPHIR_ATTR_WARN_UNUSED_RESULT static inline int zephir_return_call_function(zval *return_value, - const char *func, uint func_len, zephir_fcall_cache_entry **cache_entry, int cache_slot, uint param_count, zval **params) + const char *func, zend_uint func_len, zephir_fcall_cache_entry **cache_entry, int cache_slot, zend_uint param_count, zval **params) { zval rv, *rvp = return_value ? return_value : &rv; int status; @@ -2989,7 +2989,7 @@ ZEPHIR_ATTR_WARN_UNUSED_RESULT static inline int zephir_return_call_function(zva } ZEPHIR_ATTR_WARN_UNUSED_RESULT static inline int zephir_return_call_zval_function(zval *return_value, - zval *func, zephir_fcall_cache_entry **cache_entry, int cache_slot, uint param_count, zval **params) + zval *func, zephir_fcall_cache_entry **cache_entry, int cache_slot, zend_uint param_count, zval **params) { zval rv, *rvp = return_value ? return_value : &rv; int status; @@ -3018,9 +3018,9 @@ ZEPHIR_ATTR_WARN_UNUSED_RESULT static inline int zephir_return_call_zval_functio ZEPHIR_ATTR_WARN_UNUSED_RESULT static inline int zephir_return_call_class_method(zval *return_value, zend_class_entry *ce, zephir_call_type type, zval *object, - const char *method_name, uint method_len, + const char *method_name, zend_uint method_len, zephir_fcall_cache_entry **cache_entry, int cache_slot, - uint param_count, zval **params) + zend_uint param_count, zval **params) { zval rv, *rvp = return_value ? return_value : &rv; int status; @@ -4520,7 +4520,7 @@ static int zephir_cleanup_fcache(void *pDest, int num_args, va_list args, zend_h { zephir_fcall_cache_entry **entry = (zephir_fcall_cache_entry**) pDest; zend_class_entry *scope; - uint len = ZSTR_LEN(hash_key->key); + zend_uint len = ZSTR_LEN(hash_key->key); assert(hash_key->key != NULL); assert(len > 2 * sizeof(zend_class_entry**)); @@ -5979,9 +5979,9 @@ static int zephir_create_instance_params(zval *return_value, const zval *class_n -static void ZEPHIR_FASTCALL zephir_create_array(zval *return_value, uint size, int initialize) +static void ZEPHIR_FASTCALL zephir_create_array(zval *return_value, zend_uint size, int initialize) { - uint i; + zend_uint i; zval null_value; HashTable *hashTable; ZVAL_NULL(&null_value); @@ -6045,7 +6045,7 @@ static int zephir_array_isset_fetch(zval *fetched, const zval *arr, zval *index, break; case IS_DOUBLE: - result = zend_hash_index_find(h, (ulong)Z_DVAL_P(index)); + result = zend_hash_index_find(h, (zend_ulong)Z_DVAL_P(index)); break; case IS_LONG: @@ -6084,7 +6084,7 @@ static int zephir_array_isset_fetch(zval *fetched, const zval *arr, zval *index, return 0; } -static int zephir_array_isset_string_fetch(zval *fetched, const zval *arr, char *index, uint index_length, int readonly) +static int zephir_array_isset_string_fetch(zval *fetched, const zval *arr, char *index, zend_uint index_length, int readonly) { zval *zv; if (UNEXPECTED(Z_TYPE_P(arr) == IS_OBJECT && zephir_instance_of_ev((zval *)arr, (const zend_class_entry *)zend_ce_arrayaccess))) { @@ -6192,7 +6192,7 @@ static int ZEPHIR_FASTCALL zephir_array_isset(const zval *arr, zval *index) return zend_hash_str_exists(h, SL("")); case IS_DOUBLE: - return zend_hash_index_exists(h, (ulong)Z_DVAL_P(index)); + return zend_hash_index_exists(h, (zend_ulong)Z_DVAL_P(index)); case IS_TRUE: case IS_FALSE: @@ -6211,7 +6211,7 @@ static int ZEPHIR_FASTCALL zephir_array_isset(const zval *arr, zval *index) } } -static int ZEPHIR_FASTCALL zephir_array_isset_string(const zval *arr, const char *index, uint index_length) +static int ZEPHIR_FASTCALL zephir_array_isset_string(const zval *arr, const char *index, zend_uint index_length) { if (UNEXPECTED(Z_TYPE_P(arr) == IS_OBJECT && zephir_instance_of_ev((zval *)arr, (const zend_class_entry *)zend_ce_arrayaccess))) { zend_long ZEPHIR_LAST_CALL_STATUS; @@ -6279,7 +6279,7 @@ static int ZEPHIR_FASTCALL zephir_array_unset(zval *arr, zval *index, int flags) return (zend_hash_str_del(ht, "", 1) == SUCCESS); case IS_DOUBLE: - return (zend_hash_index_del(ht, (ulong)Z_DVAL_P(index)) == SUCCESS); + return (zend_hash_index_del(ht, (zend_ulong)Z_DVAL_P(index)) == SUCCESS); case IS_TRUE: return (zend_hash_index_del(ht, 1) == SUCCESS); @@ -6300,7 +6300,7 @@ static int ZEPHIR_FASTCALL zephir_array_unset(zval *arr, zval *index, int flags) } } -static int ZEPHIR_FASTCALL zephir_array_unset_string(zval *arr, const char *index, uint index_length, int flags) +static int ZEPHIR_FASTCALL zephir_array_unset_string(zval *arr, const char *index, zend_uint index_length, int flags) { if (UNEXPECTED(Z_TYPE_P(arr) == IS_OBJECT && zephir_instance_of_ev(arr, (const zend_class_entry *)zend_ce_arrayaccess))) { zend_long ZEPHIR_LAST_CALL_STATUS; @@ -6368,7 +6368,7 @@ static int zephir_array_fetch(zval *return_value, zval *arr, zval *index, int fl zval *zv; HashTable *ht; int result = SUCCESS, found = 0; - ulong uidx = 0; + zend_ulong uidx = 0; char *sidx = NULL; if (UNEXPECTED(Z_TYPE_P(arr) == IS_OBJECT && zephir_instance_of_ev(arr, (const zend_class_entry *)zend_ce_arrayaccess))) { @@ -6391,7 +6391,7 @@ static int zephir_array_fetch(zval *return_value, zval *arr, zval *index, int fl break; case IS_DOUBLE: - uidx = (ulong)Z_DVAL_P(index); + uidx = (zend_ulong)Z_DVAL_P(index); found = (zv = zend_hash_index_find(ht, uidx)) != NULL; break; @@ -6446,7 +6446,7 @@ static int zephir_array_fetch(zval *return_value, zval *arr, zval *index, int fl return FAILURE; } -static int zephir_array_fetch_string(zval *return_value, zval *arr, const char *index, uint index_length, int flags ZEPHIR_DEBUG_PARAMS) +static int zephir_array_fetch_string(zval *return_value, zval *arr, const char *index, zend_uint index_length, int flags ZEPHIR_DEBUG_PARAMS) { zval *zv; @@ -6601,7 +6601,7 @@ static int zephir_array_update_zval(zval *arr, zval *index, zval *value, int fla break; case IS_DOUBLE: - ret = zend_hash_index_update(ht, (ulong)Z_DVAL_P(index), value); + ret = zend_hash_index_update(ht, (zend_ulong)Z_DVAL_P(index), value); break; case IS_LONG: @@ -6626,7 +6626,7 @@ static int zephir_array_update_zval(zval *arr, zval *index, zval *value, int fla return ret != NULL ? FAILURE : SUCCESS; } -static int zephir_array_update_string(zval *arr, const char *index, uint index_length, zval *value, int flags) +static int zephir_array_update_string(zval *arr, const char *index, zend_uint index_length, zval *value, int flags) { if (UNEXPECTED(Z_TYPE_P(arr) == IS_OBJECT && zephir_instance_of_ev(arr, (const zend_class_entry *)zend_ce_arrayaccess))) { @@ -8666,9 +8666,9 @@ static int zephir_call_user_function(zval *object_pp, zend_class_entry *obj_ce, return status; } -static int zephir_call_func_aparams(zval *return_value_ptr, const char *func_name, uint func_length, +static int zephir_call_func_aparams(zval *return_value_ptr, const char *func_name, zend_uint func_length, zephir_fcall_cache_entry **cache_entry, int cache_slot, - uint param_count, zval **params) + zend_uint param_count, zval **params) { int status; zval rv, *rvp = return_value_ptr ? return_value_ptr : &rv; @@ -8703,7 +8703,7 @@ static int zephir_call_func_aparams(zval *return_value_ptr, const char *func_nam static int zephir_call_zval_func_aparams(zval *return_value_ptr, zval *func_name, zephir_fcall_cache_entry **cache_entry, int cache_slot, - uint param_count, zval **params) + zend_uint param_count, zval **params) { int status; zval rv, *rvp = return_value_ptr ? return_value_ptr : &rv; @@ -8734,9 +8734,9 @@ static int zephir_call_zval_func_aparams(zval *return_value_ptr, zval *func_name } static int zephir_call_class_method_aparams(zval *return_value, zend_class_entry *ce, zephir_call_type type, zval *object, - const char *method_name, uint method_len, + const char *method_name, zend_uint method_len, zephir_fcall_cache_entry **cache_entry, int cache_slot, - uint param_count, zval **params) + zend_uint param_count, zval **params) { int status; @@ -29474,508 +29474,449 @@ static PHP_METHOD(Phalcon_Version, getPart) { -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Annotation) { +ZEPHIR_INIT_CLASS(Phalcon_Collection_Exception) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Annotation, phalcon, annotations_annotation, phalcon_annotations_annotation_method_entry, 0); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Collection, Exception, phalcon, collection_exception, phalcon_exception_ce, NULL, 0); - zend_declare_property_null(phalcon_annotations_annotation_ce, SL("arguments"), ZEND_ACC_PROTECTED); + zend_class_implements(phalcon_collection_exception_ce, 1, zephir_get_internal_ce(SL("throwable"))); + return SUCCESS; - zend_declare_property_null(phalcon_annotations_annotation_ce, SL("exprArguments"), ZEND_ACC_PROTECTED); +} - zend_declare_property_null(phalcon_annotations_annotation_ce, SL("name"), ZEND_ACC_PROTECTED); + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Collection_ReadOnly) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Collection, ReadOnly, phalcon, collection_readonly, phalcon_collection_ce, phalcon_collection_readonly_method_entry, 0); return SUCCESS; } -static PHP_METHOD(Phalcon_Annotations_Annotation, __construct) { +static PHP_METHOD(Phalcon_Collection_ReadOnly, remove) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *reflectionData_param = NULL, name, exprArguments, argument, resolvedArgument, _0, *_1$$3, _2$$3, _3$$4, _5$$7; - zval reflectionData, arguments; + zval *element_param = NULL; + zval element; zval *this_ptr = getThis(); - ZVAL_UNDEF(&reflectionData); - ZVAL_UNDEF(&arguments); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&exprArguments); - ZVAL_UNDEF(&argument); - ZVAL_UNDEF(&resolvedArgument); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_5$$7); + ZVAL_UNDEF(&element); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &reflectionData_param); + zephir_fetch_params(1, 1, 0, &element_param); - ZEPHIR_OBS_COPY_OR_DUP(&reflectionData, reflectionData_param); + zephir_get_strval(&element, element_param); - zephir_array_fetch_string(&_0, &reflectionData, SL("name"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 47); - zephir_update_property_zval(this_ptr, SL("name"), &_0); - ZEPHIR_OBS_VAR(&exprArguments); - if (zephir_array_isset_string_fetch(&exprArguments, &reflectionData, SL("arguments"), 0)) { - ZEPHIR_INIT_VAR(&arguments); - array_init(&arguments); - zephir_is_iterable(&exprArguments, 0, "phalcon/Annotations/Annotation.zep", 67); - if (Z_TYPE_P(&exprArguments) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&exprArguments), _1$$3) - { - ZEPHIR_INIT_NVAR(&argument); - ZVAL_COPY(&argument, _1$$3); - zephir_array_fetch_string(&_3$$4, &argument, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 58); - ZEPHIR_CALL_METHOD(&resolvedArgument, this_ptr, "getexpression", &_4, 0, &_3$$4); - zephir_check_call_status(); - if (zephir_array_isset_string_fetch(&name, &argument, SL("name"), 1)) { - zephir_array_update_zval(&arguments, &name, &resolvedArgument, PH_COPY | PH_SEPARATE); - } else { - zephir_array_append(&arguments, &resolvedArgument, PH_SEPARATE, "phalcon/Annotations/Annotation.zep", 63); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &exprArguments, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2$$3, &exprArguments, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&argument, &exprArguments, "current", NULL, 0); - zephir_check_call_status(); - zephir_array_fetch_string(&_5$$7, &argument, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 58); - ZEPHIR_CALL_METHOD(&resolvedArgument, this_ptr, "getexpression", &_4, 0, &_5$$7); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&name); - if (zephir_array_isset_string_fetch(&name, &argument, SL("name"), 0)) { - zephir_array_update_zval(&arguments, &name, &resolvedArgument, PH_COPY | PH_SEPARATE); - } else { - zephir_array_append(&arguments, &resolvedArgument, PH_SEPARATE, "phalcon/Annotations/Annotation.zep", 63); - } - ZEPHIR_CALL_METHOD(NULL, &exprArguments, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&argument); - zephir_update_property_zval(this_ptr, SL("arguments"), &arguments); - zephir_update_property_zval(this_ptr, SL("exprArguments"), &exprArguments); - } - ZEPHIR_MM_RESTORE(); + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_collection_exception_ce, "The object is read only", "phalcon/Collection/ReadOnly.zep", 25); + return; } -static PHP_METHOD(Phalcon_Annotations_Annotation, getArgument) { +static PHP_METHOD(Phalcon_Collection_ReadOnly, set) { - zval *position, position_sub, argument, _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *element_param = NULL, *value, value_sub; + zval element; zval *this_ptr = getThis(); - ZVAL_UNDEF(&position_sub); - ZVAL_UNDEF(&argument); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&element); + ZVAL_UNDEF(&value_sub); - zephir_fetch_params_without_memory_grow(1, 0, &position); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &element_param, &value); + zephir_get_strval(&element, element_param); - zephir_read_property(&_0, this_ptr, SL("arguments"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset_fetch(&argument, &_0, position, 1)) { - RETURN_CTORW(&argument); - } + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_collection_exception_ce, "The object is read only", "phalcon/Collection/ReadOnly.zep", 33); + return; } -static PHP_METHOD(Phalcon_Annotations_Annotation, getArguments) { - zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "arguments"); +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Messages_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Messages, Exception, phalcon, messages_exception, phalcon_exception_ce, NULL, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Annotations_Annotation, getExprArguments) { - zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "exprArguments"); +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Messages_Message) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Messages, Message, phalcon, messages_message, phalcon_messages_message_method_entry, 0); + + zend_declare_property_null(phalcon_messages_message_ce, SL("code"), ZEND_ACC_PROTECTED); + + zend_declare_property_null(phalcon_messages_message_ce, SL("field"), ZEND_ACC_PROTECTED); + + zend_declare_property_null(phalcon_messages_message_ce, SL("message"), ZEND_ACC_PROTECTED); + + zend_declare_property_null(phalcon_messages_message_ce, SL("type"), ZEND_ACC_PROTECTED); + + zend_declare_property_null(phalcon_messages_message_ce, SL("metaData"), ZEND_ACC_PROTECTED); + + phalcon_messages_message_ce->create_object = zephir_init_properties_Phalcon_Messages_Message; + + zend_class_implements(phalcon_messages_message_ce, 1, phalcon_messages_messageinterface_ce); + zend_class_implements(phalcon_messages_message_ce, 1, zephir_get_internal_ce(SL("jsonserializable"))); + return SUCCESS; } -static PHP_METHOD(Phalcon_Annotations_Annotation, getExpression) { +static PHP_METHOD(Phalcon_Messages_Message, getCode) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *expr_param = NULL, value, item, resolvedItem, arrayValue, name, type, _0$$7, *_1$$7, _2$$7, _3$$8, _5$$11, _6$$15, _7$$15; - zval expr; zval *this_ptr = getThis(); - ZVAL_UNDEF(&expr); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&item); - ZVAL_UNDEF(&resolvedItem); - ZVAL_UNDEF(&arrayValue); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&_0$$7); - ZVAL_UNDEF(&_2$$7); - ZVAL_UNDEF(&_3$$8); - ZVAL_UNDEF(&_5$$11); - ZVAL_UNDEF(&_6$$15); - ZVAL_UNDEF(&_7$$15); - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &expr_param); + RETURN_MEMBER(getThis(), "code"); - ZEPHIR_OBS_COPY_OR_DUP(&expr, expr_param); +} +static PHP_METHOD(Phalcon_Messages_Message, getField) { - ZEPHIR_OBS_VAR(&type); - zephir_array_fetch_string(&type, &expr, SL("type"), PH_NOISY, "phalcon/Annotations/Annotation.zep", 107); - do { - if (ZEPHIR_IS_LONG(&type, 301) || ZEPHIR_IS_LONG(&type, 302) || ZEPHIR_IS_LONG(&type, 303) || ZEPHIR_IS_LONG(&type, 307)) { - ZEPHIR_OBS_VAR(&value); - zephir_array_fetch_string(&value, &expr, SL("value"), PH_NOISY, "phalcon/Annotations/Annotation.zep", 114); - break; - } - if (ZEPHIR_IS_LONG(&type, 304)) { - ZEPHIR_INIT_NVAR(&value); - ZVAL_NULL(&value); - break; - } - if (ZEPHIR_IS_LONG(&type, 305)) { - ZEPHIR_INIT_NVAR(&value); - ZVAL_BOOL(&value, 0); - break; - } - if (ZEPHIR_IS_LONG(&type, 306)) { - ZEPHIR_INIT_NVAR(&value); - ZVAL_BOOL(&value, 1); - break; - } - if (ZEPHIR_IS_LONG(&type, 308)) { - ZEPHIR_INIT_VAR(&arrayValue); - array_init(&arrayValue); - zephir_array_fetch_string(&_0$$7, &expr, SL("items"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 132); - zephir_is_iterable(&_0$$7, 0, "phalcon/Annotations/Annotation.zep", 144); - if (Z_TYPE_P(&_0$$7) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0$$7), _1$$7) - { - ZEPHIR_INIT_NVAR(&item); - ZVAL_COPY(&item, _1$$7); - zephir_array_fetch_string(&_3$$8, &item, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 135); - ZEPHIR_CALL_METHOD(&resolvedItem, this_ptr, "getexpression", &_4, 146, &_3$$8); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&name); - if (zephir_array_isset_string_fetch(&name, &item, SL("name"), 0)) { - zephir_array_update_zval(&arrayValue, &name, &resolvedItem, PH_COPY | PH_SEPARATE); - } else { - zephir_array_append(&arrayValue, &resolvedItem, PH_SEPARATE, "phalcon/Annotations/Annotation.zep", 140); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_0$$7, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2$$7, &_0$$7, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2$$7)) { - break; - } - ZEPHIR_CALL_METHOD(&item, &_0$$7, "current", NULL, 0); - zephir_check_call_status(); - zephir_array_fetch_string(&_5$$11, &item, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/Annotations/Annotation.zep", 135); - ZEPHIR_CALL_METHOD(&resolvedItem, this_ptr, "getexpression", &_4, 146, &_5$$11); - zephir_check_call_status(); - ZEPHIR_OBS_NVAR(&name); - if (zephir_array_isset_string_fetch(&name, &item, SL("name"), 0)) { - zephir_array_update_zval(&arrayValue, &name, &resolvedItem, PH_COPY | PH_SEPARATE); - } else { - zephir_array_append(&arrayValue, &resolvedItem, PH_SEPARATE, "phalcon/Annotations/Annotation.zep", 140); - } - ZEPHIR_CALL_METHOD(NULL, &_0$$7, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&item); - RETURN_CCTOR(&arrayValue); - } - if (ZEPHIR_IS_LONG(&type, 300)) { - object_init_ex(return_value, phalcon_annotations_annotation_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 147, &expr); - zephir_check_call_status(); - RETURN_MM(); - } - ZEPHIR_INIT_VAR(&_6$$15); - object_init_ex(&_6$$15, phalcon_annotations_exception_ce); - ZEPHIR_INIT_VAR(&_7$$15); - ZEPHIR_CONCAT_SVS(&_7$$15, "The expression ", &type, " is unknown"); - ZEPHIR_CALL_METHOD(NULL, &_6$$15, "__construct", NULL, 6, &_7$$15); - zephir_check_call_status(); - zephir_throw_exception_debug(&_6$$15, "phalcon/Annotations/Annotation.zep", 150); - ZEPHIR_MM_RESTORE(); - return; - } while(0); + zval *this_ptr = getThis(); - RETURN_CCTOR(&value); + + RETURN_MEMBER(getThis(), "field"); } -static PHP_METHOD(Phalcon_Annotations_Annotation, getName) { +static PHP_METHOD(Phalcon_Messages_Message, getMessage) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "name"); + RETURN_MEMBER(getThis(), "message"); } -static PHP_METHOD(Phalcon_Annotations_Annotation, getNamedArgument) { +static PHP_METHOD(Phalcon_Messages_Message, getType) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *name_param = NULL, argument, _0; - zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&argument); - ZVAL_UNDEF(&_0); - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); + RETURN_MEMBER(getThis(), "type"); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - ZVAL_EMPTY_STRING(&name); - } +} +static PHP_METHOD(Phalcon_Messages_Message, getMetaData) { - zephir_read_property(&_0, this_ptr, SL("arguments"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset_fetch(&argument, &_0, &name, 1)) { - RETURN_CTOR(&argument); - } - ZEPHIR_MM_RESTORE(); + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "metaData"); } -static PHP_METHOD(Phalcon_Annotations_Annotation, getNamedParameter) { +static PHP_METHOD(Phalcon_Messages_Message, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL; - zval name; + zval metaData; + zend_long code; + zval *message_param = NULL, *field = NULL, field_sub, *type_param = NULL, *code_param = NULL, *metaData_param = NULL, _0; + zval message, type; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&type); + ZVAL_UNDEF(&field_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&metaData); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); + zephir_fetch_params(1, 1, 4, &message_param, &field, &type_param, &code_param, &metaData_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + if (UNEXPECTED(Z_TYPE_P(message_param) != IS_STRING && Z_TYPE_P(message_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'message' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); + if (EXPECTED(Z_TYPE_P(message_param) == IS_STRING)) { + zephir_get_strval(&message, message_param); } else { - ZEPHIR_INIT_VAR(&name); - ZVAL_EMPTY_STRING(&name); + ZEPHIR_INIT_VAR(&message); + ZVAL_EMPTY_STRING(&message); + } + if (!field) { + field = &field_sub; + ZEPHIR_INIT_VAR(field); + ZVAL_STRING(field, ""); + } + if (!type_param) { + ZEPHIR_INIT_VAR(&type); + ZVAL_STRING(&type, ""); + } else { + zephir_get_strval(&type, type_param); + } + if (!code_param) { + code = 0; + } else { + code = zephir_get_intval(code_param); + } + if (!metaData_param) { + ZEPHIR_INIT_VAR(&metaData); + array_init(&metaData); + } else { + zephir_get_arrval(&metaData, metaData_param); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getnamedargument", NULL, 0, &name); - zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, SL("message"), &message); + zephir_update_property_zval(this_ptr, SL("field"), field); + zephir_update_property_zval(this_ptr, SL("type"), &type); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, code); + zephir_update_property_zval(this_ptr, SL("code"), &_0); + zephir_update_property_zval(this_ptr, SL("metaData"), &metaData); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Annotations_Annotation, hasArgument) { +static PHP_METHOD(Phalcon_Messages_Message, __toString) { - zval *position, position_sub, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&position_sub); - ZVAL_UNDEF(&_0); - - zephir_fetch_params_without_memory_grow(1, 0, &position); - - - zephir_read_property(&_0, this_ptr, SL("arguments"), PH_NOISY_CC | PH_READONLY); - RETURN_BOOL(zephir_array_isset(&_0, position)); + RETURN_MEMBER(getThis(), "message"); } -static PHP_METHOD(Phalcon_Annotations_Annotation, numberArguments) { +static PHP_METHOD(Phalcon_Messages_Message, jsonSerialize) { zval _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *this_ptr = getThis(); ZVAL_UNDEF(&_0); + ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, SL("arguments"), PH_NOISY_CC | PH_READONLY); - RETURN_LONG(zephir_fast_count_int(&_0)); + zephir_create_array(return_value, 5, 0); + ZEPHIR_OBS_VAR(&_0); + zephir_read_property(&_0, this_ptr, SL("field"), PH_NOISY_CC); + zephir_array_update_string(return_value, SL("field"), &_0, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(&_0); + zephir_read_property(&_0, this_ptr, SL("message"), PH_NOISY_CC); + zephir_array_update_string(return_value, SL("message"), &_0, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(&_0); + zephir_read_property(&_0, this_ptr, SL("type"), PH_NOISY_CC); + zephir_array_update_string(return_value, SL("type"), &_0, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(&_0); + zephir_read_property(&_0, this_ptr, SL("code"), PH_NOISY_CC); + zephir_array_update_string(return_value, SL("code"), &_0, PH_COPY | PH_SEPARATE); + ZEPHIR_OBS_NVAR(&_0); + zephir_read_property(&_0, this_ptr, SL("metaData"), PH_NOISY_CC); + zephir_array_update_string(return_value, SL("metaData"), &_0, PH_COPY | PH_SEPARATE); + RETURN_MM(); } +static PHP_METHOD(Phalcon_Messages_Message, setCode) { + + zval *code_param = NULL, _0; + zend_long code; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + zephir_fetch_params_without_memory_grow(1, 0, &code_param); + code = zephir_get_intval(code_param); -#ifdef HAVE_CONFIG_H -#endif + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, code); + zephir_update_property_zval(this_ptr, SL("code"), &_0); + RETURN_THISW(); + +} + +static PHP_METHOD(Phalcon_Messages_Message, setField) { + zval *field, field_sub; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&field_sub); + zephir_fetch_params_without_memory_grow(1, 0, &field); -ZEPHIR_INIT_CLASS(Phalcon_Annotations_AnnotationsFactory) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Annotations, AnnotationsFactory, phalcon, annotations_annotationsfactory, phalcon_factory_abstractfactory_ce, phalcon_annotations_annotationsfactory_method_entry, 0); - return SUCCESS; + zephir_update_property_zval(this_ptr, SL("field"), field); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Annotations_AnnotationsFactory, __construct) { +static PHP_METHOD(Phalcon_Messages_Message, setMessage) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *services_param = NULL; - zval services; + zval *message_param = NULL; + zval message; zval *this_ptr = getThis(); - ZVAL_UNDEF(&services); + ZVAL_UNDEF(&message); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &services_param); + zephir_fetch_params(1, 1, 0, &message_param); - if (!services_param) { - ZEPHIR_INIT_VAR(&services); - array_init(&services); + if (UNEXPECTED(Z_TYPE_P(message_param) != IS_STRING && Z_TYPE_P(message_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'message' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(message_param) == IS_STRING)) { + zephir_get_strval(&message, message_param); } else { - ZEPHIR_OBS_COPY_OR_DUP(&services, services_param); + ZEPHIR_INIT_VAR(&message); + ZVAL_EMPTY_STRING(&message); } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "init", NULL, 0, &services); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + zephir_update_property_zval(this_ptr, SL("message"), &message); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Annotations_AnnotationsFactory, load) { +static PHP_METHOD(Phalcon_Messages_Message, setMetaData) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_1 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *config = NULL, config_sub, name, options, _0, _2, _3; + zval *metaData_param = NULL; + zval metaData; zval *this_ptr = getThis(); - ZVAL_UNDEF(&config_sub); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&metaData); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &config); + zephir_fetch_params(1, 1, 0, &metaData_param); - ZEPHIR_SEPARATE_PARAM(config); + ZEPHIR_OBS_COPY_OR_DUP(&metaData, metaData_param); - ZEPHIR_CALL_METHOD(&_0, this_ptr, "checkconfig", NULL, 0, config); - zephir_check_call_status(); - ZEPHIR_CPY_WRT(config, &_0); - ZEPHIR_OBS_VAR(&name); - zephir_array_fetch_string(&name, config, SL("adapter"), PH_NOISY, "phalcon/Annotations/AnnotationsFactory.zep", 47); - zephir_array_unset_string(config, SL("adapter"), PH_SEPARATE); - ZEPHIR_INIT_VAR(&_2); - array_init(&_2); - ZEPHIR_INIT_VAR(&_3); - ZVAL_STRING(&_3, "options"); - ZEPHIR_CALL_CE_STATIC(&options, phalcon_helper_arr_ce, "get", &_1, 15, config, &_3, &_2); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "newinstance", NULL, 0, &name, &options); - zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, SL("metaData"), &metaData); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Annotations_AnnotationsFactory, newInstance) { +static PHP_METHOD(Phalcon_Messages_Message, setType) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval options, _1; - zval *name_param = NULL, *options_param = NULL, definition, _0; - zval name; + zval *type_param = NULL; + zval type; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&definition); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&type); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &name_param, &options_param); + zephir_fetch_params(1, 1, 0, &type_param); - if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + if (UNEXPECTED(Z_TYPE_P(type_param) != IS_STRING && Z_TYPE_P(type_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'type' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { - zephir_get_strval(&name, name_param); - } else { - ZEPHIR_INIT_VAR(&name); - ZVAL_EMPTY_STRING(&name); - } - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); + if (EXPECTED(Z_TYPE_P(type_param) == IS_STRING)) { + zephir_get_strval(&type, type_param); } else { - ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); + ZEPHIR_INIT_VAR(&type); + ZVAL_EMPTY_STRING(&type); } - ZEPHIR_CALL_METHOD(NULL, this_ptr, "checkservice", NULL, 0, &name); - zephir_check_call_status(); - zephir_read_property(&_0, this_ptr, SL("mapper"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_OBS_VAR(&definition); - zephir_array_fetch(&definition, &_0, &name, PH_NOISY, "phalcon/Annotations/AnnotationsFactory.zep", 71); - ZEPHIR_INIT_VAR(&_1); - zephir_create_array(&_1, 1, 0); - zephir_array_fast_append(&_1, &options); - ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(return_value, &definition, &_1); - zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, SL("type"), &type); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Annotations_AnnotationsFactory, getAdapters) { +zend_object *zephir_init_properties_Phalcon_Messages_Message(zend_class_entry *class_type TSRMLS_DC) { - zval *this_ptr = getThis(); + zval _0, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property(&_0, this_ptr, SL("metaData"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval(this_ptr, SL("metaData"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); + } - zephir_create_array(return_value, 3, 0); - add_assoc_stringl_ex(return_value, SL("apcu"), SL("Phalcon\\Annotations\\Adapter\\Apcu")); - add_assoc_stringl_ex(return_value, SL("memory"), SL("Phalcon\\Annotations\\Adapter\\Memory")); - add_assoc_stringl_ex(return_value, SL("stream"), SL("Phalcon\\Annotations\\Adapter\\Stream")); - return; +} + + + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Messages_MessageInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Messages, MessageInterface, phalcon, messages_messageinterface, phalcon_messages_messageinterface_method_entry); + + return SUCCESS; } +ZEPHIR_DOC_METHOD(Phalcon_Messages_MessageInterface, __toString); + +ZEPHIR_DOC_METHOD(Phalcon_Messages_MessageInterface, getCode); + +ZEPHIR_DOC_METHOD(Phalcon_Messages_MessageInterface, getField); + +ZEPHIR_DOC_METHOD(Phalcon_Messages_MessageInterface, getMessage); + +ZEPHIR_DOC_METHOD(Phalcon_Messages_MessageInterface, getMetaData); + +ZEPHIR_DOC_METHOD(Phalcon_Messages_MessageInterface, getType); + +ZEPHIR_DOC_METHOD(Phalcon_Messages_MessageInterface, setCode); + +ZEPHIR_DOC_METHOD(Phalcon_Messages_MessageInterface, setField); + +ZEPHIR_DOC_METHOD(Phalcon_Messages_MessageInterface, setMessage); + +ZEPHIR_DOC_METHOD(Phalcon_Messages_MessageInterface, setMetaData); + +ZEPHIR_DOC_METHOD(Phalcon_Messages_MessageInterface, setType); + @@ -29986,88 +29927,122 @@ static PHP_METHOD(Phalcon_Annotations_AnnotationsFactory, getAdapters) { -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Collection) { +ZEPHIR_INIT_CLASS(Phalcon_Messages_Messages) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Collection, phalcon, annotations_collection, phalcon_annotations_collection_method_entry, 0); + ZEPHIR_REGISTER_CLASS(Phalcon\\Messages, Messages, phalcon, messages_messages, phalcon_messages_messages_method_entry, 0); - zend_declare_property_null(phalcon_annotations_collection_ce, SL("annotations"), ZEND_ACC_PROTECTED); + zend_declare_property_long(phalcon_messages_messages_ce, SL("position"), 0, ZEND_ACC_PROTECTED); - zend_declare_property_long(phalcon_annotations_collection_ce, SL("position"), 0, ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_messages_messages_ce, SL("messages"), ZEND_ACC_PROTECTED); - zend_class_implements(phalcon_annotations_collection_ce, 1, zend_ce_iterator); - zend_class_implements(phalcon_annotations_collection_ce, 1, spl_ce_Countable); + zend_class_implements(phalcon_messages_messages_ce, 1, zend_ce_arrayaccess); + zend_class_implements(phalcon_messages_messages_ce, 1, spl_ce_Countable); + zend_class_implements(phalcon_messages_messages_ce, 1, zend_ce_iterator); + zend_class_implements(phalcon_messages_messages_ce, 1, zephir_get_internal_ce(SL("jsonserializable"))); return SUCCESS; } -static PHP_METHOD(Phalcon_Annotations_Collection, __construct) { +static PHP_METHOD(Phalcon_Messages_Messages, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_3 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *reflectionData_param = NULL, annotations, annotationData, *_0, _1, _2$$3, _4$$4; - zval reflectionData; + zval *messages_param = NULL; + zval messages; zval *this_ptr = getThis(); - ZVAL_UNDEF(&reflectionData); - ZVAL_UNDEF(&annotations); - ZVAL_UNDEF(&annotationData); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&messages); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &reflectionData_param); + zephir_fetch_params(1, 0, 1, &messages_param); - if (!reflectionData_param) { - ZEPHIR_INIT_VAR(&reflectionData); - array_init(&reflectionData); + if (!messages_param) { + ZEPHIR_INIT_VAR(&messages); + array_init(&messages); } else { - zephir_get_arrval(&reflectionData, reflectionData_param); + zephir_get_arrval(&messages, messages_param); } - ZEPHIR_INIT_VAR(&annotations); - array_init(&annotations); - zephir_is_iterable(&reflectionData, 0, "phalcon/Annotations/Collection.zep", 58); - if (Z_TYPE_P(&reflectionData) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&reflectionData), _0) - { - ZEPHIR_INIT_NVAR(&annotationData); - ZVAL_COPY(&annotationData, _0); - ZEPHIR_INIT_NVAR(&_2$$3); - object_init_ex(&_2$$3, phalcon_annotations_annotation_ce); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 147, &annotationData); - zephir_check_call_status(); - zephir_array_append(&annotations, &_2$$3, PH_SEPARATE, "phalcon/Annotations/Collection.zep", 55); - } ZEND_HASH_FOREACH_END(); + zephir_update_property_zval(this_ptr, SL("messages"), &messages); + ZEPHIR_MM_RESTORE(); + +} + +static PHP_METHOD(Phalcon_Messages_Messages, appendMessage) { + + zval *message, message_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&message_sub); + + zephir_fetch_params_without_memory_grow(1, 0, &message); + + + + zephir_update_property_array_append(this_ptr, SL("messages"), message); + +} + +static PHP_METHOD(Phalcon_Messages_Messages, appendMessages) { + + zend_bool _0; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_2 = NULL, *_3 = NULL, *_4 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *messages, messages_sub, currentMessages, finalMessages, message, _1$$7; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&messages_sub); + ZVAL_UNDEF(¤tMessages); + ZVAL_UNDEF(&finalMessages); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&_1$$7); + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &messages); + + + + _0 = Z_TYPE_P(messages) != IS_ARRAY; + if (_0) { + _0 = Z_TYPE_P(messages) != IS_OBJECT; + } + if (_0) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_messages_exception_ce, "The messages must be array or object", "phalcon/Messages/Messages.zep", 69); + return; + } + ZEPHIR_OBS_VAR(¤tMessages); + zephir_read_property(¤tMessages, this_ptr, SL("messages"), PH_NOISY_CC); + if (Z_TYPE_P(messages) == IS_ARRAY) { + if (Z_TYPE_P(¤tMessages) == IS_ARRAY) { + ZEPHIR_INIT_VAR(&finalMessages); + zephir_fast_array_merge(&finalMessages, ¤tMessages, messages); + } else { + ZEPHIR_CPY_WRT(&finalMessages, messages); + } + zephir_update_property_zval(this_ptr, SL("messages"), &finalMessages); } else { - ZEPHIR_CALL_METHOD(NULL, &reflectionData, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, messages, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_1, &reflectionData, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_1$$7, messages, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_1)) { + if (!(zephir_is_true(&_1$$7))) { break; } - ZEPHIR_CALL_METHOD(&annotationData, &reflectionData, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&message, messages, "current", &_2, 0); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_4$$4); - object_init_ex(&_4$$4, phalcon_annotations_annotation_ce); - ZEPHIR_CALL_METHOD(NULL, &_4$$4, "__construct", &_3, 147, &annotationData); - zephir_check_call_status(); - zephir_array_append(&annotations, &_4$$4, PH_SEPARATE, "phalcon/Annotations/Collection.zep", 55); - ZEPHIR_CALL_METHOD(NULL, &reflectionData, "next", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", &_3, 0, &message); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, messages, "next", &_4, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&annotationData); - zephir_update_property_zval(this_ptr, SL("annotations"), &annotations); ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Annotations_Collection, count) { +static PHP_METHOD(Phalcon_Messages_Messages, count) { zval _0; zval *this_ptr = getThis(); @@ -30075,255 +30050,292 @@ static PHP_METHOD(Phalcon_Annotations_Collection, count) { ZVAL_UNDEF(&_0); - zephir_read_property(&_0, this_ptr, SL("annotations"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); RETURN_LONG(zephir_fast_count_int(&_0)); } -static PHP_METHOD(Phalcon_Annotations_Collection, current) { +static PHP_METHOD(Phalcon_Messages_Messages, current) { - zval annotation, _0, _1; + zval _0, _1, _2; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zval *this_ptr = getThis(); - ZVAL_UNDEF(&annotation); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, SL("annotations"), PH_NOISY_CC | PH_READONLY); - zephir_read_property(&_1, this_ptr, SL("position"), PH_NOISY_CC | PH_READONLY); - if (!(zephir_array_isset_fetch(&annotation, &_0, &_1, 1))) { - RETURN_BOOL(0); - } - RETURN_CTORW(&annotation); + zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_OBS_VAR(&_2); + zephir_read_property(&_2, this_ptr, SL("position"), PH_NOISY_CC); + zephir_array_fetch(&_1, &_0, &_2, PH_NOISY | PH_READONLY, "phalcon/Messages/Messages.zep", 117); + RETURN_CTOR(&_1); } -static PHP_METHOD(Phalcon_Annotations_Collection, get) { +static PHP_METHOD(Phalcon_Messages_Messages, filter) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, annotation, annotations, _0, *_1, _2, _5, _3$$3, _4$$5; - zval name, _6; + zval *fieldName_param = NULL, filtered, messages, message, _0, *_1$$3, _2$$3, _3$$5, _4$$8; + zval fieldName; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&annotation); - ZVAL_UNDEF(&annotations); + ZVAL_UNDEF(&fieldName); + ZVAL_UNDEF(&filtered); + ZVAL_UNDEF(&messages); + ZVAL_UNDEF(&message); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_4$$8); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); + zephir_fetch_params(1, 1, 0, &fieldName_param); - zephir_get_strval(&name, name_param); + if (UNEXPECTED(Z_TYPE_P(fieldName_param) != IS_STRING && Z_TYPE_P(fieldName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'fieldName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(fieldName_param) == IS_STRING)) { + zephir_get_strval(&fieldName, fieldName_param); + } else { + ZEPHIR_INIT_VAR(&fieldName); + ZVAL_EMPTY_STRING(&fieldName); + } - zephir_read_property(&_0, this_ptr, SL("annotations"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&annotations, &_0); - zephir_is_iterable(&annotations, 0, "phalcon/Annotations/Collection.zep", 98); - if (Z_TYPE_P(&annotations) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&annotations), _1) - { - ZEPHIR_INIT_NVAR(&annotation); - ZVAL_COPY(&annotation, _1); - ZEPHIR_CALL_METHOD(&_3$$3, &annotation, "getname", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&name, &_3$$3)) { - RETURN_CCTOR(&annotation); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &annotations, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2, &annotations, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2)) { - break; - } - ZEPHIR_CALL_METHOD(&annotation, &annotations, "current", NULL, 0); + ZEPHIR_INIT_VAR(&filtered); + array_init(&filtered); + zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&messages, &_0); + if (Z_TYPE_P(&messages) == IS_ARRAY) { + zephir_is_iterable(&messages, 0, "phalcon/Messages/Messages.zep", 145); + if (Z_TYPE_P(&messages) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&messages), _1$$3) + { + ZEPHIR_INIT_NVAR(&message); + ZVAL_COPY(&message, _1$$3); + if ((zephir_method_exists_ex(&message, SL("getfield")) == SUCCESS)) { + ZEPHIR_CALL_METHOD(&_3$$5, &message, "getfield", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&fieldName, &_3$$5)) { + zephir_array_append(&filtered, &message, PH_SEPARATE, "phalcon/Messages/Messages.zep", 141); + } + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &messages, "rewind", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$5, &annotation, "getname", NULL, 0); + while (1) { + ZEPHIR_CALL_METHOD(&_2$$3, &messages, "valid", NULL, 0); zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&name, &_4$$5)) { - RETURN_CCTOR(&annotation); + if (!zend_is_true(&_2$$3)) { + break; } - ZEPHIR_CALL_METHOD(NULL, &annotations, "next", NULL, 0); - zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&message, &messages, "current", NULL, 0); + zephir_check_call_status(); + if ((zephir_method_exists_ex(&message, SL("getfield")) == SUCCESS)) { + ZEPHIR_CALL_METHOD(&_4$$8, &message, "getfield", NULL, 0); + zephir_check_call_status(); + if (ZEPHIR_IS_EQUAL(&fieldName, &_4$$8)) { + zephir_array_append(&filtered, &message, PH_SEPARATE, "phalcon/Messages/Messages.zep", 141); + } + } + ZEPHIR_CALL_METHOD(NULL, &messages, "next", NULL, 0); + zephir_check_call_status(); + } } + ZEPHIR_INIT_NVAR(&message); } - ZEPHIR_INIT_NVAR(&annotation); - ZEPHIR_INIT_VAR(&_5); - object_init_ex(&_5, phalcon_annotations_exception_ce); - ZEPHIR_INIT_VAR(&_6); - ZEPHIR_CONCAT_SVS(&_6, "Collection doesn't have an annotation called '", &name, "'"); - ZEPHIR_CALL_METHOD(NULL, &_5, "__construct", NULL, 6, &_6); - zephir_check_call_status(); - zephir_throw_exception_debug(&_5, "phalcon/Annotations/Collection.zep", 100); - ZEPHIR_MM_RESTORE(); - return; + RETURN_CCTOR(&filtered); } -static PHP_METHOD(Phalcon_Annotations_Collection, getAll) { +static PHP_METHOD(Phalcon_Messages_Messages, jsonSerialize) { - zval found; + zend_bool _3$$3, _5$$6; + zval records; + zval message, _0, *_1, _2, _4$$4, _6$$7; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, annotations, annotation, _0, *_1, _2, _3$$3, _4$$5; - zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&annotations); - ZVAL_UNDEF(&annotation); + ZVAL_UNDEF(&message); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&found); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_6$$7); + ZVAL_UNDEF(&records); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - zephir_get_strval(&name, name_param); - - - ZEPHIR_INIT_VAR(&found); - array_init(&found); - zephir_read_property(&_0, this_ptr, SL("annotations"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&annotations, &_0); - zephir_is_iterable(&annotations, 0, "phalcon/Annotations/Collection.zep", 120); - if (Z_TYPE_P(&annotations) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&annotations), _1) + ZEPHIR_INIT_VAR(&records); + array_init(&records); + zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); + zephir_is_iterable(&_0, 0, "phalcon/Messages/Messages.zep", 174); + if (Z_TYPE_P(&_0) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) { - ZEPHIR_INIT_NVAR(&annotation); - ZVAL_COPY(&annotation, _1); - ZEPHIR_CALL_METHOD(&_3$$3, &annotation, "getname", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&name, &_3$$3)) { - zephir_array_append(&found, &annotation, PH_SEPARATE, "phalcon/Annotations/Collection.zep", 116); + ZEPHIR_INIT_NVAR(&message); + ZVAL_COPY(&message, _1); + _3$$3 = Z_TYPE_P(&message) == IS_OBJECT; + if (_3$$3) { + _3$$3 = (zephir_method_exists_ex(&message, SL("jsonserialize")) == SUCCESS); + } + if (_3$$3) { + ZEPHIR_CALL_METHOD(&_4$$4, &message, "jsonserialize", NULL, 0); + zephir_check_call_status(); + zephir_array_append(&records, &_4$$4, PH_SEPARATE, "phalcon/Messages/Messages.zep", 168); + } else { + zephir_array_append(&records, &message, PH_SEPARATE, "phalcon/Messages/Messages.zep", 170); } } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &annotations, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_2, &annotations, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_2, &_0, "valid", NULL, 0); zephir_check_call_status(); if (!zend_is_true(&_2)) { break; } - ZEPHIR_CALL_METHOD(&annotation, &annotations, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&message, &_0, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$5, &annotation, "getname", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&name, &_4$$5)) { - zephir_array_append(&found, &annotation, PH_SEPARATE, "phalcon/Annotations/Collection.zep", 116); + _5$$6 = Z_TYPE_P(&message) == IS_OBJECT; + if (_5$$6) { + _5$$6 = (zephir_method_exists_ex(&message, SL("jsonserialize")) == SUCCESS); } - ZEPHIR_CALL_METHOD(NULL, &annotations, "next", NULL, 0); + if (_5$$6) { + ZEPHIR_CALL_METHOD(&_6$$7, &message, "jsonserialize", NULL, 0); + zephir_check_call_status(); + zephir_array_append(&records, &_6$$7, PH_SEPARATE, "phalcon/Messages/Messages.zep", 168); + } else { + zephir_array_append(&records, &message, PH_SEPARATE, "phalcon/Messages/Messages.zep", 170); + } + ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&annotation); - RETURN_CTOR(&found); + ZEPHIR_INIT_NVAR(&message); + RETURN_CTOR(&records); } -static PHP_METHOD(Phalcon_Annotations_Collection, getAnnotations) { +static PHP_METHOD(Phalcon_Messages_Messages, key) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "annotations"); + RETURN_MEMBER(getThis(), "position"); } -static PHP_METHOD(Phalcon_Annotations_Collection, has) { +static PHP_METHOD(Phalcon_Messages_Messages, next) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *name_param = NULL, annotations, annotation, _0, *_1, _2, _3$$3, _4$$5; - zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&name); - ZVAL_UNDEF(&annotations); - ZVAL_UNDEF(&annotation); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3$$3); - ZVAL_UNDEF(&_4$$5); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &name_param); - - zephir_get_strval(&name, name_param); - - zephir_read_property(&_0, this_ptr, SL("annotations"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&annotations, &_0); - zephir_is_iterable(&annotations, 0, "phalcon/Annotations/Collection.zep", 146); - if (Z_TYPE_P(&annotations) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&annotations), _1) - { - ZEPHIR_INIT_NVAR(&annotation); - ZVAL_COPY(&annotation, _1); - ZEPHIR_CALL_METHOD(&_3$$3, &annotation, "getname", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&name, &_3$$3)) { - RETURN_MM_BOOL(1); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &annotations, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2, &annotations, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2)) { - break; - } - ZEPHIR_CALL_METHOD(&annotation, &annotations, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_4$$5, &annotation, "getname", NULL, 0); - zephir_check_call_status(); - if (ZEPHIR_IS_EQUAL(&name, &_4$$5)) { - RETURN_MM_BOOL(1); - } - ZEPHIR_CALL_METHOD(NULL, &annotations, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&annotation); - RETURN_MM_BOOL(0); + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("position"))); } -static PHP_METHOD(Phalcon_Annotations_Collection, key) { +static PHP_METHOD(Phalcon_Messages_Messages, offsetExists) { + zval *index, index_sub, _0; zval *this_ptr = getThis(); - - RETURN_MEMBER(getThis(), "position"); + ZVAL_UNDEF(&index_sub); + ZVAL_UNDEF(&_0); + + zephir_fetch_params_without_memory_grow(1, 0, &index); + + + + zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); + RETURN_BOOL(zephir_array_isset(&_0, index)); } -static PHP_METHOD(Phalcon_Annotations_Collection, next) { +static PHP_METHOD(Phalcon_Messages_Messages, offsetGet) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *index, index_sub, message, returnValue, _0; zval *this_ptr = getThis(); + ZVAL_UNDEF(&index_sub); + ZVAL_UNDEF(&message); + ZVAL_UNDEF(&returnValue); + ZVAL_UNDEF(&_0); + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &index); + - RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("position"))); + + ZEPHIR_INIT_VAR(&returnValue); + ZVAL_NULL(&returnValue); + zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_fetch(&message, &_0, index, 1)) { + ZEPHIR_CPY_WRT(&returnValue, &message); + } + RETURN_CCTOR(&returnValue); } -static PHP_METHOD(Phalcon_Annotations_Collection, rewind) { +static PHP_METHOD(Phalcon_Messages_Messages, offsetSet) { + + zval *index, index_sub, *message, message_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&index_sub); + ZVAL_UNDEF(&message_sub); + + zephir_fetch_params_without_memory_grow(2, 0, &index, &message); + + + + if (Z_TYPE_P(message) != IS_OBJECT) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_messages_exception_ce, "The message must be an object", "phalcon/Messages/Messages.zep", 241); + return; + } + zephir_update_property_array(this_ptr, SL("messages"), index, message); + +} + +static PHP_METHOD(Phalcon_Messages_Messages, offsetUnset) { + + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *index, index_sub, _0, _1$$3, _2$$3; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&index_sub); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_2$$3); + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &index); + + + + zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset(&_0, index)) { + zephir_read_property(&_1$$3, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); + ZVAL_LONG(&_2$$3, 1); + ZEPHIR_MAKE_REF(&_1$$3); + ZEPHIR_CALL_FUNCTION(NULL, "array_splice", NULL, 387, &_1$$3, index, &_2$$3); + ZEPHIR_UNREF(&_1$$3); + zephir_check_call_status(); + } + ZEPHIR_MM_RESTORE(); + +} + +static PHP_METHOD(Phalcon_Messages_Messages, rewind) { zval _0; zval *this_ptr = getThis(); @@ -30337,7 +30349,7 @@ static PHP_METHOD(Phalcon_Annotations_Collection, rewind) { } -static PHP_METHOD(Phalcon_Annotations_Collection, valid) { +static PHP_METHOD(Phalcon_Messages_Messages, valid) { zval _0, _1; zval *this_ptr = getThis(); @@ -30346,7 +30358,7 @@ static PHP_METHOD(Phalcon_Annotations_Collection, valid) { ZVAL_UNDEF(&_1); - zephir_read_property(&_0, this_ptr, SL("annotations"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); zephir_read_property(&_1, this_ptr, SL("position"), PH_NOISY_CC | PH_READONLY); RETURN_BOOL(zephir_array_isset(&_0, &_1)); @@ -30362,1621 +30374,899 @@ static PHP_METHOD(Phalcon_Annotations_Collection, valid) { -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Exception) { +ZEPHIR_INIT_CLASS(Phalcon_Escaper_EscaperInterface) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Annotations, Exception, phalcon, annotations_exception, phalcon_exception_ce, NULL, 0); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Escaper, EscaperInterface, phalcon, escaper_escaperinterface, phalcon_escaper_escaperinterface_method_entry); return SUCCESS; } +ZEPHIR_DOC_METHOD(Phalcon_Escaper_EscaperInterface, escapeCss); +ZEPHIR_DOC_METHOD(Phalcon_Escaper_EscaperInterface, escapeHtml); -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -*/ -/* First off, code is include which follows the "include" declaration -** in the input file. */ -// 18 "parser.php7.lemon" +ZEPHIR_DOC_METHOD(Phalcon_Escaper_EscaperInterface, escapeHtmlAttr); +ZEPHIR_DOC_METHOD(Phalcon_Escaper_EscaperInterface, escapeJs); -// 12 "parser.php7.c" -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 +ZEPHIR_DOC_METHOD(Phalcon_Escaper_EscaperInterface, escapeUrl); + +ZEPHIR_DOC_METHOD(Phalcon_Escaper_EscaperInterface, getEncoding); + +ZEPHIR_DOC_METHOD(Phalcon_Escaper_EscaperInterface, setEncoding); + +ZEPHIR_DOC_METHOD(Phalcon_Escaper_EscaperInterface, setHtmlQuoteType); + + + + +#ifdef HAVE_CONFIG_H #endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** AACODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** AANOCODE is a number of type AACODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** AAFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** AAACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** phannot_TOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** AAMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is phannot_TOKENTYPE. The entry in the union -** for base tokens is called "aa0". -** AASTACKDEPTH is the maximum depth of the parser's stack. -** phannot_ARG_SDECL A static variable declaration for the %extra_argument -** phannot_ARG_PDECL A parameter declaration for the %extra_argument -** phannot_ARG_STORE Code to store %extra_argument into aapParser -** phannot_ARG_FETCH Code to extract %extra_argument from aapParser -** AANSTATE the combined number of states. -** AANRULE the number of rules in the grammar -** AAERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define AACODETYPE unsigned char -#define AANOCODE 28 -#define AAACTIONTYPE unsigned char -#define phannot_TOKENTYPE phannot_parser_token* -typedef union { - phannot_TOKENTYPE aa0; - zval aa8; - int aa55; -} AAMINORTYPE; -#define AASTACKDEPTH 100 -#define phannot_ARG_SDECL phannot_parser_status *status; -#define phannot_ARG_PDECL ,phannot_parser_status *status -#define phannot_ARG_FETCH phannot_parser_status *status = aapParser->status -#define phannot_ARG_STORE aapParser->status = status -#define AANSTATE 40 -#define AANRULE 25 -#define AAERRORSYMBOL 18 -#define AAERRSYMDT aa55 -#define AA_NO_ACTION (AANSTATE+AANRULE+2) -#define AA_ACCEPT_ACTION (AANSTATE+AANRULE+1) -#define AA_ERROR_ACTION (AANSTATE+AANRULE) -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < AANSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** AANSTATE <= N < AANSTATE+AANRULE Reduce by rule N-AANSTATE. -** -** N == AANSTATE+AANRULE A syntax error has occurred. -** -** N == AANSTATE+AANRULE+1 The parser accepts its input. -** -** N == AANSTATE+AANRULE+2 No such action. Denotes unused -** slots in the aa_action[] table. -** -** The action table is constructed as a single large table named aa_action[]. -** Given state S and lookahead X, the action is computed as -** -** aa_action[ aa_shift_ofst[S] + X ] -** -** If the index value aa_shift_ofst[S]+X is out of range or if the value -** aa_lookahead[aa_shift_ofst[S]+X] is not equal to X or if aa_shift_ofst[S] -** is equal to AA_SHIFT_USE_DFLT, it means that the action is not in the table -** and that aa_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the aa_reduce_ofst[] array is used in place of -** the aa_shift_ofst[] array and AA_REDUCE_USE_DFLT is used in place of -** AA_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** aa_action[] A single table containing all actions. -** aa_lookahead[] A table containing the lookahead for each entry in -** aa_action. Used to detect hash collisions. -** aa_shift_ofst[] For each state, the offset into aa_action for -** shifting terminals. -** aa_reduce_ofst[] For each state, the offset into aa_action for -** shifting non-terminals after a reduce. -** aa_default[] Default action for each state. -*/ -static AAACTIONTYPE aa_action[] = { - /* 0 */ 4, 28, 15, 38, 12, 14, 16, 18, 20, 21, - /* 10 */ 22, 23, 24, 4, 31, 4, 28, 15, 40, 12, - /* 20 */ 30, 16, 18, 20, 21, 22, 23, 24, 3, 31, - /* 30 */ 4, 17, 15, 6, 19, 35, 16, 18, 20, 21, - /* 40 */ 22, 23, 24, 5, 31, 15, 7, 27, 11, 16, - /* 50 */ 54, 54, 15, 25, 27, 11, 16, 15, 32, 27, - /* 60 */ 11, 16, 66, 1, 2, 39, 41, 15, 4, 10, - /* 70 */ 11, 16, 15, 9, 9, 37, 16, 8, 13, 36, - /* 80 */ 9, 29, 34, 54, 54, 54, 54, 54, 26, 54, - /* 90 */ 54, 54, 54, 54, 54, 54, 33, -}; -static AACODETYPE aa_lookahead[] = { - /* 0 */ 2, 3, 22, 5, 6, 25, 26, 9, 10, 11, - /* 10 */ 12, 13, 14, 2, 16, 2, 3, 22, 0, 6, - /* 20 */ 25, 26, 9, 10, 11, 12, 13, 14, 22, 16, - /* 30 */ 2, 3, 22, 4, 6, 25, 26, 9, 10, 11, - /* 40 */ 12, 13, 14, 3, 16, 22, 23, 24, 25, 26, - /* 50 */ 27, 27, 22, 23, 24, 25, 26, 22, 23, 24, - /* 60 */ 25, 26, 19, 20, 21, 22, 0, 22, 2, 24, - /* 70 */ 25, 26, 22, 1, 1, 25, 26, 5, 7, 8, - /* 80 */ 1, 7, 8, 27, 27, 27, 27, 27, 15, 27, - /* 90 */ 27, 27, 27, 27, 27, 27, 17, -}; -#define AA_SHIFT_USE_DFLT (-3) -static signed char aa_shift_ofst[] = { - /* 0 */ 11, 18, 66, -3, 40, 29, -2, 72, -3, 13, - /* 10 */ -3, -3, 71, 28, -3, -3, -3, -3, -3, -3, - /* 20 */ -3, -3, -3, -3, 13, 73, -3, -3, 74, 28, - /* 30 */ -3, 13, 79, -3, 28, -3, 28, -3, -3, -3, -}; -#define AA_REDUCE_USE_DFLT (-21) -static signed char aa_reduce_ofst[] = { - /* 0 */ 43, -21, 6, -21, -21, -21, 23, -21, -21, 45, - /* 10 */ -21, -21, -21, -20, -21, -21, -21, -21, -21, -21, - /* 20 */ -21, -21, -21, -21, 30, -21, -21, -21, -21, -5, - /* 30 */ -21, 35, -21, -21, 10, -21, 50, -21, -21, -21, -}; -static AAACTIONTYPE aa_default[] = { - /* 0 */ 65, 65, 65, 42, 65, 46, 65, 65, 44, 65, - /* 10 */ 47, 49, 58, 65, 50, 54, 55, 56, 57, 58, - /* 20 */ 59, 60, 61, 62, 65, 65, 63, 48, 56, 65, - /* 30 */ 52, 65, 65, 64, 65, 53, 65, 51, 45, 43, -}; -#define AA_SZ_ACTTAB (sizeof(aa_action)/sizeof(aa_action[0])) -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammer, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef AAFALLBACK -static const AACODETYPE aaFallback[] = { -}; -#endif /* AAFALLBACK */ -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct aaStackEntry { - int stateno; /* The state-number */ - int major; /* The major token value. This is the code - ** number for the token at this stack level */ - AAMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct aaStackEntry aaStackEntry; -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct aaParser { - int aaidx; /* Index of top element in stack */ - int aaerrcnt; /* Shifts left before out of the error */ - phannot_ARG_SDECL /* A place to hold %extra_argument */ - aaStackEntry aastack[AASTACKDEPTH]; /* The parser's stack */ -}; -typedef struct aaParser aaParser; -#ifndef NDEBUG -static FILE *aaTraceFILE = 0; -static char *aaTracePrompt = 0; -#endif /* NDEBUG */ +ZEPHIR_INIT_CLASS(Phalcon_Escaper_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Escaper, Exception, phalcon, escaper_exception, phalcon_exception_ce, NULL, 0); + + return SUCCESS; -#ifndef NDEBUG -static void phannot_Trace(FILE *TraceFILE, char *zTracePrompt){ - aaTraceFILE = TraceFILE; - aaTracePrompt = zTracePrompt; - if( aaTraceFILE==0 ) aaTracePrompt = 0; - else if( aaTracePrompt==0 ) aaTraceFILE = 0; } -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *aaTokenName[] = { - "$", "COMMA", "AT", "IDENTIFIER", - "PARENTHESES_OPEN", "PARENTHESES_CLOSE", "STRING", "EQUALS", - "COLON", "INTEGER", "DOUBLE", "NULL", - "FALSE", "TRUE", "BRACKET_OPEN", "BRACKET_CLOSE", - "SBRACKET_OPEN", "SBRACKET_CLOSE", "error", "program", - "annotation_language", "annotation_list", "annotation", "argument_list", - "argument_item", "expr", "array", -}; -#endif /* NDEBUG */ -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *aaRuleName[] = { - /* 0 */ "program ::= annotation_language", - /* 1 */ "annotation_language ::= annotation_list", - /* 2 */ "annotation_list ::= annotation_list annotation", - /* 3 */ "annotation_list ::= annotation", - /* 4 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN argument_list PARENTHESES_CLOSE", - /* 5 */ "annotation ::= AT IDENTIFIER PARENTHESES_OPEN PARENTHESES_CLOSE", - /* 6 */ "annotation ::= AT IDENTIFIER", - /* 7 */ "argument_list ::= argument_list COMMA argument_item", - /* 8 */ "argument_list ::= argument_item", - /* 9 */ "argument_item ::= expr", - /* 10 */ "argument_item ::= STRING EQUALS expr", - /* 11 */ "argument_item ::= STRING COLON expr", - /* 12 */ "argument_item ::= IDENTIFIER EQUALS expr", - /* 13 */ "argument_item ::= IDENTIFIER COLON expr", - /* 14 */ "expr ::= annotation", - /* 15 */ "expr ::= array", - /* 16 */ "expr ::= IDENTIFIER", - /* 17 */ "expr ::= INTEGER", - /* 18 */ "expr ::= STRING", - /* 19 */ "expr ::= DOUBLE", - /* 20 */ "expr ::= NULL", - /* 21 */ "expr ::= FALSE", - /* 22 */ "expr ::= TRUE", - /* 23 */ "array ::= BRACKET_OPEN argument_list BRACKET_CLOSE", - /* 24 */ "array ::= SBRACKET_OPEN argument_list SBRACKET_CLOSE", -}; -#endif /* NDEBUG */ -const char *phannot_TokenName(int tokenType){ -#ifndef NDEBUG - if( tokenType>0 && tokenType<(sizeof(aaTokenName)/sizeof(aaTokenName[0])) ){ - return aaTokenName[tokenType]; - }else{ - return "Unknown"; - } -#else - return ""; + +#ifdef HAVE_CONFIG_H #endif -} -void *phannot_Alloc(void *(*mallocProc)(size_t)){ - aaParser *pParser; - pParser = (aaParser*)(*mallocProc)( (size_t)sizeof(aaParser) ); - if( pParser ){ - pParser->aaidx = -1; - } - return pParser; -} -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "aamajor" is the symbol code, and "aapminor" is a pointer to -** the value. -*/ -static void aa_destructor(AACODETYPE aamajor, AAMINORTYPE *aapminor){ - switch( aamajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: -// 67 "parser.php7.lemon" -{ - if ((aapminor->aa0)) { - if ((aapminor->aa0)->free_flag) { - efree((aapminor->aa0)->token); - } - efree((aapminor->aa0)); - } -} -// 380 "parser.php7.c" - break; - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: -// 80 "parser.php7.lemon" -{ - zval_ptr_dtor(&(aapminor->aa8)); -} -// 392 "parser.php7.c" - break; - default: break; /* If no destructor action specified: do nothing */ - } -} -static int aa_pop_parser_stack(aaParser *pParser){ - AACODETYPE aamajor; - aaStackEntry *aatos = &pParser->aastack[pParser->aaidx]; - if( pParser->aaidx<0 ) return 0; -#ifndef NDEBUG - if( aaTraceFILE && pParser->aaidx>=0 ){ - fprintf(aaTraceFILE,"%sPopping %s\n", - aaTracePrompt, - aaTokenName[aatos->major]); - } -#endif - aamajor = aatos->major; - aa_destructor( aamajor, &aatos->minor); - pParser->aaidx--; - return aamajor; -} -static void phannot_Free( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - aaParser *pParser = (aaParser*)p; - if( pParser==0 ) return; - while( pParser->aaidx>=0 ) aa_pop_parser_stack(pParser); - (*freeProc)((void*)pParser); +ZEPHIR_INIT_CLASS(Phalcon_Di_AbstractInjectionAware) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Di, AbstractInjectionAware, phalcon, di_abstractinjectionaware, phalcon_di_abstractinjectionaware_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + + zend_declare_property_null(phalcon_di_abstractinjectionaware_ce, SL("container"), ZEND_ACC_PROTECTED); + + zend_class_implements(phalcon_di_abstractinjectionaware_ce, 1, phalcon_di_injectionawareinterface_ce); + return SUCCESS; + } -static int aa_find_shift_action( - aaParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->aastack[pParser->aaidx].stateno; - - /* if( pParser->aaidx<0 ) return AA_NO_ACTION; */ - i = aa_shift_ofst[stateno]; - if( i==AA_SHIFT_USE_DFLT ){ - return aa_default[stateno]; - } - if( iLookAhead==AANOCODE ){ - return AA_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ -#ifdef AAFALLBACK - int iFallback; /* Fallback token */ - if( iLookAhead %s\n", - aaTracePrompt, aaTokenName[iLookAhead], aaTokenName[iFallback]); - } -#endif - return aa_find_shift_action(pParser, iFallback); - } -#endif - return aa_default[stateno]; - }else{ - return aa_action[i]; - } +static PHP_METHOD(Phalcon_Di_AbstractInjectionAware, getDI) { + + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "container"); + } -static int aa_find_reduce_action( - aaParser *pParser, /* The parser */ - int iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->aastack[pParser->aaidx].stateno; - - i = aa_reduce_ofst[stateno]; - if( i==AA_REDUCE_USE_DFLT ){ - return aa_default[stateno]; - } - if( iLookAhead==AANOCODE ){ - return AA_NO_ACTION; - } - i += iLookAhead; - if( i<0 || i>=AA_SZ_ACTTAB || aa_lookahead[i]!=iLookAhead ){ - return aa_default[stateno]; - }else{ - return aa_action[i]; - } +static PHP_METHOD(Phalcon_Di_AbstractInjectionAware, setDI) { + + zval *container, container_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&container_sub); + + zephir_fetch_params_without_memory_grow(1, 0, &container); + + + + zephir_update_property_zval(this_ptr, SL("container"), container); + } -static void aa_shift( - aaParser *aapParser, /* The parser to be shifted */ - int aaNewState, /* The new state to shift in */ - int aaMajor, /* The major token to shift in */ - AAMINORTYPE *aapMinor /* Pointer ot the minor token to shift in */ -){ - aaStackEntry *aatos; - aapParser->aaidx++; - if( aapParser->aaidx>=AASTACKDEPTH ){ - phannot_ARG_FETCH; - aapParser->aaidx--; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sStack Overflow!\n",aaTracePrompt); - } -#endif - while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument var */ - return; - } - aatos = &aapParser->aastack[aapParser->aaidx]; - aatos->stateno = aaNewState; - aatos->major = aaMajor; - aatos->minor = *aapMinor; -#ifndef NDEBUG - if( aaTraceFILE && aapParser->aaidx>0 ){ - int i; - fprintf(aaTraceFILE,"%sShift %d\n",aaTracePrompt,aaNewState); - fprintf(aaTraceFILE,"%sStack:",aaTracePrompt); - for(i=1; i<=aapParser->aaidx; i++) - fprintf(aaTraceFILE," %s",aaTokenName[aapParser->aastack[i].major]); - fprintf(aaTraceFILE,"\n"); - } + + + +#ifdef HAVE_CONFIG_H #endif -} -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static struct { - AACODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} aaRuleInfo[] = { - { 19, 1 }, - { 20, 1 }, - { 21, 2 }, - { 21, 1 }, - { 22, 5 }, - { 22, 4 }, - { 22, 2 }, - { 23, 3 }, - { 23, 1 }, - { 24, 1 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 24, 3 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 25, 1 }, - { 26, 3 }, - { 26, 3 }, -}; -static void aa_accept(aaParser*); /* Forward Declaration */ -static void aa_reduce( - aaParser *aapParser, /* The parser */ - int aaruleno /* Number of the rule by which to reduce */ -){ - int aagoto; /* The next state */ - int aaact; /* The next action */ - AAMINORTYPE aagotominor; /* The LHS of the rule reduced */ - aaStackEntry *aamsp; /* The top of the parser's stack */ - int aasize; /* Amount to pop the stack */ - phannot_ARG_FETCH; - aamsp = &aapParser->aastack[aapParser->aaidx]; -#ifndef NDEBUG - if( aaTraceFILE && aaruleno>=0 - && aaruleno - ** { ... } // User supplied code - ** // - ** break; - */ - case 0: -// 76 "parser.php7.lemon" -{ - ZVAL_ZVAL(&status->ret, &aamsp[0].minor.aa8, 1, 1); -} -// 634 "parser.php7.c" - break; - case 1: - case 14: - case 15: -// 84 "parser.php7.lemon" -{ - aagotominor.aa8 = aamsp[0].minor.aa8; -} -// 643 "parser.php7.c" - break; - case 2: -// 92 "parser.php7.lemon" -{ - phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-1].minor.aa8, &aamsp[0].minor.aa8); -} -// 650 "parser.php7.c" - break; - case 3: - case 8: -// 96 "parser.php7.lemon" -{ - phannot_ret_zval_list(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); -} -// 658 "parser.php7.c" - break; - case 4: -// 104 "parser.php7.lemon" -{ - phannot_ret_annotation(&aagotominor.aa8, aamsp[-3].minor.aa0, &aamsp[-1].minor.aa8, status->scanner_state); - aa_destructor(2,&aamsp[-4].minor); - aa_destructor(4,&aamsp[-2].minor); - aa_destructor(5,&aamsp[0].minor); -} -// 668 "parser.php7.c" - break; - case 5: -// 108 "parser.php7.lemon" -{ - phannot_ret_annotation(&aagotominor.aa8, aamsp[-2].minor.aa0, NULL, status->scanner_state); - aa_destructor(2,&aamsp[-3].minor); - aa_destructor(4,&aamsp[-1].minor); - aa_destructor(5,&aamsp[0].minor); -} -// 678 "parser.php7.c" - break; - case 6: -// 112 "parser.php7.lemon" -{ - phannot_ret_annotation(&aagotominor.aa8, aamsp[0].minor.aa0, NULL, status->scanner_state); - aa_destructor(2,&aamsp[-1].minor); -} -// 686 "parser.php7.c" - break; - case 7: -// 120 "parser.php7.lemon" -{ - phannot_ret_zval_list(&aagotominor.aa8, &aamsp[-2].minor.aa8, &aamsp[0].minor.aa8); - aa_destructor(1,&aamsp[-1].minor); -} -// 694 "parser.php7.c" - break; - case 9: -// 132 "parser.php7.lemon" -{ - phannot_ret_named_item(&aagotominor.aa8, NULL, &aamsp[0].minor.aa8); -} -// 701 "parser.php7.c" - break; - case 10: - case 12: -// 136 "parser.php7.lemon" -{ - phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); - aa_destructor(7,&aamsp[-1].minor); -} -// 710 "parser.php7.c" - break; - case 11: - case 13: -// 140 "parser.php7.lemon" -{ - phannot_ret_named_item(&aagotominor.aa8, aamsp[-2].minor.aa0, &aamsp[0].minor.aa8); - aa_destructor(8,&aamsp[-1].minor); -} -// 719 "parser.php7.c" - break; - case 16: -// 164 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_IDENTIFIER, aamsp[0].minor.aa0); -} -// 726 "parser.php7.c" - break; - case 17: -// 168 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_INTEGER, aamsp[0].minor.aa0); -} -// 733 "parser.php7.c" - break; - case 18: -// 172 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_STRING, aamsp[0].minor.aa0); -} -// 740 "parser.php7.c" - break; - case 19: -// 176 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_DOUBLE, aamsp[0].minor.aa0); -} -// 747 "parser.php7.c" - break; - case 20: -// 180 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_NULL, NULL); - aa_destructor(11,&aamsp[0].minor); -} -// 755 "parser.php7.c" - break; - case 21: -// 184 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_FALSE, NULL); - aa_destructor(12,&aamsp[0].minor); -} -// 763 "parser.php7.c" - break; - case 22: -// 188 "parser.php7.lemon" -{ - phannot_ret_literal_zval(&aagotominor.aa8, PHANNOT_T_TRUE, NULL); - aa_destructor(13,&aamsp[0].minor); -} -// 771 "parser.php7.c" - break; - case 23: -// 192 "parser.php7.lemon" -{ - phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); - aa_destructor(14,&aamsp[-2].minor); - aa_destructor(15,&aamsp[0].minor); -} -// 780 "parser.php7.c" - break; - case 24: -// 196 "parser.php7.lemon" -{ - phannot_ret_array(&aagotominor.aa8, &aamsp[-1].minor.aa8); - aa_destructor(16,&aamsp[-2].minor); - aa_destructor(17,&aamsp[0].minor); -} -// 789 "parser.php7.c" - break; - }; - aagoto = aaRuleInfo[aaruleno].lhs; - aasize = aaRuleInfo[aaruleno].nrhs; - aapParser->aaidx -= aasize; - aaact = aa_find_reduce_action(aapParser,aagoto); - if( aaact < AANSTATE ){ - aa_shift(aapParser,aaact,aagoto,&aagotominor); - }else if( aaact == AANSTATE + AANRULE + 1 ){ - aa_accept(aapParser); - } + +ZEPHIR_INIT_CLASS(Phalcon_Di_DiInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Di, DiInterface, phalcon, di_diinterface, phalcon_di_diinterface_method_entry); + + zend_class_implements(phalcon_di_diinterface_ce, 1, zend_ce_arrayaccess); + return SUCCESS; + } -static void aa_parse_failed( - aaParser *aapParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sFail!\n",aaTracePrompt); - } +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, attempt); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, get); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, getDefault); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, getRaw); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, getService); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, getServices); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, getShared); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, has); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, remove); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, reset); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, set); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, setDefault); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, setService); + +ZEPHIR_DOC_METHOD(Phalcon_Di_DiInterface, setShared); + + + + +#ifdef HAVE_CONFIG_H #endif - while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} -static void aa_syntax_error( - aaParser *aapParser, /* The parser */ - int aamajor, /* The major type of the error token */ - AAMINORTYPE aaminor /* The minor type of the error token */ -){ - phannot_ARG_FETCH; -#define ATOKEN (aaminor.aa0) -// 22 "parser.php7.lemon" - if (status->scanner_state->start_length) { - char *token_name = NULL; - const phannot_token_names *tokens = phannot_tokens; - int active_token = status->scanner_state->active_token; - unsigned int near_length = status->scanner_state->start_length; - if (active_token) { - do { - if (tokens->code == active_token) { - token_name = tokens->name; - break; - } - ++tokens; - } while (tokens[0].code != 0); - } - if (!token_name) { - token_name = "UNKNOWN"; - } - if (near_length > 0) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), near to '%s' in %s on line %d", token_name, status->token->value, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, near to '%s' in %s on line %d", token_name, status->scanner_state->start, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - if (active_token != PHANNOT_T_IGNORE) { - if (status->token->value) { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s(%s), at the end of docblock in %s on line %d", token_name, status->token->value, status->scanner_state->active_file, status->scanner_state->active_line); - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected token %s, at the end of docblock in %s on line %d", token_name, status->scanner_state->active_file, status->scanner_state->active_line); - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF, at the end of docblock in %s on line %d", status->scanner_state->active_file, status->scanner_state->active_line); - } - } - } else { - spprintf(&status->syntax_error, 0, "Syntax error, unexpected EOF in %s", status->scanner_state->active_file); - } +ZEPHIR_INIT_CLASS(Phalcon_Di_Exception) { - status->status = PHANNOT_PARSING_FAILED; + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Di, Exception, phalcon, di_exception, phalcon_exception_ce, NULL, 0); + + return SUCCESS; -// 876 "parser.php7.c" - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ } -static void aa_accept( - aaParser *aapParser /* The parser */ -){ - phannot_ARG_FETCH; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sAccept!\n",aaTracePrompt); - } + + + +#ifdef HAVE_CONFIG_H #endif - while( aapParser->aaidx>=0 ) aa_pop_parser_stack(aapParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - phannot_ARG_STORE; /* Suppress warning about unused %extra_argument variable */ + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Di_FactoryDefault) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Di, FactoryDefault, phalcon, di_factorydefault, phalcon_di_ce, phalcon_di_factorydefault_method_entry, 0); + + return SUCCESS; + } -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "phannot_Alloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
    -**
  • A pointer to the parser (an opaque structure.) -**
  • The major token number. -**
  • The minor token number. -**
  • An option argument of a grammar-specified type. -**
-** -** Outputs: -** None. -*/ -static void phannot_( - void *aap, /* The parser */ - int aamajor, /* The major token code number */ - phannot_TOKENTYPE aaminor /* The value for the token */ - phannot_ARG_PDECL /* Optional %extra_argument parameter */ -){ - AAMINORTYPE aaminorunion; - int aaact; /* The parser action. */ - int aaendofinput; /* True if we are at the end of input */ - int aaerrorhit = 0; /* True if aamajor has invoked an error */ - aaParser *aapParser; /* The parser */ +static PHP_METHOD(Phalcon_Di_FactoryDefault, __construct) { - /* (re)initialize the parser, if necessary */ - aapParser = (aaParser*)aap; - if( aapParser->aaidx<0 ){ - if( aamajor==0 ) return; - aapParser->aaidx = 0; - aapParser->aaerrcnt = -1; - aapParser->aastack[0].stateno = 0; - aapParser->aastack[0].major = 0; - } - aaminorunion.aa0 = aaminor; - aaendofinput = (aamajor==0); - phannot_ARG_STORE; + zval _1; + zval filter, _2, _3, _4, _5; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; + zval *this_ptr = getThis(); -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sInput %s\n",aaTracePrompt,aaTokenName[aamajor]); - } -#endif + ZVAL_UNDEF(&filter); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_1); - do{ - aaact = aa_find_shift_action(aapParser,aamajor); - if( aaactaaerrcnt--; - if( aaendofinput && aapParser->aaidx>=0 ){ - aamajor = 0; - }else{ - aamajor = AANOCODE; - } - }else if( aaact < AANSTATE + AANRULE ){ - aa_reduce(aapParser,aaact-AANSTATE); - }else if( aaact == AA_ERROR_ACTION ){ - int aamx; -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sSyntax Error!\n",aaTracePrompt); - } -#endif -#ifdef AAERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( aapParser->aaerrcnt<0 ){ - aa_syntax_error(aapParser,aamajor,aaminorunion); - } - aamx = aapParser->aastack[aapParser->aaidx].major; - if( aamx==AAERRORSYMBOL || aaerrorhit ){ -#ifndef NDEBUG - if( aaTraceFILE ){ - fprintf(aaTraceFILE,"%sDiscard input token %s\n", - aaTracePrompt,aaTokenName[aamajor]); - } -#endif - aa_destructor(aamajor,&aaminorunion); - aamajor = AANOCODE; - }else{ - while( - aapParser->aaidx >= 0 && - aamx != AAERRORSYMBOL && - (aaact = aa_find_shift_action(aapParser,AAERRORSYMBOL)) >= AANSTATE - ){ - aa_pop_parser_stack(aapParser); - } - if( aapParser->aaidx < 0 || aamajor==0 ){ - aa_destructor(aamajor,&aaminorunion); - aa_parse_failed(aapParser); - aamajor = AANOCODE; - }else if( aamx!=AAERRORSYMBOL ){ - AAMINORTYPE u2; - u2.AAERRSYMDT = 0; - aa_shift(aapParser,aaact,AAERRORSYMBOL,&u2); - } - } - aapParser->aaerrcnt = 3; - aaerrorhit = 1; -#else /* AAERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( aapParser->aaerrcnt<=0 ){ - aa_syntax_error(aapParser,aamajor,aaminorunion); - } - aapParser->aaerrcnt = 3; - aa_destructor(aamajor,&aaminorunion); - if( aaendofinput ){ - aa_parse_failed(aapParser); - } - aamajor = AANOCODE; -#endif - }else{ - aa_accept(aapParser); - aamajor = AANOCODE; - } - }while( aamajor!=AANOCODE && aapParser->aaidx>=0 ); - return; -} -/* base.c - * This file is part of the Phalcon Framework. - * - * (c) Phalcon Team - * - * For the full copyright and license information, please view the - * LICENSE.txt file that was distributed with this source code. - */ + ZEPHIR_MM_GROW(); -const phannot_token_names phannot_tokens[] = -{ - { "INTEGER", PHANNOT_T_INTEGER }, - { "DOUBLE", PHANNOT_T_DOUBLE }, - { "STRING", PHANNOT_T_STRING }, - { "IDENTIFIER", PHANNOT_T_IDENTIFIER }, - { "@", PHANNOT_T_AT }, - { ",", PHANNOT_T_COMMA }, - { "=", PHANNOT_T_EQUALS }, - { ":", PHANNOT_T_COLON }, - { "(", PHANNOT_T_PARENTHESES_OPEN }, - { ")", PHANNOT_T_PARENTHESES_CLOSE }, - { "{", PHANNOT_T_BRACKET_OPEN }, - { "}", PHANNOT_T_BRACKET_CLOSE }, - { "[", PHANNOT_T_SBRACKET_OPEN }, - { "]", PHANNOT_T_SBRACKET_CLOSE }, - { "ARBITRARY TEXT", PHANNOT_T_ARBITRARY_TEXT }, - { NULL, 0 } -}; + ZEPHIR_CALL_PARENT(NULL, phalcon_di_factorydefault_ce, getThis(), "__construct", &_0, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&filter); + object_init_ex(&filter, phalcon_filter_filterfactory_ce); + if (zephir_has_constructor(&filter)) { + ZEPHIR_CALL_METHOD(NULL, &filter, "__construct", NULL, 0); + zephir_check_call_status(); + } + ZEPHIR_INIT_VAR(&_1); + zephir_create_array(&_1, 19, 0); + ZEPHIR_INIT_VAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Annotations\\Adapter\\Memory"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("annotations"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Assets\\Manager"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("assets"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Crypt"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("crypt"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Http\\Response\\Cookies"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("cookies"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Mvc\\Dispatcher"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("dispatcher"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Escaper"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("escaper"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Events\\Manager"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("eventsManager"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Flash\\Direct"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("flash"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Flash\\Session"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("flashSession"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_CALL_METHOD(&_5, &filter, "newinstance", NULL, 108); + zephir_check_call_status(); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_5, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("filter"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Manager"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("modelsManager"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\MetaData\\Memory"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("modelsMetadata"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Http\\Request"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("request"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Http\\Response"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("response"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Mvc\\Router"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("router"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Security"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("security"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Tag"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("tag"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Transaction\\Manager"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("transactionManager"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Url"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("url"), &_2, PH_COPY | PH_SEPARATE); + zephir_update_property_zval(this_ptr, SL("services"), &_1); + ZEPHIR_MM_RESTORE(); -static void *phannot_wrapper_alloc(size_t bytes){ - return emalloc(bytes); } -static void phannot_wrapper_free(void *pointer){ - efree(pointer); -} -static void phannot_parse_with_token(void* phannot_parser, int opcode, int parsercode, phannot_scanner_token *token, phannot_parser_status *parser_status){ - phannot_parser_token *pToken; - pToken = emalloc(sizeof(phannot_parser_token)); - pToken->opcode = opcode; - pToken->token = token->value; - pToken->token_len = token->len; - pToken->free_flag = 1; +#ifdef HAVE_CONFIG_H +#endif - phannot_(phannot_parser, parsercode, pToken, parser_status); - token->value = NULL; - token->len = 0; -} -static void phannot_scanner_error_msg(phannot_parser_status *parser_status, char **error_msg TSRMLS_DC){ - phannot_scanner_state *state = parser_status->scanner_state; - if (state->start) { - if (state->start_length > 16) { - spprintf(error_msg, 0, "Scanning error before '%.16s...' in %s on line %d", state->start, state->active_file, state->active_line); - } else { - spprintf(error_msg, 0, "Scanning error before '%s' in %s on line %d", state->start, state->active_file, state->active_line); - } - } else { - spprintf(error_msg, 0, "Scanning error near to EOF in %s", state->active_file); - } +ZEPHIR_INIT_CLASS(Phalcon_Di_Injectable) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Di, Injectable, phalcon, di_injectable, phalcon_di_injectable_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + + zend_declare_property_null(phalcon_di_injectable_ce, SL("container"), ZEND_ACC_PROTECTED); + + zend_class_implements(phalcon_di_injectable_ce, 1, phalcon_di_injectionawareinterface_ce); + return SUCCESS; + } -static int phannot_parse_annotations(zval *result, zval *comment, zval *file_path, zval *line TSRMLS_DC) { +static PHP_METHOD(Phalcon_Di_Injectable, __get) { - char *comment_str; - int comment_len; - char *file_path_str; - int line_num; + zval _2$$4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *propertyName_param = NULL, container, service, _0, _1$$4, _3$$4, _4$$4; + zval propertyName, _5; + zval *this_ptr = getThis(); - char *error_msg = NULL; + ZVAL_UNDEF(&propertyName); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&service); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_2$$4); - ZVAL_NULL(result); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &propertyName_param); - if (Z_TYPE_P(comment) == IS_STRING) { - comment_str = Z_STRVAL_P(comment); - comment_len = Z_STRLEN_P(comment); + if (UNEXPECTED(Z_TYPE_P(propertyName_param) != IS_STRING && Z_TYPE_P(propertyName_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'propertyName' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(propertyName_param) == IS_STRING)) { + zephir_get_strval(&propertyName, propertyName_param); } else { - comment_str = ""; - comment_len = 0; + ZEPHIR_INIT_VAR(&propertyName); + ZVAL_EMPTY_STRING(&propertyName); } - if (Z_TYPE_P(file_path) == IS_STRING) { - file_path_str = Z_STRVAL_P(file_path); - } else { - file_path_str = "eval"; + + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdi", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&container, &_0); + if (ZEPHIR_IS_STRING(&propertyName, "di")) { + zephir_update_property_zval(this_ptr, SL("di"), &container); + RETURN_CCTOR(&container); + } + if (ZEPHIR_IS_STRING(&propertyName, "persistent")) { + ZEPHIR_INIT_VAR(&_2$$4); + zephir_create_array(&_2$$4, 1, 0); + ZEPHIR_INIT_VAR(&_3$$4); + zephir_get_class(&_3$$4, this_ptr, 0); + zephir_array_fast_append(&_2$$4, &_3$$4); + ZEPHIR_INIT_NVAR(&_3$$4); + ZVAL_STRING(&_3$$4, "sessionBag"); + ZEPHIR_CALL_METHOD(&_1$$4, &container, "get", NULL, 0, &_3$$4, &_2$$4); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, SL("persistent"), &_1$$4); + ZEPHIR_OBS_VAR(&_4$$4); + zephir_read_property(&_4$$4, this_ptr, SL("persistent"), PH_NOISY_CC); + RETURN_CCTOR(&_4$$4); + } + ZEPHIR_CALL_METHOD(&_0, &container, "has", NULL, 0, &propertyName); + zephir_check_call_status(); + if (zephir_is_true(&_0)) { + ZEPHIR_CALL_METHOD(&service, &container, "getshared", NULL, 0, &propertyName); + zephir_check_call_status(); + zephir_update_property_zval_zval(this_ptr, &propertyName, &service); + RETURN_CCTOR(&service); } + ZEPHIR_INIT_VAR(&_5); + ZEPHIR_CONCAT_SV(&_5, "Access to undefined property ", &propertyName); + ZEPHIR_CALL_FUNCTION(NULL, "trigger_error", NULL, 5, &_5); + zephir_check_call_status(); + RETURN_MM_NULL(); - if (Z_TYPE_P(line) == IS_LONG) { - line_num = Z_LVAL_P(line); +} + +static PHP_METHOD(Phalcon_Di_Injectable, __isset) { + + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, _0; + zval name; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_0); + + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &name_param); + + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - line_num = 0; + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); } - if (phannot_internal_parse_annotations(&result, comment_str, comment_len, file_path_str, line_num, &error_msg TSRMLS_CC) == FAILURE) { - if (likely(error_msg != NULL)) { - zephir_throw_exception_string(phalcon_annotations_exception_ce, error_msg, strlen(error_msg) TSRMLS_CC); - efree(error_msg); - } else { - zephir_throw_exception_string(phalcon_annotations_exception_ce, SL("There was an error parsing annotation") TSRMLS_CC); - } - return FAILURE; - } + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getdi", NULL, 0); + zephir_check_call_status(); + ZEPHIR_RETURN_CALL_METHOD(&_0, "has", NULL, 0, &name); + zephir_check_call_status(); + RETURN_MM(); - return SUCCESS; } -static void phannot_remove_comment_separators(char **ret, int *ret_len, const char *comment, int length, int *start_lines) -{ - char ch; - int start_mode = 1, j, i, open_parentheses; - smart_str processed_str = {0}; +static PHP_METHOD(Phalcon_Di_Injectable, getDI) { - (*start_lines) = 0; + zval container, _0, _2$$4, _3$$4, _5$$4; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_1 = NULL, *_4 = NULL; + zval *this_ptr = getThis(); - for (i = 0; i < length; i++) { + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&_3$$4); + ZVAL_UNDEF(&_5$$4); - ch = comment[i]; + ZEPHIR_MM_GROW(); - if (start_mode) { - if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { - continue; - } - start_mode = 0; + zephir_read_property(&_0, this_ptr, SL("container"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&container, &_0); + if (Z_TYPE_P(&container) != IS_OBJECT) { + ZEPHIR_CALL_CE_STATIC(&container, phalcon_di_ce, "getdefault", &_1, 0); + zephir_check_call_status(); + if (UNEXPECTED(Z_TYPE_P(&container) != IS_OBJECT)) { + ZEPHIR_INIT_VAR(&_2$$4); + object_init_ex(&_2$$4, phalcon_di_exception_ce); + ZEPHIR_INIT_VAR(&_5$$4); + ZVAL_STRING(&_5$$4, "internal services"); + ZEPHIR_CALL_CE_STATIC(&_3$$4, phalcon_di_exception_ce, "containerservicenotfound", &_4, 0, &_5$$4); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 6, &_3$$4); + zephir_check_call_status(); + zephir_throw_exception_debug(&_2$$4, "phalcon/Di/Injectable.zep", 124); + ZEPHIR_MM_RESTORE(); + return; } + } + RETURN_CCTOR(&container); - if (ch == '@') { +} - smart_str_appendc(&processed_str, ch); - i++; +static PHP_METHOD(Phalcon_Di_Injectable, setDI) { - open_parentheses = 0; - for (j = i; j < length; j++) { + zval *container, container_sub; + zval *this_ptr = getThis(); - ch = comment[j]; + ZVAL_UNDEF(&container_sub); - if (start_mode) { - if (ch == ' ' || ch == '*' || ch == '/' || ch == '\t' || ch == 11) { - continue; - } - start_mode = 0; - } + zephir_fetch_params_without_memory_grow(1, 0, &container); - if (open_parentheses == 0) { - if (isalnum(ch) || '_' == ch || '\\' == ch) { - smart_str_appendc(&processed_str, ch); - continue; - } - if (ch == '(') { - smart_str_appendc(&processed_str, ch); - open_parentheses++; - continue; - } + zephir_update_property_zval(this_ptr, SL("container"), container); - } else { +} - smart_str_appendc(&processed_str, ch); - if (ch == '(') { - open_parentheses++; - } else { - if (ch == ')') { - open_parentheses--; - } else { - if (ch == '\n') { - (*start_lines)++; - start_mode = 1; - } - } - } - if (open_parentheses > 0) { - continue; - } - } - i = j; - smart_str_appendc(&processed_str, ' '); - break; - } - } +#ifdef HAVE_CONFIG_H +#endif - if (ch == '\n') { - (*start_lines)++; - start_mode = 1; - } - } - smart_str_0(&processed_str); - if (processed_str.s) { - *ret = estrndup(ZSTR_VAL(processed_str.s), ZSTR_LEN(processed_str.s)); - *ret_len = ZSTR_LEN(processed_str.s); - smart_str_free(&processed_str); - } else { - *ret = NULL; - *ret_len = 0; - } -} -static int phannot_internal_parse_annotations(zval **result, const char *comment, int comment_len, const char *file_path, int line, char **error_msg TSRMLS_DC) -{ - phannot_scanner_state *state; - phannot_scanner_token token; - int start_lines; - int scanner_status, status = SUCCESS; - phannot_parser_status *parser_status = NULL; - void* phannot_parser; - char *processed_comment; - int processed_comment_len; - *error_msg = NULL; +ZEPHIR_INIT_CLASS(Phalcon_Di_InjectionAwareInterface) { - if (UNEXPECTED(!comment)) { - ZVAL_BOOL(*result, 0); - spprintf(error_msg, 0, "Empty annotation"); - return FAILURE; - } + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Di, InjectionAwareInterface, phalcon, di_injectionawareinterface, phalcon_di_injectionawareinterface_method_entry); - if (comment_len < 2) { - ZVAL_BOOL(*result, 0); - return SUCCESS; - } + return SUCCESS; - phannot_remove_comment_separators(&processed_comment, &processed_comment_len, comment, comment_len, &start_lines); +} - if (processed_comment_len < 2) { - ZVAL_BOOL(*result, 0); - if (processed_comment) { - efree(processed_comment); - } +ZEPHIR_DOC_METHOD(Phalcon_Di_InjectionAwareInterface, setDI); - return SUCCESS; - } +ZEPHIR_DOC_METHOD(Phalcon_Di_InjectionAwareInterface, getDI); - phannot_parser = phannot_Alloc(phannot_wrapper_alloc); - if (unlikely(!phannot_parser)) { - ZVAL_BOOL(*result, 0); - return FAILURE; - } - parser_status = emalloc(sizeof(phannot_parser_status) + sizeof(phannot_scanner_state)); - state = (phannot_scanner_state*)((char*)parser_status + sizeof(phannot_parser_status)); - parser_status->status = PHANNOT_PARSING_OK; - parser_status->scanner_state = state; - parser_status->token = &token; - parser_status->syntax_error = NULL; - state->active_token = 0; - state->start = processed_comment; - state->start_length = 0; - state->mode = PHANNOT_MODE_RAW; - state->active_file = file_path; +#ifdef HAVE_CONFIG_H +#endif - token.value = NULL; - token.len = 0; - if (line) { - state->active_line = line - start_lines; - } else { - state->active_line = 1; - } - state->end = state->start; - while(0 <= (scanner_status = phannot_get_token(state, &token))) { - state->active_token = token.opcode; +ZEPHIR_INIT_CLASS(Phalcon_Di_Service) { - state->start_length = processed_comment + processed_comment_len - state->start; + ZEPHIR_REGISTER_CLASS(Phalcon\\Di, Service, phalcon, di_service, phalcon_di_service_method_entry, 0); - switch (token.opcode) { + zend_declare_property_null(phalcon_di_service_ce, SL("definition"), ZEND_ACC_PROTECTED); - case PHANNOT_T_IGNORE: - break; + zend_declare_property_bool(phalcon_di_service_ce, SL("resolved"), 0, ZEND_ACC_PROTECTED); - case PHANNOT_T_AT: - phannot_(phannot_parser, PHANNOT_AT, NULL, parser_status); - break; - case PHANNOT_T_COMMA: - phannot_(phannot_parser, PHANNOT_COMMA, NULL, parser_status); - break; - case PHANNOT_T_EQUALS: - phannot_(phannot_parser, PHANNOT_EQUALS, NULL, parser_status); - break; - case PHANNOT_T_COLON: - phannot_(phannot_parser, PHANNOT_COLON, NULL, parser_status); - break; + zend_declare_property_bool(phalcon_di_service_ce, SL("shared"), 0, ZEND_ACC_PROTECTED); - case PHANNOT_T_PARENTHESES_OPEN: - phannot_(phannot_parser, PHANNOT_PARENTHESES_OPEN, NULL, parser_status); - break; - case PHANNOT_T_PARENTHESES_CLOSE: - phannot_(phannot_parser, PHANNOT_PARENTHESES_CLOSE, NULL, parser_status); - break; + zend_declare_property_null(phalcon_di_service_ce, SL("sharedInstance"), ZEND_ACC_PROTECTED); - case PHANNOT_T_BRACKET_OPEN: - phannot_(phannot_parser, PHANNOT_BRACKET_OPEN, NULL, parser_status); - break; - case PHANNOT_T_BRACKET_CLOSE: - phannot_(phannot_parser, PHANNOT_BRACKET_CLOSE, NULL, parser_status); - break; + zend_class_implements(phalcon_di_service_ce, 1, phalcon_di_serviceinterface_ce); + return SUCCESS; - case PHANNOT_T_SBRACKET_OPEN: - phannot_(phannot_parser, PHANNOT_SBRACKET_OPEN, NULL, parser_status); - break; - case PHANNOT_T_SBRACKET_CLOSE: - phannot_(phannot_parser, PHANNOT_SBRACKET_CLOSE, NULL, parser_status); - break; +} - case PHANNOT_T_NULL: - phannot_(phannot_parser, PHANNOT_NULL, NULL, parser_status); - break; - case PHANNOT_T_TRUE: - phannot_(phannot_parser, PHANNOT_TRUE, NULL, parser_status); - break; - case PHANNOT_T_FALSE: - phannot_(phannot_parser, PHANNOT_FALSE, NULL, parser_status); - break; +static PHP_METHOD(Phalcon_Di_Service, __construct) { - case PHANNOT_T_INTEGER: - phannot_parse_with_token(phannot_parser, PHANNOT_T_INTEGER, PHANNOT_INTEGER, &token, parser_status); - break; - case PHANNOT_T_DOUBLE: - phannot_parse_with_token(phannot_parser, PHANNOT_T_DOUBLE, PHANNOT_DOUBLE, &token, parser_status); - break; - case PHANNOT_T_STRING: - phannot_parse_with_token(phannot_parser, PHANNOT_T_STRING, PHANNOT_STRING, &token, parser_status); - break; - case PHANNOT_T_IDENTIFIER: - phannot_parse_with_token(phannot_parser, PHANNOT_T_IDENTIFIER, PHANNOT_IDENTIFIER, &token, parser_status); - break; - /*case PHANNOT_T_ARBITRARY_TEXT: - phannot_parse_with_token(phannot_parser, PHANNOT_T_ARBITRARY_TEXT, PHANNOT_ARBITRARY_TEXT, &token, parser_status); - break;*/ + zend_bool shared; + zval *definition, definition_sub, *shared_param = NULL, __$true, __$false; + zval *this_ptr = getThis(); - default: - parser_status->status = PHANNOT_PARSING_FAILED; - if (!*error_msg) { - spprintf(error_msg, 0, "Scanner: unknown opcode %d on in %s line %d", token.opcode, state->active_file, state->active_line); - } - break; - } + ZVAL_UNDEF(&definition_sub); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); - if (parser_status->status != PHANNOT_PARSING_OK) { - status = FAILURE; - break; - } + zephir_fetch_params_without_memory_grow(1, 1, &definition, &shared_param); - state->end = state->start; + if (!shared_param) { + shared = 0; + } else { + shared = zephir_get_boolval(shared_param); } - if (status != FAILURE) { - switch (scanner_status) { - - case PHANNOT_SCANNER_RETCODE_ERR: - case PHANNOT_SCANNER_RETCODE_IMPOSSIBLE: - if (!*error_msg) { - phannot_scanner_error_msg(parser_status, error_msg TSRMLS_CC); - } - status = FAILURE; - break; - default: - phannot_(phannot_parser, 0, NULL, parser_status); - } + zephir_update_property_zval(this_ptr, SL("definition"), definition); + if (shared) { + zephir_update_property_zval(this_ptr, SL("shared"), &__$true); + } else { + zephir_update_property_zval(this_ptr, SL("shared"), &__$false); } - state->active_token = 0; - state->start = NULL; +} - if (parser_status->status != PHANNOT_PARSING_OK) { - status = FAILURE; - if (parser_status->syntax_error) { - if (!*error_msg) { - *error_msg = parser_status->syntax_error; - } else { - efree(parser_status->syntax_error); - } - } - } +static PHP_METHOD(Phalcon_Di_Service, getDefinition) { - phannot_Free(phannot_parser, phannot_wrapper_free); + zval *this_ptr = getThis(); - if (status != FAILURE) { - if (parser_status->status == PHANNOT_PARSING_OK) { - ZVAL_ZVAL(*result, &parser_status->ret, 1, 1); - } - } - efree(processed_comment); - efree(parser_status); + RETURN_MEMBER(getThis(), "definition"); - return status; } +static PHP_METHOD(Phalcon_Di_Service, getParameter) { + + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *position_param = NULL, definition, arguments, parameter, _0; + zend_long position; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&definition); + ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(¶meter); + ZVAL_UNDEF(&_0); -#ifdef HAVE_CONFIG_H -#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &position_param); + + position = zephir_get_intval(position_param); + zephir_read_property(&_0, this_ptr, SL("definition"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&definition, &_0); + if (UNEXPECTED(Z_TYPE_P(&definition) != IS_ARRAY)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "Definition must be an array to obtain its parameters", "phalcon/Di/Service.zep", 76); + return; + } + if (zephir_array_isset_string_fetch(&arguments, &definition, SL("arguments"), 1)) { + if (zephir_array_isset_long_fetch(¶meter, &arguments, position, 1)) { + RETURN_CTOR(¶meter); + } + } + RETURN_MM_NULL(); +} +static PHP_METHOD(Phalcon_Di_Service, isResolved) { -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reader) { + zval *this_ptr = getThis(); - ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reader, phalcon, annotations_reader, phalcon_annotations_reader_method_entry, 0); - zend_class_implements(phalcon_annotations_reader_ce, 1, phalcon_annotations_readerinterface_ce); - return SUCCESS; + RETURN_MEMBER(getThis(), "resolved"); } -static PHP_METHOD(Phalcon_Annotations_Reader, parse) { +static PHP_METHOD(Phalcon_Di_Service, isShared) { - zval annotations; + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "shared"); + +} + +static PHP_METHOD(Phalcon_Di_Service, resolve) { + + zend_class_entry *_4$$14; + zend_bool found = 0, _2$$7; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS, line = 0; - zval *className_param = NULL, reflection, comment, properties, methods, property, method, classAnnotations, annotationsProperties, propertyAnnotations, annotationsMethods, methodAnnotations, _0$$3, _1$$3, *_2$$5, _3$$5, _4$$7, _5$$7, _6$$8, _7$$10, _8$$10, _9$$11, *_10$$13, _11$$13, _12$$15, _13$$15, _14$$16, _15$$18, _16$$18, _17$$19; - zval className; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *parameters = NULL, parameters_sub, *container = NULL, container_sub, __$true, __$false, __$null, shared, definition, sharedInstance, instance, builder, _0, _1$$3, _3$$14, _5$$21; zval *this_ptr = getThis(); - ZVAL_UNDEF(&className); - ZVAL_UNDEF(&reflection); - ZVAL_UNDEF(&comment); - ZVAL_UNDEF(&properties); - ZVAL_UNDEF(&methods); - ZVAL_UNDEF(&property); - ZVAL_UNDEF(&method); - ZVAL_UNDEF(&classAnnotations); - ZVAL_UNDEF(&annotationsProperties); - ZVAL_UNDEF(&propertyAnnotations); - ZVAL_UNDEF(&annotationsMethods); - ZVAL_UNDEF(&methodAnnotations); - ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(¶meters_sub); + ZVAL_UNDEF(&container_sub); + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&shared); + ZVAL_UNDEF(&definition); + ZVAL_UNDEF(&sharedInstance); + ZVAL_UNDEF(&instance); + ZVAL_UNDEF(&builder); + ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$5); - ZVAL_UNDEF(&_4$$7); - ZVAL_UNDEF(&_5$$7); - ZVAL_UNDEF(&_6$$8); - ZVAL_UNDEF(&_7$$10); - ZVAL_UNDEF(&_8$$10); - ZVAL_UNDEF(&_9$$11); - ZVAL_UNDEF(&_11$$13); - ZVAL_UNDEF(&_12$$15); - ZVAL_UNDEF(&_13$$15); - ZVAL_UNDEF(&_14$$16); - ZVAL_UNDEF(&_15$$18); - ZVAL_UNDEF(&_16$$18); - ZVAL_UNDEF(&_17$$19); - ZVAL_UNDEF(&annotations); + ZVAL_UNDEF(&_3$$14); + ZVAL_UNDEF(&_5$$21); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &className_param); + zephir_fetch_params(1, 0, 2, ¶meters, &container); - zephir_get_strval(&className, className_param); + if (!parameters) { + parameters = ¶meters_sub; + parameters = &__$null; + } + if (!container) { + container = &container_sub; + container = &__$null; + } - ZEPHIR_INIT_VAR(&annotations); - array_init(&annotations); - ZEPHIR_INIT_VAR(&reflection); - object_init_ex(&reflection, zephir_get_internal_ce(SL("reflectionclass"))); - ZEPHIR_CALL_METHOD(NULL, &reflection, "__construct", NULL, 148, &className); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&comment, &reflection, "getdoccomment", NULL, 149); - zephir_check_call_status(); - if (Z_TYPE_P(&comment) == IS_STRING) { - ZEPHIR_INIT_VAR(&classAnnotations); - ZEPHIR_CALL_METHOD(&_0$$3, &reflection, "getfilename", NULL, 150); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_1$$3, &reflection, "getstartline", NULL, 151); - zephir_check_call_status(); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&classAnnotations, &comment, &_0$$3, &_1$$3 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(&classAnnotations) == IS_ARRAY) { - zephir_array_update_string(&annotations, SL("class"), &classAnnotations, PH_COPY | PH_SEPARATE); + zephir_read_property(&_0, this_ptr, SL("shared"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&shared, &_0); + if (zephir_is_true(&shared)) { + zephir_read_property(&_1$$3, this_ptr, SL("sharedInstance"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&sharedInstance, &_1$$3); + if (Z_TYPE_P(&sharedInstance) != IS_NULL) { + RETURN_CCTOR(&sharedInstance); } } - ZEPHIR_CALL_METHOD(&properties, &reflection, "getproperties", NULL, 152); - zephir_check_call_status(); - if (zephir_fast_count_int(&properties)) { - line = 1; - ZEPHIR_INIT_VAR(&annotationsProperties); - array_init(&annotationsProperties); - zephir_is_iterable(&properties, 0, "phalcon/Annotations/Reader.zep", 92); - if (Z_TYPE_P(&properties) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&properties), _2$$5) - { - ZEPHIR_INIT_NVAR(&property); - ZVAL_COPY(&property, _2$$5); - ZEPHIR_CALL_METHOD(&comment, &property, "getdoccomment", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&comment) == IS_STRING) { - ZEPHIR_INIT_NVAR(&propertyAnnotations); - ZEPHIR_CALL_METHOD(&_4$$7, &reflection, "getfilename", NULL, 150); - zephir_check_call_status(); - ZVAL_LONG(&_5$$7, line); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&propertyAnnotations, &comment, &_4$$7, &_5$$7 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(&propertyAnnotations) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(&_6$$8); - zephir_read_property(&_6$$8, &property, SL("name"), PH_NOISY_CC); - zephir_array_update_zval(&annotationsProperties, &_6$$8, &propertyAnnotations, PH_COPY | PH_SEPARATE); - } - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &properties, "rewind", NULL, 0); + found = 1; + ZEPHIR_INIT_VAR(&instance); + ZVAL_NULL(&instance); + zephir_read_property(&_0, this_ptr, SL("definition"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&definition, &_0); + if (Z_TYPE_P(&definition) == IS_STRING) { + if (Z_TYPE_P(container) != IS_NULL) { + ZEPHIR_CALL_METHOD(&instance, container, "get", NULL, 0, &definition, parameters); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_3$$5, &properties, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_3$$5)) { - break; - } - ZEPHIR_CALL_METHOD(&property, &properties, "current", NULL, 0); + } else if (zephir_class_exists(&definition, 1)) { + _2$$7 = Z_TYPE_P(parameters) == IS_ARRAY; + if (_2$$7) { + _2$$7 = ((zephir_fast_count_int(parameters)) ? 1 : 0); + } + if (_2$$7) { + ZEPHIR_INIT_NVAR(&instance); + ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(&instance, &definition, parameters); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&comment, &property, "getdoccomment", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&comment) == IS_STRING) { - ZEPHIR_INIT_NVAR(&propertyAnnotations); - ZEPHIR_CALL_METHOD(&_7$$10, &reflection, "getfilename", NULL, 150); - zephir_check_call_status(); - ZVAL_LONG(&_8$$10, line); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&propertyAnnotations, &comment, &_7$$10, &_8$$10 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(&propertyAnnotations) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(&_9$$11); - zephir_read_property(&_9$$11, &property, SL("name"), PH_NOISY_CC); - zephir_array_update_zval(&annotationsProperties, &_9$$11, &propertyAnnotations, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_CALL_METHOD(NULL, &properties, "next", NULL, 0); + } else { + ZEPHIR_INIT_NVAR(&instance); + ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&instance, &definition); zephir_check_call_status(); } + } else { + found = 0; } - ZEPHIR_INIT_NVAR(&property); - if (zephir_fast_count_int(&annotationsProperties)) { - zephir_array_update_string(&annotations, SL("properties"), &annotationsProperties, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_CALL_METHOD(&methods, &reflection, "getmethods", NULL, 153); - zephir_check_call_status(); - if (zephir_fast_count_int(&methods)) { - ZEPHIR_INIT_VAR(&annotationsMethods); - array_init(&annotationsMethods); - zephir_is_iterable(&methods, 0, "phalcon/Annotations/Reader.zep", 127); - if (Z_TYPE_P(&methods) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&methods), _10$$13) - { - ZEPHIR_INIT_NVAR(&method); - ZVAL_COPY(&method, _10$$13); - ZEPHIR_CALL_METHOD(&comment, &method, "getdoccomment", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&comment) == IS_STRING) { - ZEPHIR_INIT_NVAR(&methodAnnotations); - ZEPHIR_CALL_METHOD(&_12$$15, &method, "getfilename", NULL, 0); + } else { + if (Z_TYPE_P(&definition) == IS_OBJECT) { + if (zephir_instance_of_ev(&definition, zend_ce_closure)) { + if (Z_TYPE_P(container) == IS_OBJECT) { + _4$$14 = zephir_fetch_class_str_ex(SL("Closure"), ZEND_FETCH_CLASS_AUTO); + ZEPHIR_CALL_CE_STATIC(&_3$$14, _4$$14, "bind", NULL, 0, &definition, container); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_13$$15, &method, "getstartline", NULL, 0); + ZEPHIR_CPY_WRT(&definition, &_3$$14); + } + if (Z_TYPE_P(parameters) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&instance); + ZEPHIR_CALL_USER_FUNC_ARRAY(&instance, &definition, parameters); zephir_check_call_status(); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&methodAnnotations, &comment, &_12$$15, &_13$$15 TSRMLS_CC); + } else { + ZEPHIR_INIT_NVAR(&instance); + ZEPHIR_CALL_USER_FUNC(&instance, &definition); zephir_check_call_status(); - if (Z_TYPE_P(&methodAnnotations) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(&_14$$16); - zephir_read_property(&_14$$16, &method, SL("name"), PH_NOISY_CC); - zephir_array_update_zval(&annotationsMethods, &_14$$16, &methodAnnotations, PH_COPY | PH_SEPARATE); - } } - } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CPY_WRT(&instance, &definition); + } } else { - ZEPHIR_CALL_METHOD(NULL, &methods, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_11$$13, &methods, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_11$$13)) { - break; + if (Z_TYPE_P(&definition) == IS_ARRAY) { + ZEPHIR_INIT_VAR(&builder); + object_init_ex(&builder, phalcon_di_service_builder_ce); + if (zephir_has_constructor(&builder)) { + ZEPHIR_CALL_METHOD(NULL, &builder, "__construct", NULL, 0); + zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(&method, &methods, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&comment, &method, "getdoccomment", NULL, 0); - zephir_check_call_status(); - if (Z_TYPE_P(&comment) == IS_STRING) { - ZEPHIR_INIT_NVAR(&methodAnnotations); - ZEPHIR_CALL_METHOD(&_15$$18, &method, "getfilename", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&_16$$18, &method, "getstartline", NULL, 0); - zephir_check_call_status(); - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(&methodAnnotations, &comment, &_15$$18, &_16$$18 TSRMLS_CC); - zephir_check_call_status(); - if (Z_TYPE_P(&methodAnnotations) == IS_ARRAY) { - ZEPHIR_OBS_NVAR(&_17$$19); - zephir_read_property(&_17$$19, &method, SL("name"), PH_NOISY_CC); - zephir_array_update_zval(&annotationsMethods, &_17$$19, &methodAnnotations, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_CALL_METHOD(NULL, &methods, "next", NULL, 0); + ZEPHIR_CALL_METHOD(&instance, &builder, "build", NULL, 222, container, &definition, parameters); zephir_check_call_status(); + } else { + found = 0; } } - ZEPHIR_INIT_NVAR(&method); - if (zephir_fast_count_int(&annotationsMethods)) { - zephir_array_update_string(&annotations, SL("methods"), &annotationsMethods, PH_COPY | PH_SEPARATE); - } } - RETURN_CTOR(&annotations); + if (UNEXPECTED(found == 0)) { + ZEPHIR_INIT_VAR(&_5$$21); + object_init_ex(&_5$$21, phalcon_di_exception_serviceresolutionexception_ce); + ZEPHIR_CALL_METHOD(NULL, &_5$$21, "__construct", NULL, 6); + zephir_check_call_status(); + zephir_throw_exception_debug(&_5$$21, "phalcon/Di/Service.zep", 199); + ZEPHIR_MM_RESTORE(); + return; + } + if (zephir_is_true(&shared)) { + zephir_update_property_zval(this_ptr, SL("sharedInstance"), &instance); + } + if (1) { + zephir_update_property_zval(this_ptr, SL("resolved"), &__$true); + } else { + zephir_update_property_zval(this_ptr, SL("resolved"), &__$false); + } + RETURN_CCTOR(&instance); } -static PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock) { +static PHP_METHOD(Phalcon_Di_Service, setDefinition) { + + zval *definition, definition_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&definition_sub); + + zephir_fetch_params_without_memory_grow(1, 0, &definition); + + + + zephir_update_property_zval(this_ptr, SL("definition"), definition); + +} + +static PHP_METHOD(Phalcon_Di_Service, setParameter) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *docBlock_param = NULL, *file = NULL, file_sub, *line = NULL, line_sub, __$null; - zval docBlock; + zval parameter; + zval *position_param = NULL, *parameter_param = NULL, definition, arguments, _0, _1$$5; + zend_long position; zval *this_ptr = getThis(); - ZVAL_UNDEF(&docBlock); - ZVAL_UNDEF(&file_sub); - ZVAL_UNDEF(&line_sub); - ZVAL_NULL(&__$null); + ZVAL_UNDEF(&definition); + ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$5); + ZVAL_UNDEF(¶meter); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 2, &docBlock_param, &file, &line); + zephir_fetch_params(1, 2, 0, &position_param, ¶meter_param); - zephir_get_strval(&docBlock, docBlock_param); - if (!file) { - file = &file_sub; - ZEPHIR_CPY_WRT(file, &__$null); - } else { - ZEPHIR_SEPARATE_PARAM(file); + position = zephir_get_intval(position_param); + ZEPHIR_OBS_COPY_OR_DUP(¶meter, parameter_param); + + + zephir_read_property(&_0, this_ptr, SL("definition"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&definition, &_0); + if (UNEXPECTED(Z_TYPE_P(&definition) != IS_ARRAY)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "Definition must be an array to update its parameters", "phalcon/Di/Service.zep", 234); + return; } - if (!line) { - line = &line_sub; - line = &__$null; + ZEPHIR_OBS_VAR(&arguments); + if (zephir_array_isset_string_fetch(&arguments, &definition, SL("arguments"), 0)) { + zephir_array_update_long(&arguments, position, ¶meter, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); + } else { + ZEPHIR_INIT_VAR(&_1$$5); + zephir_create_array(&_1$$5, 1, 0); + zephir_array_update_long(&_1$$5, position, ¶meter, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); + ZEPHIR_CPY_WRT(&arguments, &_1$$5); } + zephir_array_update_string(&definition, SL("arguments"), &arguments, PH_COPY | PH_SEPARATE); + zephir_update_property_zval(this_ptr, SL("definition"), &definition); + RETURN_THIS(); +} - if (Z_TYPE_P(file) != IS_STRING) { - ZEPHIR_INIT_NVAR(file); - ZVAL_STRING(file, "eval code"); +static PHP_METHOD(Phalcon_Di_Service, setShared) { + + zval *shared_param = NULL, __$true, __$false; + zend_bool shared; + zval *this_ptr = getThis(); + + ZVAL_BOOL(&__$true, 1); + ZVAL_BOOL(&__$false, 0); + + zephir_fetch_params_without_memory_grow(1, 0, &shared_param); + + shared = zephir_get_boolval(shared_param); + + + if (shared) { + zephir_update_property_zval(this_ptr, SL("shared"), &__$true); + } else { + zephir_update_property_zval(this_ptr, SL("shared"), &__$false); } - ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(return_value, &docBlock, file, line TSRMLS_CC); - zephir_check_call_status(); - RETURN_MM(); + +} + +static PHP_METHOD(Phalcon_Di_Service, setSharedInstance) { + + zval *sharedInstance, sharedInstance_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&sharedInstance_sub); + + zephir_fetch_params_without_memory_grow(1, 0, &sharedInstance); + + + + zephir_update_property_zval(this_ptr, SL("sharedInstance"), sharedInstance); } @@ -31990,1169 +31280,803 @@ static PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock) { -ZEPHIR_INIT_CLASS(Phalcon_Annotations_ReaderInterface) { +ZEPHIR_INIT_CLASS(Phalcon_Di_ServiceInterface) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Annotations, ReaderInterface, phalcon, annotations_readerinterface, phalcon_annotations_readerinterface_method_entry); + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Di, ServiceInterface, phalcon, di_serviceinterface, phalcon_di_serviceinterface_method_entry); return SUCCESS; } -ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parse); +ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, getDefinition); -ZEPHIR_DOC_METHOD(Phalcon_Annotations_ReaderInterface, parseDocBlock); +ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, getParameter); + +ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, isResolved); +ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, isShared); +ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, resolve); +ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, setDefinition); -#ifdef HAVE_CONFIG_H -#endif +ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, setParameter); +ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceInterface, setShared); -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reflection) { +#ifdef HAVE_CONFIG_H +#endif - ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Reflection, phalcon, annotations_reflection, phalcon_annotations_reflection_method_entry, 0); - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("classAnnotations"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("methodAnnotations"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("propertyAnnotations"), ZEND_ACC_PROTECTED); - zend_declare_property_null(phalcon_annotations_reflection_ce, SL("reflectionData"), ZEND_ACC_PROTECTED); +ZEPHIR_INIT_CLASS(Phalcon_Di_ServiceProviderInterface) { + + ZEPHIR_REGISTER_INTERFACE(Phalcon\\Di, ServiceProviderInterface, phalcon, di_serviceproviderinterface, phalcon_di_serviceproviderinterface_method_entry); return SUCCESS; } -static PHP_METHOD(Phalcon_Annotations_Reflection, __construct) { +ZEPHIR_DOC_METHOD(Phalcon_Di_ServiceProviderInterface, register); - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *reflectionData_param = NULL; - zval reflectionData; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&reflectionData); - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &reflectionData_param); - if (!reflectionData_param) { - ZEPHIR_INIT_VAR(&reflectionData); - array_init(&reflectionData); - } else { - zephir_get_arrval(&reflectionData, reflectionData_param); - } +#ifdef HAVE_CONFIG_H +#endif - zephir_update_property_zval(this_ptr, SL("reflectionData"), &reflectionData); - ZEPHIR_MM_RESTORE(); + + + +ZEPHIR_INIT_CLASS(Phalcon_Di_FactoryDefault_Cli) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Di\\FactoryDefault, Cli, phalcon, di_factorydefault_cli, phalcon_di_factorydefault_ce, phalcon_di_factorydefault_cli_method_entry, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations) { +static PHP_METHOD(Phalcon_Di_FactoryDefault_Cli, __construct) { + zval _1; + zval filter, _2, _3, _4, _5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval __$true, __$false, reflectionClass, _0, _1$$3, _2$$4; zend_long ZEPHIR_LAST_CALL_STATUS; + zephir_fcall_cache_entry *_0 = NULL; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&reflectionClass); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&filter); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); - zephir_read_property(&_0, this_ptr, SL("classAnnotations"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - zephir_read_property(&_1$$3, this_ptr, SL("reflectionData"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset_string_fetch(&reflectionClass, &_1$$3, SL("class"), 1)) { - ZEPHIR_INIT_VAR(&_2$$4); - object_init_ex(&_2$$4, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 47, &reflectionClass); - zephir_check_call_status(); - zephir_update_property_zval(this_ptr, SL("classAnnotations"), &_2$$4); - } else { - if (0) { - zephir_update_property_zval(this_ptr, SL("classAnnotations"), &__$true); - } else { - zephir_update_property_zval(this_ptr, SL("classAnnotations"), &__$false); - } - } + ZEPHIR_CALL_PARENT(NULL, phalcon_di_factorydefault_cli_ce, getThis(), "__construct", &_0, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&filter); + object_init_ex(&filter, phalcon_filter_filterfactory_ce); + if (zephir_has_constructor(&filter)) { + ZEPHIR_CALL_METHOD(NULL, &filter, "__construct", NULL, 0); + zephir_check_call_status(); } - RETURN_MM_MEMBER(getThis(), "classAnnotations"); + ZEPHIR_INIT_VAR(&_1); + zephir_create_array(&_1, 10, 0); + ZEPHIR_INIT_VAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_VAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Annotations\\Adapter\\Memory"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("annotations"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Cli\\Dispatcher"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("dispatcher"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Escaper"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("escaper"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Events\\Manager"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("eventsManager"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_CALL_METHOD(&_5, &filter, "newinstance", NULL, 108); + zephir_check_call_status(); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_5, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("filter"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Manager"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("modelsManager"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\MetaData\\Memory"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("modelsMetadata"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Cli\\Router"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("router"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Security"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("security"), &_2, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_NVAR(&_2); + object_init_ex(&_2, phalcon_di_service_ce); + ZEPHIR_INIT_NVAR(&_3); + ZVAL_STRING(&_3, "Phalcon\\Mvc\\Model\\Transaction\\Manager"); + ZVAL_BOOL(&_4, 1); + ZEPHIR_CALL_METHOD(NULL, &_2, "__construct", NULL, 92, &_3, &_4); + zephir_check_call_status(); + zephir_array_update_string(&_1, SL("transactionManager"), &_2, PH_COPY | PH_SEPARATE); + zephir_update_property_zval(this_ptr, SL("services"), &_1); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations) { - zend_string *_6$$5; - zend_ulong _5$$5; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval __$true, __$false, reflectionMethods, methodName, reflectionMethod, _0, _1$$3, _2$$5, *_3$$5, _4$$5, _7$$6, _9$$7; - zephir_fcall_cache_entry *_8 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&reflectionMethods); - ZVAL_UNDEF(&methodName); - ZVAL_UNDEF(&reflectionMethod); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$5); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_7$$6); - ZVAL_UNDEF(&_9$$7); - ZEPHIR_MM_GROW(); +#ifdef HAVE_CONFIG_H +#endif - zephir_read_property(&_0, this_ptr, SL("methodAnnotations"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_OBS_VAR(&reflectionMethods); - zephir_read_property(&_1$$3, this_ptr, SL("reflectionData"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset_string_fetch(&reflectionMethods, &_1$$3, SL("methods"), 0)) { - if (zephir_fast_count_int(&reflectionMethods)) { - ZEPHIR_INIT_VAR(&_2$$5); - array_init(&_2$$5); - zephir_update_property_zval(this_ptr, SL("methodAnnotations"), &_2$$5); - zephir_is_iterable(&reflectionMethods, 0, "phalcon/Annotations/Reflection.zep", 88); - if (Z_TYPE_P(&reflectionMethods) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&reflectionMethods), _5$$5, _6$$5, _3$$5) - { - ZEPHIR_INIT_NVAR(&methodName); - if (_6$$5 != NULL) { - ZVAL_STR_COPY(&methodName, _6$$5); - } else { - ZVAL_LONG(&methodName, _5$$5); - } - ZEPHIR_INIT_NVAR(&reflectionMethod); - ZVAL_COPY(&reflectionMethod, _3$$5); - ZEPHIR_INIT_NVAR(&_7$$6); - object_init_ex(&_7$$6, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, &_7$$6, "__construct", &_8, 47, &reflectionMethod); - zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("methodAnnotations"), &methodName, &_7$$6); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &reflectionMethods, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_4$$5, &reflectionMethods, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_4$$5)) { - break; - } - ZEPHIR_CALL_METHOD(&methodName, &reflectionMethods, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&reflectionMethod, &reflectionMethods, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_9$$7); - object_init_ex(&_9$$7, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, &_9$$7, "__construct", &_8, 47, &reflectionMethod); - zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("methodAnnotations"), &methodName, &_9$$7); - ZEPHIR_CALL_METHOD(NULL, &reflectionMethods, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&reflectionMethod); - ZEPHIR_INIT_NVAR(&methodName); - RETURN_MM_MEMBER(getThis(), "methodAnnotations"); - } - } - if (0) { - zephir_update_property_zval(this_ptr, SL("methodAnnotations"), &__$true); - } else { - zephir_update_property_zval(this_ptr, SL("methodAnnotations"), &__$false); - } - } - RETURN_MM_MEMBER(getThis(), "methodAnnotations"); + + + + +ZEPHIR_INIT_CLASS(Phalcon_Di_Service_Builder) { + + ZEPHIR_REGISTER_CLASS(Phalcon\\Di\\Service, Builder, phalcon, di_service_builder, phalcon_di_service_builder_method_entry, 0); + + return SUCCESS; } -static PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations) { +static PHP_METHOD(Phalcon_Di_Service_Builder, build) { - zend_string *_6$$5; - zend_ulong _5$$5; + zend_string *_4$$10, *_28$$25; + zend_ulong _3$$10, _27$$25; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval __$true, __$false, reflectionProperties, property, reflectionProperty, _0, _1$$3, _2$$5, *_3$$5, _4$$5, _7$$6, _9$$7; - zephir_fcall_cache_entry *_8 = NULL; + zephir_fcall_cache_entry *_7 = NULL, *_36 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; + zval definition; + zval *container, container_sub, *definition_param = NULL, *parameters = NULL, parameters_sub, __$null, className, arguments, paramCalls, methodPosition, method, methodName, methodCall, instance, propertyPosition, property, propertyName, propertyValue, _0$$8, *_1$$10, _2$$10, _5$$14, _6$$14, _8$$15, _9$$15, _10$$17, _11$$17, _12$$18, _13$$18, _14$$13, _15$$20, _16$$20, _17$$21, _18$$21, _19$$19, _24$$19, _20$$23, _21$$23, _22$$24, _23$$24, *_25$$25, _26$$25, _29$$29, _30$$29, _31$$30, _32$$30, _33$$31, _34$$31, _35$$28, _37$$33, _38$$33, _39$$34, _40$$34, _41$$35, _42$$35, _43$$32; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&reflectionProperties); + ZVAL_UNDEF(&container_sub); + ZVAL_UNDEF(¶meters_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&className); + ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(¶mCalls); + ZVAL_UNDEF(&methodPosition); + ZVAL_UNDEF(&method); + ZVAL_UNDEF(&methodName); + ZVAL_UNDEF(&methodCall); + ZVAL_UNDEF(&instance); + ZVAL_UNDEF(&propertyPosition); ZVAL_UNDEF(&property); - ZVAL_UNDEF(&reflectionProperty); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_2$$5); - ZVAL_UNDEF(&_4$$5); - ZVAL_UNDEF(&_7$$6); - ZVAL_UNDEF(&_9$$7); + ZVAL_UNDEF(&propertyName); + ZVAL_UNDEF(&propertyValue); + ZVAL_UNDEF(&_0$$8); + ZVAL_UNDEF(&_2$$10); + ZVAL_UNDEF(&_5$$14); + ZVAL_UNDEF(&_6$$14); + ZVAL_UNDEF(&_8$$15); + ZVAL_UNDEF(&_9$$15); + ZVAL_UNDEF(&_10$$17); + ZVAL_UNDEF(&_11$$17); + ZVAL_UNDEF(&_12$$18); + ZVAL_UNDEF(&_13$$18); + ZVAL_UNDEF(&_14$$13); + ZVAL_UNDEF(&_15$$20); + ZVAL_UNDEF(&_16$$20); + ZVAL_UNDEF(&_17$$21); + ZVAL_UNDEF(&_18$$21); + ZVAL_UNDEF(&_19$$19); + ZVAL_UNDEF(&_24$$19); + ZVAL_UNDEF(&_20$$23); + ZVAL_UNDEF(&_21$$23); + ZVAL_UNDEF(&_22$$24); + ZVAL_UNDEF(&_23$$24); + ZVAL_UNDEF(&_26$$25); + ZVAL_UNDEF(&_29$$29); + ZVAL_UNDEF(&_30$$29); + ZVAL_UNDEF(&_31$$30); + ZVAL_UNDEF(&_32$$30); + ZVAL_UNDEF(&_33$$31); + ZVAL_UNDEF(&_34$$31); + ZVAL_UNDEF(&_35$$28); + ZVAL_UNDEF(&_37$$33); + ZVAL_UNDEF(&_38$$33); + ZVAL_UNDEF(&_39$$34); + ZVAL_UNDEF(&_40$$34); + ZVAL_UNDEF(&_41$$35); + ZVAL_UNDEF(&_42$$35); + ZVAL_UNDEF(&_43$$32); + ZVAL_UNDEF(&definition); ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 1, &container, &definition_param, ¶meters); - zephir_read_property(&_0, this_ptr, SL("propertyAnnotations"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_OBS_VAR(&reflectionProperties); - zephir_read_property(&_1$$3, this_ptr, SL("reflectionData"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset_string_fetch(&reflectionProperties, &_1$$3, SL("properties"), 0)) { - if (zephir_fast_count_int(&reflectionProperties)) { - ZEPHIR_INIT_VAR(&_2$$5); - array_init(&_2$$5); - zephir_update_property_zval(this_ptr, SL("propertyAnnotations"), &_2$$5); - zephir_is_iterable(&reflectionProperties, 0, "phalcon/Annotations/Reflection.zep", 116); - if (Z_TYPE_P(&reflectionProperties) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&reflectionProperties), _5$$5, _6$$5, _3$$5) - { - ZEPHIR_INIT_NVAR(&property); - if (_6$$5 != NULL) { - ZVAL_STR_COPY(&property, _6$$5); - } else { - ZVAL_LONG(&property, _5$$5); - } - ZEPHIR_INIT_NVAR(&reflectionProperty); - ZVAL_COPY(&reflectionProperty, _3$$5); - ZEPHIR_INIT_NVAR(&_7$$6); - object_init_ex(&_7$$6, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, &_7$$6, "__construct", &_8, 47, &reflectionProperty); - zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("propertyAnnotations"), &property, &_7$$6); - } ZEND_HASH_FOREACH_END(); + ZEPHIR_OBS_COPY_OR_DUP(&definition, definition_param); + if (!parameters) { + parameters = ¶meters_sub; + parameters = &__$null; + } + + + ZEPHIR_OBS_VAR(&className); + if (UNEXPECTED(!(zephir_array_isset_string_fetch(&className, &definition, SL("className"), 0)))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "Invalid service definition. Missing 'className' parameter", "phalcon/Di/Service/Builder.zep", 41); + return; + } + if (Z_TYPE_P(parameters) == IS_ARRAY) { + if (zephir_fast_count_int(parameters)) { + ZEPHIR_INIT_VAR(&instance); + ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(&instance, &className, parameters); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(&instance); + ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&instance, &className); + zephir_check_call_status(); + } + } else { + ZEPHIR_OBS_VAR(&arguments); + if (zephir_array_isset_string_fetch(&arguments, &definition, SL("arguments"), 0)) { + ZEPHIR_CALL_METHOD(&_0$$8, this_ptr, "buildparameters", NULL, 223, container, &arguments); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&instance); + ZEPHIR_LAST_CALL_STATUS = zephir_create_instance_params(&instance, &className, &_0$$8); + zephir_check_call_status(); + } else { + ZEPHIR_INIT_NVAR(&instance); + ZEPHIR_LAST_CALL_STATUS = zephir_create_instance(&instance, &className); + zephir_check_call_status(); + } + } + ZEPHIR_OBS_VAR(¶mCalls); + if (zephir_array_isset_string_fetch(¶mCalls, &definition, SL("calls"), 0)) { + if (UNEXPECTED(Z_TYPE_P(&instance) != IS_OBJECT)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "The definition has setter injection parameters but the constructor didn't return an instance", "phalcon/Di/Service/Builder.zep", 83); + return; + } + if (UNEXPECTED(Z_TYPE_P(¶mCalls) != IS_ARRAY)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "Setter injection parameters must be an array", "phalcon/Di/Service/Builder.zep", 89); + return; + } + zephir_is_iterable(¶mCalls, 0, "phalcon/Di/Service/Builder.zep", 148); + if (Z_TYPE_P(¶mCalls) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(¶mCalls), _3$$10, _4$$10, _1$$10) + { + ZEPHIR_INIT_NVAR(&methodPosition); + if (_4$$10 != NULL) { + ZVAL_STR_COPY(&methodPosition, _4$$10); } else { - ZEPHIR_CALL_METHOD(NULL, &reflectionProperties, "rewind", NULL, 0); + ZVAL_LONG(&methodPosition, _3$$10); + } + ZEPHIR_INIT_NVAR(&method); + ZVAL_COPY(&method, _1$$10); + if (UNEXPECTED(Z_TYPE_P(&method) != IS_ARRAY)) { + ZEPHIR_INIT_NVAR(&_5$$14); + object_init_ex(&_5$$14, phalcon_di_exception_ce); + ZEPHIR_INIT_NVAR(&_6$$14); + ZEPHIR_CONCAT_SV(&_6$$14, "Method call must be an array on position ", &methodPosition); + ZEPHIR_CALL_METHOD(NULL, &_5$$14, "__construct", &_7, 6, &_6$$14); zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_4$$5, &reflectionProperties, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_4$$5)) { - break; - } - ZEPHIR_CALL_METHOD(&property, &reflectionProperties, "key", NULL, 0); + zephir_throw_exception_debug(&_5$$14, "phalcon/Di/Service/Builder.zep", 103); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_NVAR(&methodName); + if (UNEXPECTED(!(zephir_array_isset_string_fetch(&methodName, &method, SL("method"), 0)))) { + ZEPHIR_INIT_NVAR(&_8$$15); + object_init_ex(&_8$$15, phalcon_di_exception_ce); + ZEPHIR_INIT_NVAR(&_9$$15); + ZEPHIR_CONCAT_SV(&_9$$15, "The method name is required on position ", &methodPosition); + ZEPHIR_CALL_METHOD(NULL, &_8$$15, "__construct", &_7, 6, &_9$$15); + zephir_check_call_status(); + zephir_throw_exception_debug(&_8$$15, "phalcon/Di/Service/Builder.zep", 112); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_NVAR(&methodCall); + zephir_create_array(&methodCall, 2, 0); + zephir_array_fast_append(&methodCall, &instance); + zephir_array_fast_append(&methodCall, &methodName); + ZEPHIR_OBS_NVAR(&arguments); + if (zephir_array_isset_string_fetch(&arguments, &method, SL("arguments"), 0)) { + if (UNEXPECTED(Z_TYPE_P(&arguments) != IS_ARRAY)) { + ZEPHIR_INIT_NVAR(&_10$$17); + object_init_ex(&_10$$17, phalcon_di_exception_ce); + ZEPHIR_INIT_NVAR(&_11$$17); + ZEPHIR_CONCAT_SV(&_11$$17, "Call arguments must be an array ", &methodPosition); + ZEPHIR_CALL_METHOD(NULL, &_10$$17, "__construct", &_7, 6, &_11$$17); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&reflectionProperty, &reflectionProperties, "current", NULL, 0); + zephir_throw_exception_debug(&_10$$17, "phalcon/Di/Service/Builder.zep", 124); + ZEPHIR_MM_RESTORE(); + return; + } + if (zephir_fast_count_int(&arguments)) { + ZEPHIR_INIT_NVAR(&_12$$18); + ZEPHIR_CALL_METHOD(&_13$$18, this_ptr, "buildparameters", NULL, 223, container, &arguments); zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_9$$7); - object_init_ex(&_9$$7, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, &_9$$7, "__construct", &_8, 47, &reflectionProperty); - zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("propertyAnnotations"), &property, &_9$$7); - ZEPHIR_CALL_METHOD(NULL, &reflectionProperties, "next", NULL, 0); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_12$$18, &methodCall, &_13$$18); zephir_check_call_status(); + continue; } } - ZEPHIR_INIT_NVAR(&reflectionProperty); - ZEPHIR_INIT_NVAR(&property); - RETURN_MM_MEMBER(getThis(), "propertyAnnotations"); + ZEPHIR_INIT_NVAR(&_14$$13); + ZEPHIR_CALL_USER_FUNC(&_14$$13, &methodCall); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, ¶mCalls, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2$$10, ¶mCalls, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2$$10)) { + break; + } + ZEPHIR_CALL_METHOD(&methodPosition, ¶mCalls, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&method, ¶mCalls, "current", NULL, 0); + zephir_check_call_status(); + if (UNEXPECTED(Z_TYPE_P(&method) != IS_ARRAY)) { + ZEPHIR_INIT_NVAR(&_15$$20); + object_init_ex(&_15$$20, phalcon_di_exception_ce); + ZEPHIR_INIT_NVAR(&_16$$20); + ZEPHIR_CONCAT_SV(&_16$$20, "Method call must be an array on position ", &methodPosition); + ZEPHIR_CALL_METHOD(NULL, &_15$$20, "__construct", &_7, 6, &_16$$20); + zephir_check_call_status(); + zephir_throw_exception_debug(&_15$$20, "phalcon/Di/Service/Builder.zep", 103); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_NVAR(&methodName); + if (UNEXPECTED(!(zephir_array_isset_string_fetch(&methodName, &method, SL("method"), 0)))) { + ZEPHIR_INIT_NVAR(&_17$$21); + object_init_ex(&_17$$21, phalcon_di_exception_ce); + ZEPHIR_INIT_NVAR(&_18$$21); + ZEPHIR_CONCAT_SV(&_18$$21, "The method name is required on position ", &methodPosition); + ZEPHIR_CALL_METHOD(NULL, &_17$$21, "__construct", &_7, 6, &_18$$21); + zephir_check_call_status(); + zephir_throw_exception_debug(&_17$$21, "phalcon/Di/Service/Builder.zep", 112); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_INIT_NVAR(&_19$$19); + zephir_create_array(&_19$$19, 2, 0); + zephir_array_fast_append(&_19$$19, &instance); + zephir_array_fast_append(&_19$$19, &methodName); + ZEPHIR_CPY_WRT(&methodCall, &_19$$19); + ZEPHIR_OBS_NVAR(&arguments); + if (zephir_array_isset_string_fetch(&arguments, &method, SL("arguments"), 0)) { + if (UNEXPECTED(Z_TYPE_P(&arguments) != IS_ARRAY)) { + ZEPHIR_INIT_NVAR(&_20$$23); + object_init_ex(&_20$$23, phalcon_di_exception_ce); + ZEPHIR_INIT_NVAR(&_21$$23); + ZEPHIR_CONCAT_SV(&_21$$23, "Call arguments must be an array ", &methodPosition); + ZEPHIR_CALL_METHOD(NULL, &_20$$23, "__construct", &_7, 6, &_21$$23); + zephir_check_call_status(); + zephir_throw_exception_debug(&_20$$23, "phalcon/Di/Service/Builder.zep", 124); + ZEPHIR_MM_RESTORE(); + return; + } + if (zephir_fast_count_int(&arguments)) { + ZEPHIR_INIT_NVAR(&_22$$24); + ZEPHIR_CALL_METHOD(&_23$$24, this_ptr, "buildparameters", NULL, 223, container, &arguments); + zephir_check_call_status(); + ZEPHIR_CALL_USER_FUNC_ARRAY(&_22$$24, &methodCall, &_23$$24); + zephir_check_call_status(); + continue; + } + } + ZEPHIR_INIT_NVAR(&_24$$19); + ZEPHIR_CALL_USER_FUNC(&_24$$19, &methodCall); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, ¶mCalls, "next", NULL, 0); + zephir_check_call_status(); } } - if (0) { - zephir_update_property_zval(this_ptr, SL("propertyAnnotations"), &__$true); + ZEPHIR_INIT_NVAR(&method); + ZEPHIR_INIT_NVAR(&methodPosition); + } + ZEPHIR_OBS_NVAR(¶mCalls); + if (zephir_array_isset_string_fetch(¶mCalls, &definition, SL("properties"), 0)) { + if (UNEXPECTED(Z_TYPE_P(&instance) != IS_OBJECT)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "The definition has properties injection parameters but the constructor didn't return an instance", "phalcon/Di/Service/Builder.zep", 158); + return; + } + if (UNEXPECTED(Z_TYPE_P(¶mCalls) != IS_ARRAY)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "Setter injection parameters must be an array", "phalcon/Di/Service/Builder.zep", 164); + return; + } + zephir_is_iterable(¶mCalls, 0, "phalcon/Di/Service/Builder.zep", 208); + if (Z_TYPE_P(¶mCalls) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(¶mCalls), _27$$25, _28$$25, _25$$25) + { + ZEPHIR_INIT_NVAR(&propertyPosition); + if (_28$$25 != NULL) { + ZVAL_STR_COPY(&propertyPosition, _28$$25); + } else { + ZVAL_LONG(&propertyPosition, _27$$25); + } + ZEPHIR_INIT_NVAR(&property); + ZVAL_COPY(&property, _25$$25); + if (UNEXPECTED(Z_TYPE_P(&property) != IS_ARRAY)) { + ZEPHIR_INIT_NVAR(&_29$$29); + object_init_ex(&_29$$29, phalcon_di_exception_ce); + ZEPHIR_INIT_NVAR(&_30$$29); + ZEPHIR_CONCAT_SV(&_30$$29, "Property must be an array on position ", &propertyPosition); + ZEPHIR_CALL_METHOD(NULL, &_29$$29, "__construct", &_7, 6, &_30$$29); + zephir_check_call_status(); + zephir_throw_exception_debug(&_29$$29, "phalcon/Di/Service/Builder.zep", 178); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_NVAR(&propertyName); + if (UNEXPECTED(!(zephir_array_isset_string_fetch(&propertyName, &property, SL("name"), 0)))) { + ZEPHIR_INIT_NVAR(&_31$$30); + object_init_ex(&_31$$30, phalcon_di_exception_ce); + ZEPHIR_INIT_NVAR(&_32$$30); + ZEPHIR_CONCAT_SV(&_32$$30, "The property name is required on position ", &propertyPosition); + ZEPHIR_CALL_METHOD(NULL, &_31$$30, "__construct", &_7, 6, &_32$$30); + zephir_check_call_status(); + zephir_throw_exception_debug(&_31$$30, "phalcon/Di/Service/Builder.zep", 187); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_NVAR(&propertyValue); + if (UNEXPECTED(!(zephir_array_isset_string_fetch(&propertyValue, &property, SL("value"), 0)))) { + ZEPHIR_INIT_NVAR(&_33$$31); + object_init_ex(&_33$$31, phalcon_di_exception_ce); + ZEPHIR_INIT_NVAR(&_34$$31); + ZEPHIR_CONCAT_SV(&_34$$31, "The property value is required on position ", &propertyPosition); + ZEPHIR_CALL_METHOD(NULL, &_33$$31, "__construct", &_7, 6, &_34$$31); + zephir_check_call_status(); + zephir_throw_exception_debug(&_33$$31, "phalcon/Di/Service/Builder.zep", 196); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_CALL_METHOD(&_35$$28, this_ptr, "buildparameter", &_36, 224, container, &propertyPosition, &propertyValue); + zephir_check_call_status(); + zephir_update_property_zval_zval(&instance, &propertyName, &_35$$28); + } ZEND_HASH_FOREACH_END(); } else { - zephir_update_property_zval(this_ptr, SL("propertyAnnotations"), &__$false); + ZEPHIR_CALL_METHOD(NULL, ¶mCalls, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_26$$25, ¶mCalls, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_26$$25)) { + break; + } + ZEPHIR_CALL_METHOD(&propertyPosition, ¶mCalls, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&property, ¶mCalls, "current", NULL, 0); + zephir_check_call_status(); + if (UNEXPECTED(Z_TYPE_P(&property) != IS_ARRAY)) { + ZEPHIR_INIT_NVAR(&_37$$33); + object_init_ex(&_37$$33, phalcon_di_exception_ce); + ZEPHIR_INIT_NVAR(&_38$$33); + ZEPHIR_CONCAT_SV(&_38$$33, "Property must be an array on position ", &propertyPosition); + ZEPHIR_CALL_METHOD(NULL, &_37$$33, "__construct", &_7, 6, &_38$$33); + zephir_check_call_status(); + zephir_throw_exception_debug(&_37$$33, "phalcon/Di/Service/Builder.zep", 178); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_NVAR(&propertyName); + if (UNEXPECTED(!(zephir_array_isset_string_fetch(&propertyName, &property, SL("name"), 0)))) { + ZEPHIR_INIT_NVAR(&_39$$34); + object_init_ex(&_39$$34, phalcon_di_exception_ce); + ZEPHIR_INIT_NVAR(&_40$$34); + ZEPHIR_CONCAT_SV(&_40$$34, "The property name is required on position ", &propertyPosition); + ZEPHIR_CALL_METHOD(NULL, &_39$$34, "__construct", &_7, 6, &_40$$34); + zephir_check_call_status(); + zephir_throw_exception_debug(&_39$$34, "phalcon/Di/Service/Builder.zep", 187); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_OBS_NVAR(&propertyValue); + if (UNEXPECTED(!(zephir_array_isset_string_fetch(&propertyValue, &property, SL("value"), 0)))) { + ZEPHIR_INIT_NVAR(&_41$$35); + object_init_ex(&_41$$35, phalcon_di_exception_ce); + ZEPHIR_INIT_NVAR(&_42$$35); + ZEPHIR_CONCAT_SV(&_42$$35, "The property value is required on position ", &propertyPosition); + ZEPHIR_CALL_METHOD(NULL, &_41$$35, "__construct", &_7, 6, &_42$$35); + zephir_check_call_status(); + zephir_throw_exception_debug(&_41$$35, "phalcon/Di/Service/Builder.zep", 196); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_CALL_METHOD(&_43$$32, this_ptr, "buildparameter", &_36, 224, container, &propertyPosition, &propertyValue); + zephir_check_call_status(); + zephir_update_property_zval_zval(&instance, &propertyName, &_43$$32); + ZEPHIR_CALL_METHOD(NULL, ¶mCalls, "next", NULL, 0); + zephir_check_call_status(); + } } + ZEPHIR_INIT_NVAR(&property); + ZEPHIR_INIT_NVAR(&propertyPosition); } - RETURN_MM_MEMBER(getThis(), "propertyAnnotations"); + RETURN_CCTOR(&instance); } -static PHP_METHOD(Phalcon_Annotations_Reflection, getReflectionData) { +static PHP_METHOD(Phalcon_Di_Service_Builder, buildParameter) { + zval _2$$3, _5$$5, _8$$8, _11$$10, _14$$13; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval argument; + zend_long position, ZEPHIR_LAST_CALL_STATUS; + zval *container, container_sub, *position_param = NULL, *argument_param = NULL, type, name, value, instanceArguments, _0$$3, _1$$3, _3$$5, _4$$5, _6$$8, _7$$8, _9$$10, _10$$10, _12$$13, _13$$13; zval *this_ptr = getThis(); + ZVAL_UNDEF(&container_sub); + ZVAL_UNDEF(&type); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&instanceArguments); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_3$$5); + ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&_6$$8); + ZVAL_UNDEF(&_7$$8); + ZVAL_UNDEF(&_9$$10); + ZVAL_UNDEF(&_10$$10); + ZVAL_UNDEF(&_12$$13); + ZVAL_UNDEF(&_13$$13); + ZVAL_UNDEF(&argument); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_8$$8); + ZVAL_UNDEF(&_11$$10); + ZVAL_UNDEF(&_14$$13); - RETURN_MEMBER(getThis(), "reflectionData"); - -} - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 0, &container, &position_param, &argument_param); + position = zephir_get_intval(position_param); + ZEPHIR_OBS_COPY_OR_DUP(&argument, argument_param); -/* Generated by re2c 1.1.1 */ -/* scanner.re - * This file is part of the Phalcon Framework. - * - * (c) Phalcon Team - * - * For the full copyright and license information, please view the - * LICENSE.txt file that was distributed with this source code. - */ + ZEPHIR_OBS_VAR(&type); + if (UNEXPECTED(!(zephir_array_isset_string_fetch(&type, &argument, SL("type"), 0)))) { + ZEPHIR_INIT_VAR(&_0$$3); + object_init_ex(&_0$$3, phalcon_di_exception_ce); + ZEPHIR_INIT_VAR(&_1$$3); + ZVAL_LONG(&_1$$3, position); + ZEPHIR_INIT_VAR(&_2$$3); + ZEPHIR_CONCAT_SVS(&_2$$3, "Argument at position ", &_1$$3, " must have a type"); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 6, &_2$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_0$$3, "phalcon/Di/Service/Builder.zep", 228); + ZEPHIR_MM_RESTORE(); + return; + } + do { + if (ZEPHIR_IS_STRING(&type, "service")) { + ZEPHIR_OBS_VAR(&name); + if (UNEXPECTED(!(zephir_array_isset_string_fetch(&name, &argument, SL("name"), 0)))) { + ZEPHIR_INIT_VAR(&_3$$5); + object_init_ex(&_3$$5, phalcon_di_exception_ce); + ZEPHIR_INIT_VAR(&_4$$5); + ZVAL_LONG(&_4$$5, position); + ZEPHIR_INIT_VAR(&_5$$5); + ZEPHIR_CONCAT_SV(&_5$$5, "Service 'name' is required in parameter on position ", &_4$$5); + ZEPHIR_CALL_METHOD(NULL, &_3$$5, "__construct", NULL, 6, &_5$$5); + zephir_check_call_status(); + zephir_throw_exception_debug(&_3$$5, "phalcon/Di/Service/Builder.zep", 241); + ZEPHIR_MM_RESTORE(); + return; + } + if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "The dependency injector container is not valid", "phalcon/Di/Service/Builder.zep", 247); + return; + } + ZEPHIR_RETURN_CALL_METHOD(container, "get", NULL, 0, &name); + zephir_check_call_status(); + RETURN_MM(); + } + if (ZEPHIR_IS_STRING(&type, "parameter")) { + ZEPHIR_OBS_VAR(&value); + if (UNEXPECTED(!(zephir_array_isset_string_fetch(&value, &argument, SL("value"), 0)))) { + ZEPHIR_INIT_VAR(&_6$$8); + object_init_ex(&_6$$8, phalcon_di_exception_ce); + ZEPHIR_INIT_VAR(&_7$$8); + ZVAL_LONG(&_7$$8, position); + ZEPHIR_INIT_VAR(&_8$$8); + ZEPHIR_CONCAT_SV(&_8$$8, "Service 'value' is required in parameter on position ", &_7$$8); + ZEPHIR_CALL_METHOD(NULL, &_6$$8, "__construct", NULL, 6, &_8$$8); + zephir_check_call_status(); + zephir_throw_exception_debug(&_6$$8, "phalcon/Di/Service/Builder.zep", 259); + ZEPHIR_MM_RESTORE(); + return; + } + RETURN_CCTOR(&value); + } + if (ZEPHIR_IS_STRING(&type, "instance")) { + ZEPHIR_OBS_NVAR(&name); + if (UNEXPECTED(!(zephir_array_isset_string_fetch(&name, &argument, SL("className"), 0)))) { + ZEPHIR_INIT_VAR(&_9$$10); + object_init_ex(&_9$$10, phalcon_di_exception_ce); + ZEPHIR_INIT_VAR(&_10$$10); + ZVAL_LONG(&_10$$10, position); + ZEPHIR_INIT_VAR(&_11$$10); + ZEPHIR_CONCAT_SV(&_11$$10, "Service 'className' is required in parameter on position ", &_10$$10); + ZEPHIR_CALL_METHOD(NULL, &_9$$10, "__construct", NULL, 6, &_11$$10); + zephir_check_call_status(); + zephir_throw_exception_debug(&_9$$10, "phalcon/Di/Service/Builder.zep", 272); + ZEPHIR_MM_RESTORE(); + return; + } + if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_di_exception_ce, "The dependency injector container is not valid", "phalcon/Di/Service/Builder.zep", 278); + return; + } + ZEPHIR_OBS_VAR(&instanceArguments); + if (zephir_array_isset_string_fetch(&instanceArguments, &argument, SL("arguments"), 0)) { + ZEPHIR_RETURN_CALL_METHOD(container, "get", NULL, 0, &name, &instanceArguments); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_RETURN_CALL_METHOD(container, "get", NULL, 0, &name); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_INIT_VAR(&_12$$13); + object_init_ex(&_12$$13, phalcon_di_exception_ce); + ZEPHIR_INIT_VAR(&_13$$13); + ZVAL_LONG(&_13$$13, position); + ZEPHIR_INIT_VAR(&_14$$13); + ZEPHIR_CONCAT_SV(&_14$$13, "Unknown service type in parameter on position ", &_13$$13); + ZEPHIR_CALL_METHOD(NULL, &_12$$13, "__construct", NULL, 6, &_14$$13); + zephir_check_call_status(); + zephir_throw_exception_debug(&_12$$13, "phalcon/Di/Service/Builder.zep", 300); + ZEPHIR_MM_RESTORE(); + return; + } while(0); + ZEPHIR_MM_RESTORE(); -#define AACTYPE unsigned char -#define AACURSOR (s->start) -#define AALIMIT (s->end) -#define AAMARKER q +} -static int phannot_get_token(phannot_scanner_state *s, phannot_scanner_token *token) { +static PHP_METHOD(Phalcon_Di_Service_Builder, buildParameters) { - char next, *q = AACURSOR, *start = AACURSOR; - int status = PHANNOT_SCANNER_RETCODE_IMPOSSIBLE; + zend_string *_3; + zend_ulong _2; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_5 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval arguments, buildArguments; + zval *container, container_sub, *arguments_param = NULL, position, argument, *_0, _1, _4$$3, _6$$4; + zval *this_ptr = getThis(); - while (PHANNOT_SCANNER_RETCODE_IMPOSSIBLE == status) { + ZVAL_UNDEF(&container_sub); + ZVAL_UNDEF(&position); + ZVAL_UNDEF(&argument); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_4$$3); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&arguments); + ZVAL_UNDEF(&buildArguments); - if (s->mode == PHANNOT_MODE_RAW) { + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 2, 0, &container, &arguments_param); - if (*AACURSOR == '\n') { - s->active_line++; - } + ZEPHIR_OBS_COPY_OR_DUP(&arguments, arguments_param); - next = *(AACURSOR+1); - if (*AACURSOR == '\0' || *AACURSOR == '@') { - if ((next >= 'A' && next <= 'Z') || (next >= 'a' && next <= 'z')) { - s->mode = PHANNOT_MODE_ANNOTATION; - continue; - } + ZEPHIR_INIT_VAR(&buildArguments); + array_init(&buildArguments); + zephir_is_iterable(&arguments, 0, "phalcon/Di/Service/Builder.zep", 322); + if (Z_TYPE_P(&arguments) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&arguments), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&position); + if (_3 != NULL) { + ZVAL_STR_COPY(&position, _3); + } else { + ZVAL_LONG(&position, _2); } + ZEPHIR_INIT_NVAR(&argument); + ZVAL_COPY(&argument, _0); + ZEPHIR_CALL_METHOD(&_4$$3, this_ptr, "buildparameter", &_5, 224, container, &position, &argument); + zephir_check_call_status(); + zephir_array_append(&buildArguments, &_4$$3, PH_SEPARATE, "phalcon/Di/Service/Builder.zep", 319); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &arguments, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_1, &arguments, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_1)) { + break; + } + ZEPHIR_CALL_METHOD(&position, &arguments, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&argument, &arguments, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "buildparameter", &_5, 224, container, &position, &argument); + zephir_check_call_status(); + zephir_array_append(&buildArguments, &_6$$4, PH_SEPARATE, "phalcon/Di/Service/Builder.zep", 319); + ZEPHIR_CALL_METHOD(NULL, &arguments, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&argument); + ZEPHIR_INIT_NVAR(&position); + RETURN_CTOR(&buildArguments); - ++AACURSOR; - token->opcode = PHANNOT_T_IGNORE; - return 0; +} - } else { - - { - AACTYPE aach; - unsigned int aaaccept = 0; - aach = *AACURSOR; - switch (aach) { - case 0x00: goto aa2; - case '\t': - case '\r': - case ' ': goto aa6; - case '\n': goto aa9; - case '"': goto aa11; - case '\'': goto aa12; - case '(': goto aa13; - case ')': goto aa15; - case ',': goto aa17; - case '-': goto aa19; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto aa20; - case ':': goto aa23; - case '=': goto aa25; - case '@': goto aa27; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto aa29; - case 'F': - case 'f': goto aa32; - case 'N': - case 'n': goto aa33; - case 'T': - case 't': goto aa34; - case '[': goto aa35; - case '\\': goto aa37; - case ']': goto aa38; - case '{': goto aa40; - case '}': goto aa42; - default: goto aa4; - } -aa2: - ++AACURSOR; - { - status = PHANNOT_SCANNER_RETCODE_EOF; - break; - } -aa4: - ++AACURSOR; -aa5: - { - status = PHANNOT_SCANNER_RETCODE_ERR; - break; - } -aa6: - aach = *++AACURSOR; - switch (aach) { - case '\t': - case '\r': - case ' ': goto aa6; - default: goto aa8; - } -aa8: - { - token->opcode = PHANNOT_T_IGNORE; - return 0; - } -aa9: - ++AACURSOR; - { - s->active_line++; - token->opcode = PHANNOT_T_IGNORE; - return 0; - } -aa11: - aaaccept = 0; - aach = *(AAMARKER = ++AACURSOR); - if (aach <= 0x00) goto aa5; - goto aa45; -aa12: - aaaccept = 0; - aach = *(AAMARKER = ++AACURSOR); - if (aach <= 0x00) goto aa5; - goto aa51; -aa13: - ++AACURSOR; - { - token->opcode = PHANNOT_T_PARENTHESES_OPEN; - return 0; - } -aa15: - ++AACURSOR; - { - token->opcode = PHANNOT_T_PARENTHESES_CLOSE; - return 0; - } -aa17: - ++AACURSOR; - { - token->opcode = PHANNOT_T_COMMA; - return 0; - } -aa19: - aach = *++AACURSOR; - switch (aach) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto aa20; - default: goto aa5; - } -aa20: - aaaccept = 1; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case '.': goto aa53; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto aa20; - default: goto aa22; - } -aa22: - { - token->opcode = PHANNOT_T_INTEGER; - token->value = estrndup(start, AACURSOR - start); - token->len = AACURSOR - start; - q = AACURSOR; - return 0; - } -aa23: - ++AACURSOR; - { - token->opcode = PHANNOT_T_COLON; - return 0; - } -aa25: - ++AACURSOR; - { - token->opcode = PHANNOT_T_EQUALS; - return 0; - } -aa27: - ++AACURSOR; - { - token->opcode = PHANNOT_T_AT; - return 0; - } -aa29: - aaaccept = 2; - aach = *(AAMARKER = ++AACURSOR); -aa30: - switch (aach) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto aa29; - case '\\': goto aa54; - default: goto aa31; - } -aa31: - { - token->opcode = PHANNOT_T_IDENTIFIER; - token->value = estrndup(start, AACURSOR - start); - token->len = AACURSOR - start; - q = AACURSOR; - return 0; - } -aa32: - aaaccept = 2; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case 'A': - case 'a': goto aa55; - default: goto aa30; - } -aa33: - aaaccept = 2; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case 'U': - case 'u': goto aa56; - default: goto aa30; - } -aa34: - aaaccept = 2; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case 'R': - case 'r': goto aa57; - default: goto aa30; - } -aa35: - ++AACURSOR; - { - token->opcode = PHANNOT_T_SBRACKET_OPEN; - return 0; - } -aa37: - aach = *++AACURSOR; - switch (aach) { - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto aa29; - default: goto aa5; - } -aa38: - ++AACURSOR; - { - token->opcode = PHANNOT_T_SBRACKET_CLOSE; - return 0; - } -aa40: - ++AACURSOR; - { - token->opcode = PHANNOT_T_BRACKET_OPEN; - return 0; - } -aa42: - ++AACURSOR; - { - token->opcode = PHANNOT_T_BRACKET_CLOSE; - return 0; - } -aa44: - aach = *++AACURSOR; -aa45: - switch (aach) { - case 0x00: goto aa46; - case '"': goto aa47; - case '\\': goto aa49; - default: goto aa44; - } -aa46: - AACURSOR = AAMARKER; - switch (aaaccept) { - case 0: goto aa5; - case 1: goto aa22; - case 2: goto aa31; - case 3: goto aa66; - case 4: goto aa68; - default: goto aa70; - } -aa47: - ++AACURSOR; - { - token->opcode = PHANNOT_T_STRING; - token->value = estrndup(q, AACURSOR - q - 1); - token->len = AACURSOR - q - 1; - q = AACURSOR; - return 0; - } -aa49: - aach = *++AACURSOR; - switch (aach) { - case '\n': goto aa46; - default: goto aa44; - } -aa50: - aach = *++AACURSOR; -aa51: - switch (aach) { - case 0x00: goto aa46; - case '\'': goto aa47; - case '\\': goto aa52; - default: goto aa50; - } -aa52: - aach = *++AACURSOR; - switch (aach) { - case '\n': goto aa46; - default: goto aa50; - } -aa53: - aach = *++AACURSOR; - switch (aach) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto aa58; - default: goto aa46; - } -aa54: - aach = *++AACURSOR; - switch (aach) { - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto aa29; - default: goto aa46; - } -aa55: - aaaccept = 2; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case 'L': - case 'l': goto aa61; - default: goto aa30; - } -aa56: - aaaccept = 2; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case 'L': - case 'l': goto aa62; - default: goto aa30; - } -aa57: - aaaccept = 2; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case 'U': - case 'u': goto aa63; - default: goto aa30; - } -aa58: - aach = *++AACURSOR; - switch (aach) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto aa58; - default: goto aa60; - } -aa60: - { - token->opcode = PHANNOT_T_DOUBLE; - token->value = estrndup(start, AACURSOR - start); - token->len = AACURSOR - start; - q = AACURSOR; - return 0; - } -aa61: - aaaccept = 2; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case 'S': - case 's': goto aa64; - default: goto aa30; - } -aa62: - aaaccept = 2; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case 'L': - case 'l': goto aa65; - default: goto aa30; - } -aa63: - aaaccept = 2; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case 'E': - case 'e': goto aa67; - default: goto aa30; - } -aa64: - aaaccept = 2; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case 'E': - case 'e': goto aa69; - default: goto aa30; - } -aa65: - aaaccept = 3; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto aa29; - case '\\': goto aa54; - default: goto aa66; - } -aa66: - { - token->opcode = PHANNOT_T_NULL; - return 0; - } -aa67: - aaaccept = 4; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto aa29; - case '\\': goto aa54; - default: goto aa68; - } -aa68: - { - token->opcode = PHANNOT_T_TRUE; - return 0; - } -aa69: - aaaccept = 5; - aach = *(AAMARKER = ++AACURSOR); - switch (aach) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': goto aa29; - case '\\': goto aa54; - default: goto aa70; - } -aa70: - { - token->opcode = PHANNOT_T_FALSE; - return 0; - } - } - } - } +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Di_Exception_ServiceResolutionException) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Di\\Exception, ServiceResolutionException, phalcon, di_exception_serviceresolutionexception, phalcon_di_exception_ce, NULL, 0); + + return SUCCESS; - return status; } + #ifdef HAVE_CONFIG_H #endif @@ -33160,1417 +32084,1770 @@ static int phannot_get_token(phannot_scanner_state *s, phannot_scanner_token *to -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Adapter_AbstractAdapter) { +ZEPHIR_INIT_CLASS(Phalcon_Forms_Exception) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations\\Adapter, AbstractAdapter, phalcon, annotations_adapter_abstractadapter, phalcon_annotations_adapter_abstractadapter_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms, Exception, phalcon, forms_exception, phalcon_exception_ce, NULL, 0); - zend_declare_property_null(phalcon_annotations_adapter_abstractadapter_ce, SL("annotations"), ZEND_ACC_PROTECTED); + return SUCCESS; - zend_declare_property_null(phalcon_annotations_adapter_abstractadapter_ce, SL("reader"), ZEND_ACC_PROTECTED); +} - phalcon_annotations_adapter_abstractadapter_ce->create_object = zephir_init_properties_Phalcon_Annotations_Adapter_AbstractAdapter; - zend_class_implements(phalcon_annotations_adapter_abstractadapter_ce, 1, phalcon_annotations_adapter_adapterinterface_ce); + + +#ifdef HAVE_CONFIG_H +#endif + + + + + +ZEPHIR_INIT_CLASS(Phalcon_Forms_Form) { + + ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Forms, Form, phalcon, forms_form, phalcon_di_injectable_ce, phalcon_forms_form_method_entry, 0); + + zend_declare_property_null(phalcon_forms_form_ce, SL("attributes"), ZEND_ACC_PROTECTED); + + zend_declare_property_null(phalcon_forms_form_ce, SL("data"), ZEND_ACC_PROTECTED); + + zend_declare_property_null(phalcon_forms_form_ce, SL("elements"), ZEND_ACC_PROTECTED); + + zend_declare_property_null(phalcon_forms_form_ce, SL("elementsIndexed"), ZEND_ACC_PROTECTED); + + zend_declare_property_null(phalcon_forms_form_ce, SL("entity"), ZEND_ACC_PROTECTED); + + zend_declare_property_null(phalcon_forms_form_ce, SL("messages"), ZEND_ACC_PROTECTED); + + zend_declare_property_null(phalcon_forms_form_ce, SL("position"), ZEND_ACC_PROTECTED); + + zend_declare_property_null(phalcon_forms_form_ce, SL("options"), ZEND_ACC_PROTECTED); + + zend_declare_property_null(phalcon_forms_form_ce, SL("validation"), ZEND_ACC_PROTECTED); + + phalcon_forms_form_ce->create_object = zephir_init_properties_Phalcon_Forms_Form; + + zend_class_implements(phalcon_forms_form_ce, 1, spl_ce_Countable); + zend_class_implements(phalcon_forms_form_ce, 1, zend_ce_iterator); + zend_class_implements(phalcon_forms_form_ce, 1, phalcon_html_attributes_attributesinterface_ce); return SUCCESS; } -static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, get) { +static PHP_METHOD(Phalcon_Forms_Form, setValidation) { - zend_bool _3; + zval *validation, validation_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&validation_sub); + + zephir_fetch_params_without_memory_grow(1, 0, &validation); + + + + zephir_update_property_zval(this_ptr, SL("validation"), validation); + RETURN_THISW(); + +} + +static PHP_METHOD(Phalcon_Forms_Form, getValidation) { + + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "validation"); + +} + +static PHP_METHOD(Phalcon_Forms_Form, __construct) { + + zend_bool _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *className, className_sub, classAnnotations, parsedAnnotations, realClassName, reader, _0, _1$$5, _2$$5; + zval userOptions; + zval *entity = NULL, entity_sub, *userOptions_param = NULL, __$null, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&className_sub); - ZVAL_UNDEF(&classAnnotations); - ZVAL_UNDEF(&parsedAnnotations); - ZVAL_UNDEF(&realClassName); - ZVAL_UNDEF(&reader); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$5); - ZVAL_UNDEF(&_2$$5); + ZVAL_UNDEF(&entity_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&userOptions); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &className); + zephir_fetch_params(1, 0, 2, &entity, &userOptions_param); + if (!entity) { + entity = &entity_sub; + entity = &__$null; + } + if (!userOptions_param) { + ZEPHIR_INIT_VAR(&userOptions); + array_init(&userOptions); + } else { + zephir_get_arrval(&userOptions, userOptions_param); + } - if (Z_TYPE_P(className) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&realClassName); - zephir_get_class(&realClassName, className, 0); - } else { - ZEPHIR_CPY_WRT(&realClassName, className); + _0 = Z_TYPE_P(entity) != IS_NULL; + if (_0) { + _0 = Z_TYPE_P(entity) != IS_OBJECT; } - zephir_read_property(&_0, this_ptr, SL("annotations"), PH_NOISY_CC | PH_READONLY); - if (zephir_array_isset(&_0, &realClassName)) { - zephir_read_property(&_1$$5, this_ptr, SL("annotations"), PH_NOISY_CC | PH_READONLY); - zephir_array_fetch(&_2$$5, &_1$$5, &realClassName, PH_NOISY | PH_READONLY, "phalcon/Annotations/Adapter/AbstractAdapter.zep", 51); - RETURN_CTOR(&_2$$5); + if (UNEXPECTED(_0)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_forms_exception_ce, "The base entity is not valid", "phalcon/Forms/Form.zep", 58); + return; } - ZEPHIR_CALL_METHOD(&classAnnotations, this_ptr, "read", NULL, 0, &realClassName); + zephir_update_property_zval(this_ptr, SL("entity"), entity); + zephir_update_property_zval(this_ptr, SL("options"), &userOptions); + ZEPHIR_INIT_VAR(&_1); + object_init_ex(&_1, phalcon_html_attributes_ce); + ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 21); zephir_check_call_status(); - _3 = Z_TYPE_P(&classAnnotations) == IS_NULL; - if (!(_3)) { - _3 = ZEPHIR_IS_FALSE_IDENTICAL(&classAnnotations); - } - if (_3) { - ZEPHIR_CALL_METHOD(&reader, this_ptr, "getreader", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&parsedAnnotations, &reader, "parse", NULL, 0, &realClassName); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&classAnnotations); - object_init_ex(&classAnnotations, phalcon_annotations_reflection_ce); - ZEPHIR_CALL_METHOD(NULL, &classAnnotations, "__construct", NULL, 45, &parsedAnnotations); - zephir_check_call_status(); - zephir_update_property_array(this_ptr, SL("annotations"), &realClassName, &classAnnotations); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "write", NULL, 0, &realClassName, &classAnnotations); + zephir_update_property_zval(this_ptr, SL("attributes"), &_1); + if ((zephir_method_exists_ex(this_ptr, SL("initialize")) == SUCCESS)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "initialize", NULL, 0, entity, &userOptions); zephir_check_call_status(); } - RETURN_CCTOR(&classAnnotations); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getMethod) { +static PHP_METHOD(Phalcon_Forms_Form, add) { - zend_string *_3$$3; - zend_ulong _2$$3; + zend_string *_6$$4; + zend_ulong _5$$4; + zval elements; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_5 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *className_param = NULL, *methodName_param = NULL, classAnnotations, methods, method, methodKey, *_0$$3, _1$$3, _4$$4, _6$$6; - zval className, methodName; + zend_bool type, _0; + zval position; + zval *element, element_sub, *position_param = NULL, *type_param = NULL, name, key, value, _1, _2$$4, *_3$$4, _4$$4; zval *this_ptr = getThis(); - ZVAL_UNDEF(&className); - ZVAL_UNDEF(&methodName); - ZVAL_UNDEF(&classAnnotations); - ZVAL_UNDEF(&methods); - ZVAL_UNDEF(&method); - ZVAL_UNDEF(&methodKey); - ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&element_sub); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2$$4); ZVAL_UNDEF(&_4$$4); - ZVAL_UNDEF(&_6$$6); + ZVAL_UNDEF(&position); + ZVAL_UNDEF(&elements); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &className_param, &methodName_param); + zephir_fetch_params(1, 1, 2, &element, &position_param, &type_param); - zephir_get_strval(&className, className_param); - zephir_get_strval(&methodName, methodName_param); + if (!position_param) { + ZEPHIR_INIT_VAR(&position); + ZVAL_STRING(&position, ""); + } else { + zephir_get_strval(&position, position_param); + } + if (!type_param) { + type = 0; + } else { + type = zephir_get_boolval(type_param); + } - ZEPHIR_CALL_METHOD(&classAnnotations, this_ptr, "get", NULL, 0, &className); + ZEPHIR_CALL_METHOD(&name, element, "getname", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&methods, &classAnnotations, "getmethodsannotations", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, element, "setform", NULL, 0, this_ptr); zephir_check_call_status(); - if (Z_TYPE_P(&methods) == IS_ARRAY) { - zephir_is_iterable(&methods, 0, "phalcon/Annotations/Adapter/AbstractAdapter.zep", 94); - if (Z_TYPE_P(&methods) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&methods), _2$$3, _3$$3, _0$$3) + _0 = ZEPHIR_IS_STRING(&position, ""); + if (!(_0)) { + zephir_read_property(&_1, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + _0 = ZEPHIR_IS_EMPTY(&_1); + } + if (_0) { + zephir_update_property_array(this_ptr, SL("elements"), &name, element); + } else { + ZEPHIR_INIT_VAR(&elements); + array_init(&elements); + zephir_read_property(&_2$$4, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + zephir_is_iterable(&_2$$4, 0, "phalcon/Forms/Form.zep", 133); + if (Z_TYPE_P(&_2$$4) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_2$$4), _5$$4, _6$$4, _3$$4) { - ZEPHIR_INIT_NVAR(&methodKey); - if (_3$$3 != NULL) { - ZVAL_STR_COPY(&methodKey, _3$$3); + ZEPHIR_INIT_NVAR(&key); + if (_6$$4 != NULL) { + ZVAL_STR_COPY(&key, _6$$4); } else { - ZVAL_LONG(&methodKey, _2$$3); + ZVAL_LONG(&key, _5$$4); } - ZEPHIR_INIT_NVAR(&method); - ZVAL_COPY(&method, _0$$3); - ZEPHIR_CALL_FUNCTION(&_4$$4, "strcasecmp", &_5, 46, &methodKey, &methodName); - zephir_check_call_status(); - if (!(zephir_is_true(&_4$$4))) { - RETURN_CCTOR(&method); + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _3$$4); + if (ZEPHIR_IS_EQUAL(&key, &position)) { + if (type) { + zephir_array_update_zval(&elements, &name, element, PH_COPY | PH_SEPARATE); + zephir_array_update_zval(&elements, &key, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&elements, &key, &value, PH_COPY | PH_SEPARATE); + zephir_array_update_zval(&elements, &name, element, PH_COPY | PH_SEPARATE); + } + } else { + zephir_array_update_zval(&elements, &key, &value, PH_COPY | PH_SEPARATE); } } ZEND_HASH_FOREACH_END(); } else { - ZEPHIR_CALL_METHOD(NULL, &methods, "rewind", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &_2$$4, "rewind", NULL, 0); zephir_check_call_status(); while (1) { - ZEPHIR_CALL_METHOD(&_1$$3, &methods, "valid", NULL, 0); + ZEPHIR_CALL_METHOD(&_4$$4, &_2$$4, "valid", NULL, 0); zephir_check_call_status(); - if (!zend_is_true(&_1$$3)) { + if (!zend_is_true(&_4$$4)) { break; } - ZEPHIR_CALL_METHOD(&methodKey, &methods, "key", NULL, 0); + ZEPHIR_CALL_METHOD(&key, &_2$$4, "key", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&method, &methods, "current", NULL, 0); + ZEPHIR_CALL_METHOD(&value, &_2$$4, "current", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_6$$6, "strcasecmp", &_5, 46, &methodKey, &methodName); - zephir_check_call_status(); - if (!(zephir_is_true(&_6$$6))) { - RETURN_CCTOR(&method); + if (ZEPHIR_IS_EQUAL(&key, &position)) { + if (type) { + zephir_array_update_zval(&elements, &name, element, PH_COPY | PH_SEPARATE); + zephir_array_update_zval(&elements, &key, &value, PH_COPY | PH_SEPARATE); + } else { + zephir_array_update_zval(&elements, &key, &value, PH_COPY | PH_SEPARATE); + zephir_array_update_zval(&elements, &name, element, PH_COPY | PH_SEPARATE); + } + } else { + zephir_array_update_zval(&elements, &key, &value, PH_COPY | PH_SEPARATE); } - ZEPHIR_CALL_METHOD(NULL, &methods, "next", NULL, 0); + ZEPHIR_CALL_METHOD(NULL, &_2$$4, "next", NULL, 0); zephir_check_call_status(); } } - ZEPHIR_INIT_NVAR(&method); - ZEPHIR_INIT_NVAR(&methodKey); + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + zephir_update_property_zval(this_ptr, SL("elements"), &elements); } - object_init_ex(return_value, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 47); - zephir_check_call_status(); - RETURN_MM(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getMethods) { +static PHP_METHOD(Phalcon_Forms_Form, bind) { + zend_bool _6$$4, _13$$11; + zend_string *_4; + zend_ulong _3; + zval method; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_7 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *className_param = NULL, classAnnotations; - zval className; + zval *data_param = NULL, *entity, entity_sub, *whitelist = NULL, whitelist_sub, __$null, filter, key, value, element, filters, container, filteredValue, _0, *_1, _2, _5$$4, _10$$4, _11$$4, _8$$8, _9$$8, _12$$11, _16$$11, _17$$11, _14$$15, _15$$15; + zval data; zval *this_ptr = getThis(); - ZVAL_UNDEF(&className); - ZVAL_UNDEF(&classAnnotations); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&entity_sub); + ZVAL_UNDEF(&whitelist_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&filter); + ZVAL_UNDEF(&key); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&element); + ZVAL_UNDEF(&filters); + ZVAL_UNDEF(&container); + ZVAL_UNDEF(&filteredValue); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_10$$4); + ZVAL_UNDEF(&_11$$4); + ZVAL_UNDEF(&_8$$8); + ZVAL_UNDEF(&_9$$8); + ZVAL_UNDEF(&_12$$11); + ZVAL_UNDEF(&_16$$11); + ZVAL_UNDEF(&_17$$11); + ZVAL_UNDEF(&_14$$15); + ZVAL_UNDEF(&_15$$15); + ZVAL_UNDEF(&method); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &className_param); + zephir_fetch_params(1, 2, 1, &data_param, &entity, &whitelist); - zephir_get_strval(&className, className_param); + ZEPHIR_OBS_COPY_OR_DUP(&data, data_param); + ZEPHIR_SEPARATE_PARAM(entity); + if (!whitelist) { + whitelist = &whitelist_sub; + whitelist = &__$null; + } - ZEPHIR_CALL_METHOD(&classAnnotations, this_ptr, "get", NULL, 0, &className); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&classAnnotations, "getmethodsannotations", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(ZEPHIR_IS_EMPTY(&_0))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_forms_exception_ce, "There are no elements in the form", "phalcon/Forms/Form.zep", 151); + return; + } + ZEPHIR_INIT_VAR(&filter); + ZVAL_NULL(&filter); + zephir_is_iterable(&data, 0, "phalcon/Forms/Form.zep", 206); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _3, _4, _1) + { + ZEPHIR_INIT_NVAR(&key); + if (_4 != NULL) { + ZVAL_STR_COPY(&key, _4); + } else { + ZVAL_LONG(&key, _3); + } + ZEPHIR_INIT_NVAR(&value); + ZVAL_COPY(&value, _1); + ZEPHIR_OBS_NVAR(&element); + zephir_read_property(&_5$$4, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&element, &_5$$4, &key, 0))) { + continue; + } + _6$$4 = Z_TYPE_P(whitelist) == IS_ARRAY; + if (_6$$4) { + _6$$4 = !(zephir_fast_in_array(&key, whitelist)); + } + if (_6$$4) { + continue; + } + ZEPHIR_CALL_METHOD(&filters, &element, "getfilters", NULL, 0); + zephir_check_call_status(); + if (zephir_is_true(&filters)) { + if (Z_TYPE_P(&filter) != IS_OBJECT) { + ZEPHIR_CALL_METHOD(&container, this_ptr, "getdi", &_7, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_9$$8); + ZVAL_STRING(&_9$$8, "filter"); + ZEPHIR_CALL_METHOD(&_8$$8, &container, "getshared", NULL, 0, &_9$$8); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&filter, &_8$$8); + } + ZEPHIR_CALL_METHOD(&filteredValue, &filter, "sanitize", NULL, 0, &value, &filters); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(&filteredValue, &value); + } + ZEPHIR_INIT_NVAR(&_10$$4); + zephir_camelize(&_10$$4, &key, NULL ); + ZEPHIR_INIT_NVAR(&_11$$4); + ZEPHIR_CONCAT_SV(&_11$$4, "set", &_10$$4); + zephir_get_strval(&method, &_11$$4); + if ((zephir_method_exists(entity, &method) == SUCCESS)) { + ZEPHIR_CALL_METHOD_ZVAL(NULL, entity, &method, NULL, 0, &filteredValue); + zephir_check_call_status(); + continue; + } + zephir_update_property_zval_zval(entity, &key, &filteredValue); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &data, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2, &data, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2)) { + break; + } + ZEPHIR_CALL_METHOD(&key, &data, "key", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&value, &data, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_NVAR(&element); + zephir_read_property(&_12$$11, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&element, &_12$$11, &key, 0))) { + continue; + } + _13$$11 = Z_TYPE_P(whitelist) == IS_ARRAY; + if (_13$$11) { + _13$$11 = !(zephir_fast_in_array(&key, whitelist)); + } + if (_13$$11) { + continue; + } + ZEPHIR_CALL_METHOD(&filters, &element, "getfilters", NULL, 0); + zephir_check_call_status(); + if (zephir_is_true(&filters)) { + if (Z_TYPE_P(&filter) != IS_OBJECT) { + ZEPHIR_CALL_METHOD(&container, this_ptr, "getdi", &_7, 0); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_15$$15); + ZVAL_STRING(&_15$$15, "filter"); + ZEPHIR_CALL_METHOD(&_14$$15, &container, "getshared", NULL, 0, &_15$$15); + zephir_check_call_status(); + ZEPHIR_CPY_WRT(&filter, &_14$$15); + } + ZEPHIR_CALL_METHOD(&filteredValue, &filter, "sanitize", NULL, 0, &value, &filters); + zephir_check_call_status(); + } else { + ZEPHIR_CPY_WRT(&filteredValue, &value); + } + ZEPHIR_INIT_NVAR(&_16$$11); + zephir_camelize(&_16$$11, &key, NULL ); + ZEPHIR_INIT_NVAR(&_17$$11); + ZEPHIR_CONCAT_SV(&_17$$11, "set", &_16$$11); + zephir_get_strval(&method, &_17$$11); + if ((zephir_method_exists(entity, &method) == SUCCESS)) { + ZEPHIR_CALL_METHOD_ZVAL(NULL, entity, &method, NULL, 0, &filteredValue); + zephir_check_call_status(); + continue; + } + zephir_update_property_zval_zval(entity, &key, &filteredValue); + ZEPHIR_CALL_METHOD(NULL, &data, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&value); + ZEPHIR_INIT_NVAR(&key); + zephir_update_property_zval(this_ptr, SL("data"), &data); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getProperty) { +static PHP_METHOD(Phalcon_Forms_Form, clear) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_3 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *className_param = NULL, *propertyName_param = NULL, classAnnotations, properties, property; - zval className, propertyName; + zval *fields = NULL, fields_sub, __$null, elements, element, data, field, _0, *_1$$3, _2$$3, _4$$4, _5$$4, _6$$5, _7$$5, _8$$7, *_9$$6, _10$$6, _11$$10, _12$$10, _13$$13, _14$$13; zval *this_ptr = getThis(); - ZVAL_UNDEF(&className); - ZVAL_UNDEF(&propertyName); - ZVAL_UNDEF(&classAnnotations); - ZVAL_UNDEF(&properties); - ZVAL_UNDEF(&property); + ZVAL_UNDEF(&fields_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&elements); + ZVAL_UNDEF(&element); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&field); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&_4$$4); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$5); + ZVAL_UNDEF(&_7$$5); + ZVAL_UNDEF(&_8$$7); + ZVAL_UNDEF(&_10$$6); + ZVAL_UNDEF(&_11$$10); + ZVAL_UNDEF(&_12$$10); + ZVAL_UNDEF(&_13$$13); + ZVAL_UNDEF(&_14$$13); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &className_param, &propertyName_param); + zephir_fetch_params(1, 0, 1, &fields); - zephir_get_strval(&className, className_param); - zephir_get_strval(&propertyName, propertyName_param); + if (!fields) { + fields = &fields_sub; + ZEPHIR_CPY_WRT(fields, &__$null); + } else { + ZEPHIR_SEPARATE_PARAM(fields); + } - ZEPHIR_CALL_METHOD(&classAnnotations, this_ptr, "get", NULL, 0, &className); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&properties, &classAnnotations, "getpropertiesannotations", NULL, 0); - zephir_check_call_status(); - if (!(zephir_array_isset_fetch(&property, &properties, &propertyName, 1))) { - object_init_ex(return_value, phalcon_annotations_collection_ce); - ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 47); - zephir_check_call_status(); - RETURN_MM(); + zephir_read_property(&_0, this_ptr, SL("data"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&data, &_0); + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&elements, &_0); + if (Z_TYPE_P(fields) == IS_NULL) { + ZEPHIR_INIT_NVAR(&data); + array_init(&data); + zephir_is_iterable(&elements, 0, "phalcon/Forms/Form.zep", 237); + if (Z_TYPE_P(&elements) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&elements), _1$$3) + { + ZEPHIR_INIT_NVAR(&element); + ZVAL_COPY(&element, _1$$3); + ZEPHIR_CALL_METHOD(&_4$$4, &element, "getname", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_5$$4, &element, "getdefault", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_CE_STATIC(NULL, phalcon_tag_ce, "setdefault", &_3, 0, &_4$$4, &_5$$4); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &elements, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_2$$3, &elements, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_2$$3)) { + break; + } + ZEPHIR_CALL_METHOD(&element, &elements, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_6$$5, &element, "getname", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_7$$5, &element, "getdefault", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_CE_STATIC(NULL, phalcon_tag_ce, "setdefault", &_3, 0, &_6$$5, &_7$$5); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &elements, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&element); + } else { + if (Z_TYPE_P(fields) != IS_ARRAY) { + ZEPHIR_INIT_VAR(&_8$$7); + zephir_create_array(&_8$$7, 1, 0); + zephir_array_fast_append(&_8$$7, fields); + ZEPHIR_CPY_WRT(fields, &_8$$7); + } + zephir_is_iterable(fields, 0, "phalcon/Forms/Form.zep", 254); + if (Z_TYPE_P(fields) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(fields), _9$$6) + { + ZEPHIR_INIT_NVAR(&field); + ZVAL_COPY(&field, _9$$6); + if (zephir_array_isset(&data, &field)) { + zephir_array_unset(&data, &field, PH_SEPARATE); + } + ZEPHIR_OBS_NVAR(&element); + if (zephir_array_isset_fetch(&element, &elements, &field, 0)) { + ZEPHIR_CALL_METHOD(&_11$$10, &element, "getname", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_12$$10, &element, "getdefault", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_CE_STATIC(NULL, phalcon_tag_ce, "setdefault", &_3, 0, &_11$$10, &_12$$10); + zephir_check_call_status(); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, fields, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_10$$6, fields, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_10$$6)) { + break; + } + ZEPHIR_CALL_METHOD(&field, fields, "current", NULL, 0); + zephir_check_call_status(); + if (zephir_array_isset(&data, &field)) { + zephir_array_unset(&data, &field, PH_SEPARATE); + } + ZEPHIR_OBS_NVAR(&element); + if (zephir_array_isset_fetch(&element, &elements, &field, 0)) { + ZEPHIR_CALL_METHOD(&_13$$13, &element, "getname", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_14$$13, &element, "getdefault", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_CE_STATIC(NULL, phalcon_tag_ce, "setdefault", &_3, 0, &_13$$13, &_14$$13); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, fields, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&field); } - RETURN_CTOR(&property); + zephir_update_property_zval(this_ptr, SL("data"), &data); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getProperties) { +static PHP_METHOD(Phalcon_Forms_Form, count) { - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *className_param = NULL, classAnnotations; - zval className; + zval _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&className); - ZVAL_UNDEF(&classAnnotations); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &className_param); - - zephir_get_strval(&className, className_param); + ZVAL_UNDEF(&_0); - ZEPHIR_CALL_METHOD(&classAnnotations, this_ptr, "get", NULL, 0, &className); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&classAnnotations, "getpropertiesannotations", NULL, 0); - zephir_check_call_status(); - RETURN_MM(); + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + RETURN_LONG(zephir_fast_count_int(&_0)); } -static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, getReader) { +static PHP_METHOD(Phalcon_Forms_Form, current) { - zval _0, _1$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; + zval element, _0, _1; zval *this_ptr = getThis(); + ZVAL_UNDEF(&element); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&_1); - ZEPHIR_MM_GROW(); - ZEPHIR_OBS_VAR(&_0); - zephir_read_property(&_0, this_ptr, SL("reader"), PH_NOISY_CC); - if (Z_TYPE_P(&_0) != IS_OBJECT) { - ZEPHIR_INIT_VAR(&_1$$3); - object_init_ex(&_1$$3, phalcon_annotations_reader_ce); - if (zephir_has_constructor(&_1$$3)) { - ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 0); - zephir_check_call_status(); - } - zephir_update_property_zval(this_ptr, SL("reader"), &_1$$3); + zephir_read_property(&_0, this_ptr, SL("elementsIndexed"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_1, this_ptr, SL("position"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&element, &_0, &_1, 1))) { + RETURN_BOOL(0); } - RETURN_MM_MEMBER(getThis(), "reader"); + RETURN_CTORW(&element); } -static PHP_METHOD(Phalcon_Annotations_Adapter_AbstractAdapter, setReader) { +static PHP_METHOD(Phalcon_Forms_Form, get) { - zval *reader, reader_sub; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, element, _0, _1$$3; + zval name, _2$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&reader_sub); - - zephir_fetch_params_without_memory_grow(1, 0, &reader); - - - - zephir_update_property_zval(this_ptr, SL("reader"), reader); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&element); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); -} + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &name_param); -zend_object *zephir_init_properties_Phalcon_Annotations_Adapter_AbstractAdapter(zend_class_entry *class_type TSRMLS_DC) { + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); + } else { + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); + } - zval _0, _1$$3; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); - ZEPHIR_MM_GROW(); - - { - zval local_this_ptr, *this_ptr = &local_this_ptr; - ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property(&_0, this_ptr, SL("annotations"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_0) == IS_NULL) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_update_property_zval(this_ptr, SL("annotations"), &_1$$3); - } + ZEPHIR_OBS_VAR(&element); + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(!(zephir_array_isset_fetch(&element, &_0, &name, 0)))) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_forms_exception_ce); + ZEPHIR_INIT_VAR(&_2$$3); + ZEPHIR_CONCAT_SVS(&_2$$3, "Element with ID=", &name, " is not part of the form"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 6, &_2$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Form.zep", 293); ZEPHIR_MM_RESTORE(); - return Z_OBJ_P(this_ptr); + return; } + RETURN_CCTOR(&element); } +static PHP_METHOD(Phalcon_Forms_Form, getAction) { + zval _3; + zval _0, _1, _2; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Adapter_AdapterInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Annotations\\Adapter, AdapterInterface, phalcon, annotations_adapter_adapterinterface, phalcon_annotations_adapter_adapterinterface_method_entry); + ZEPHIR_MM_GROW(); - return SUCCESS; + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getattributes", NULL, 0); + zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, "action"); + ZEPHIR_CALL_METHOD(&_1, &_0, "get", NULL, 0, &_2); + zephir_check_call_status(); + zephir_get_strval(&_3, &_1); + RETURN_CTOR(&_3); } -ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, get); - -ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, getMethod); - -ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, getMethods); - -ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, getProperty); - -ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, getProperties); - -ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, getReader); +static PHP_METHOD(Phalcon_Forms_Form, getAttributes) { -ZEPHIR_DOC_METHOD(Phalcon_Annotations_Adapter_AdapterInterface, setReader); + zval _0, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + ZEPHIR_MM_GROW(); + zephir_read_property(&_0, this_ptr, SL("attributes"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(Z_TYPE_P(&_0) == IS_NULL)) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_html_attributes_ce); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 21); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, SL("attributes"), &_1$$3); + } + RETURN_MM_MEMBER(getThis(), "attributes"); -#ifdef HAVE_CONFIG_H -#endif +} +static PHP_METHOD(Phalcon_Forms_Form, getElements) { + zval *this_ptr = getThis(); + RETURN_MEMBER(getThis(), "elements"); -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Adapter_Apcu) { +} - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Annotations\\Adapter, Apcu, phalcon, annotations_adapter_apcu, phalcon_annotations_adapter_abstractadapter_ce, phalcon_annotations_adapter_apcu_method_entry, 0); +static PHP_METHOD(Phalcon_Forms_Form, getEntity) { - zend_declare_property_string(phalcon_annotations_adapter_apcu_ce, SL("prefix"), "", ZEND_ACC_PROTECTED); + zval *this_ptr = getThis(); - zend_declare_property_long(phalcon_annotations_adapter_apcu_ce, SL("ttl"), 172800, ZEND_ACC_PROTECTED); - return SUCCESS; + RETURN_MEMBER(getThis(), "entity"); } -static PHP_METHOD(Phalcon_Annotations_Adapter_Apcu, __construct) { +static PHP_METHOD(Phalcon_Forms_Form, getLabel) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *options_param = NULL, prefix, ttl; - zval options; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, element, label, _0, _1$$3; + zval name, _2$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&prefix); - ZVAL_UNDEF(&ttl); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&element); + ZVAL_UNDEF(&label); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &options_param); + zephir_fetch_params(1, 1, 0, &name_param); - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - zephir_get_arrval(&options, options_param); + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); } - if (zephir_array_isset_string_fetch(&prefix, &options, SL("prefix"), 1)) { - zephir_update_property_zval(this_ptr, SL("prefix"), &prefix); + ZEPHIR_OBS_VAR(&element); + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(!(zephir_array_isset_fetch(&element, &_0, &name, 0)))) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_forms_exception_ce); + ZEPHIR_INIT_VAR(&_2$$3); + ZEPHIR_CONCAT_SVS(&_2$$3, "Element with ID=", &name, " is not part of the form"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 6, &_2$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Form.zep", 347); + ZEPHIR_MM_RESTORE(); + return; } - if (zephir_array_isset_string_fetch(&ttl, &options, SL("lifetime"), 1)) { - zephir_update_property_zval(this_ptr, SL("ttl"), &ttl); + ZEPHIR_CALL_METHOD(&label, &element, "getlabel", NULL, 0); + zephir_check_call_status(); + if (!(zephir_is_true(&label))) { + RETURN_CTOR(&name); } - ZEPHIR_MM_RESTORE(); + RETURN_CCTOR(&label); } -static PHP_METHOD(Phalcon_Annotations_Adapter_Apcu, read) { +static PHP_METHOD(Phalcon_Forms_Form, getMessages) { + zend_bool _1; + zval messages, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, _0, _1, _2; - zval key; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); + ZVAL_UNDEF(&messages); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); 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(); + zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&messages, &_0); + _1 = Z_TYPE_P(&messages) == IS_OBJECT; + if (_1) { + _1 = zephir_instance_of_ev(&messages, phalcon_messages_messages_ce); } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); - } else { - ZEPHIR_INIT_VAR(&key); - ZVAL_EMPTY_STRING(&key); + if (!(_1)) { + object_init_ex(return_value, phalcon_messages_messages_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 7); + zephir_check_call_status(); + RETURN_MM(); } - - - ZEPHIR_INIT_VAR(&_0); - zephir_read_property(&_1, this_ptr, SL("prefix"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_2); - ZEPHIR_CONCAT_SVV(&_2, "_PHAN", &_1, &key); - zephir_fast_strtolower(&_0, &_2); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_fetch", NULL, 114, &_0); - zephir_check_call_status(); - RETURN_MM(); + RETURN_CCTOR(&messages); } -static PHP_METHOD(Phalcon_Annotations_Adapter_Apcu, write) { +static PHP_METHOD(Phalcon_Forms_Form, getMessagesFor) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *data, data_sub, _0, _1, _2, _3; - zval key; + zval *name_param = NULL, _0, _1; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&data_sub); + ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &data); + zephir_fetch_params(1, 1, 0, &name_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")); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - ZEPHIR_INIT_VAR(&key); - ZVAL_EMPTY_STRING(&key); + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); } - ZEPHIR_INIT_VAR(&_0); - zephir_read_property(&_1, this_ptr, SL("prefix"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_2); - ZEPHIR_CONCAT_SVV(&_2, "_PHAN", &_1, &key); - zephir_fast_strtolower(&_0, &_2); - zephir_read_property(&_3, this_ptr, SL("ttl"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_RETURN_CALL_FUNCTION("apcu_store", NULL, 117, &_0, data, &_3); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "has", NULL, 0, &name); + zephir_check_call_status(); + if (!(zephir_is_true(&_0))) { + object_init_ex(return_value, phalcon_messages_messages_ce); + ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 7); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_CALL_METHOD(&_1, this_ptr, "get", NULL, 0, &name); + zephir_check_call_status(); + ZEPHIR_RETURN_CALL_METHOD(&_1, "getmessages", NULL, 0); zephir_check_call_status(); RETURN_MM(); } +static PHP_METHOD(Phalcon_Forms_Form, getUserOption) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *option_param = NULL, *defaultValue = NULL, defaultValue_sub, __$null, value, _0; + zval option; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&option); + ZVAL_UNDEF(&defaultValue_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_0); -#ifdef HAVE_CONFIG_H -#endif + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &option_param, &defaultValue); + zephir_get_strval(&option, option_param); + if (!defaultValue) { + defaultValue = &defaultValue_sub; + defaultValue = &__$null; + } + zephir_read_property(&_0, this_ptr, SL("options"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&value, &_0, &option, 1))) { + RETVAL_ZVAL(defaultValue, 1, 0); + RETURN_MM(); + } + RETURN_CTOR(&value); +} -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Adapter_Memory) { +static PHP_METHOD(Phalcon_Forms_Form, getUserOptions) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Annotations\\Adapter, Memory, phalcon, annotations_adapter_memory, phalcon_annotations_adapter_abstractadapter_ce, phalcon_annotations_adapter_memory_method_entry, 0); + zval *this_ptr = getThis(); - zend_declare_property_null(phalcon_annotations_adapter_memory_ce, SL("data"), ZEND_ACC_PROTECTED); - return SUCCESS; + RETURN_MEMBER(getThis(), "options"); } -static PHP_METHOD(Phalcon_Annotations_Adapter_Memory, read) { +static PHP_METHOD(Phalcon_Forms_Form, getValue) { + zval forbidden; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *key_param = NULL, data, _0, _1; - zval key; + zephir_fcall_cache_entry *_6 = NULL, *_7 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, __$true, entity, value, data, internalEntity, element, _0, _3, _4, _5, _1$$4, _2$$4; + zval name, method; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&method); + ZVAL_BOOL(&__$true, 1); + ZVAL_UNDEF(&entity); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&data); + ZVAL_UNDEF(&internalEntity); + ZVAL_UNDEF(&element); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_5); + ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&_2$$4); + ZVAL_UNDEF(&forbidden); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); + zephir_fetch_params(1, 1, 0, &name_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")); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - ZEPHIR_INIT_VAR(&key); - ZVAL_EMPTY_STRING(&key); + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); } + zephir_read_property(&_0, this_ptr, SL("entity"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&entity, &_0); zephir_read_property(&_0, this_ptr, SL("data"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - zephir_fast_strtolower(&_1, &key); - if (!(zephir_array_isset_fetch(&data, &_0, &_1, 1))) { - RETURN_MM_BOOL(0); + ZEPHIR_CPY_WRT(&data, &_0); + if ((zephir_method_exists_ex(this_ptr, SL("getcustomvalue")) == SUCCESS)) { + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getcustomvalue", NULL, 0, &name, &entity, &data); + zephir_check_call_status(); + RETURN_MM(); } - RETURN_CTOR(&data); + if (Z_TYPE_P(&entity) == IS_OBJECT) { + ZEPHIR_INIT_VAR(&_1$$4); + zephir_camelize(&_1$$4, &name, NULL ); + ZEPHIR_INIT_VAR(&_2$$4); + ZEPHIR_CONCAT_SV(&_2$$4, "get", &_1$$4); + zephir_get_strval(&method, &_2$$4); + if ((zephir_method_exists(&entity, &method) == SUCCESS)) { + ZEPHIR_RETURN_CALL_METHOD_ZVAL(&entity, &method, NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_OBS_VAR(&value); + if (zephir_fetch_property_zval(&value, &entity, &name, PH_SILENT_CC)) { + RETURN_CCTOR(&value); + } + } + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEPHIR_OBS_NVAR(&value); + if (zephir_array_isset_fetch(&value, &data, &name, 0)) { + RETURN_CCTOR(&value); + } + } + ZEPHIR_INIT_VAR(&forbidden); + zephir_create_array(&forbidden, 13, 0); + zephir_array_update_string(&forbidden, SL("attributes"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&forbidden, SL("validation"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&forbidden, SL("action"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&forbidden, SL("useroption"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&forbidden, SL("useroptions"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&forbidden, SL("entity"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&forbidden, SL("elements"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&forbidden, SL("messages"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&forbidden, SL("messagesfor"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&forbidden, SL("label"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&forbidden, SL("value"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&forbidden, SL("di"), &__$true, PH_COPY | PH_SEPARATE); + zephir_array_update_string(&forbidden, SL("eventsmanager"), &__$true, PH_COPY | PH_SEPARATE); + ZEPHIR_INIT_VAR(&internalEntity); + zephir_fast_strtolower(&internalEntity, &name); + if (zephir_array_isset(&forbidden, &internalEntity)) { + RETURN_MM_NULL(); + } + ZEPHIR_INIT_VAR(&_3); + zephir_camelize(&_3, &name, NULL ); + ZEPHIR_INIT_VAR(&_4); + ZEPHIR_CONCAT_SV(&_4, "get", &_3); + zephir_get_strval(&method, &_4); + if ((zephir_method_exists(this_ptr, &method) == SUCCESS)) { + ZEPHIR_RETURN_CALL_METHOD_ZVAL(this_ptr, &method, NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_CALL_CE_STATIC(&_5, phalcon_tag_ce, "hasvalue", &_6, 0, &name); + zephir_check_call_status(); + if (zephir_is_true(&_5)) { + ZEPHIR_RETURN_CALL_CE_STATIC(phalcon_tag_ce, "getvalue", &_7, 0, &name); + zephir_check_call_status(); + RETURN_MM(); + } + ZEPHIR_OBS_VAR(&element); + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset_fetch(&element, &_0, &name, 0)) { + ZEPHIR_RETURN_CALL_METHOD(&element, "getdefault", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); + } + RETURN_MM_NULL(); } -static PHP_METHOD(Phalcon_Annotations_Adapter_Memory, write) { +static PHP_METHOD(Phalcon_Forms_Form, has) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *key_param = NULL, *data, data_sub, lowercasedKey; - zval key; + zval *name_param = NULL, _0; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&data_sub); - ZVAL_UNDEF(&lowercasedKey); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &data); + zephir_fetch_params(1, 1, 0, &name_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")); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - ZEPHIR_INIT_VAR(&key); - ZVAL_EMPTY_STRING(&key); + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); } - ZEPHIR_INIT_VAR(&lowercasedKey); - zephir_fast_strtolower(&lowercasedKey, &key); - zephir_update_property_array(this_ptr, SL("data"), &lowercasedKey, data); - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Annotations_Adapter_Stream) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Annotations\\Adapter, Stream, phalcon, annotations_adapter_stream, phalcon_annotations_adapter_abstractadapter_ce, phalcon_annotations_adapter_stream_method_entry, 0); - - zend_declare_property_string(phalcon_annotations_adapter_stream_ce, SL("annotationsDir"), "./", ZEND_ACC_PROTECTED); - - return SUCCESS; + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + RETURN_MM_BOOL(zephir_array_isset(&_0, &name)); } -static PHP_METHOD(Phalcon_Annotations_Adapter_Stream, __construct) { +static PHP_METHOD(Phalcon_Forms_Form, hasMessagesFor) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *options_param = NULL, annotationsDir; - zval options; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, _0, _1; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&annotationsDir); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &options_param); + zephir_fetch_params(1, 1, 0, &name_param); - if (!options_param) { - ZEPHIR_INIT_VAR(&options); - array_init(&options); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - zephir_get_arrval(&options, options_param); + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); } - if (zephir_array_isset_string_fetch(&annotationsDir, &options, SL("annotationsDir"), 1)) { - zephir_update_property_zval(this_ptr, SL("annotationsDir"), &annotationsDir); - } - ZEPHIR_MM_RESTORE(); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmessagesfor", NULL, 0, &name); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_1, &_0, "count", NULL, 0); + zephir_check_call_status(); + RETURN_MM_BOOL(ZEPHIR_GT_LONG(&_1, 0)); } -static PHP_METHOD(Phalcon_Annotations_Adapter_Stream, read) { +static PHP_METHOD(Phalcon_Forms_Form, isValid) { + zend_object_iterator *_16$$21; + zend_bool validationStatus = 0, _5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_11 = NULL, *_12 = NULL, *_19 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, __$false, contents, _0, _1, _2, _3, _4, _5, _6; - zval key, path; + zval *data = NULL, data_sub, *entity = NULL, entity_sub, __$null, messages, element, validators, name, filters, validator, validation, elementMessage, _0, _6, *_7, _8, _15, _1$$4, _2$$6, _3$$7, _4$$8, *_9$$11, _10$$11, *_13$$16, _14$$16, _17$$22, _18$$22; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&path); - ZVAL_BOOL(&__$false, 0); - ZVAL_UNDEF(&contents); + ZVAL_UNDEF(&data_sub); + ZVAL_UNDEF(&entity_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&messages); + ZVAL_UNDEF(&element); + ZVAL_UNDEF(&validators); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&filters); + ZVAL_UNDEF(&validator); + ZVAL_UNDEF(&validation); + ZVAL_UNDEF(&elementMessage); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); + ZVAL_UNDEF(&_8); + ZVAL_UNDEF(&_15); + ZVAL_UNDEF(&_1$$4); + ZVAL_UNDEF(&_2$$6); + ZVAL_UNDEF(&_3$$7); + ZVAL_UNDEF(&_4$$8); + ZVAL_UNDEF(&_10$$11); + ZVAL_UNDEF(&_14$$16); + ZVAL_UNDEF(&_17$$22); + ZVAL_UNDEF(&_18$$22); - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &key_param); - - zephir_get_strval(&key, key_param); - + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 0, 2, &data, &entity); - zephir_read_property(&_0, this_ptr, SL("annotationsDir"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "_"); - zephir_prepare_virtual_path(&_1, &key, &_2); - ZEPHIR_INIT_VAR(&_3); - ZEPHIR_CONCAT_VVS(&_3, &_0, &_1, ".php"); - zephir_get_strval(&path, &_3); - if (!((zephir_file_exists(&path) == SUCCESS))) { - RETURN_MM_BOOL(0); + if (!data) { + data = &data_sub; + ZEPHIR_CPY_WRT(data, &__$null); + } else { + ZEPHIR_SEPARATE_PARAM(data); } - ZEPHIR_INIT_VAR(&contents); - zephir_file_get_contents(&contents, &path); - if (UNEXPECTED(ZEPHIR_IS_EMPTY(&contents))) { - RETURN_MM_BOOL(0); + if (!entity) { + entity = &entity_sub; + entity = &__$null; } - ZEPHIR_GLOBAL(warning).enable = zend_is_true(&__$false); - ZEPHIR_INIT_VAR(&_4); - ZEPHIR_INIT_NVAR(&_4); - zephir_create_closure_ex(&_4, NULL, phalcon_2__closure_ce, SL("__invoke")); - ZVAL_LONG(&_5, 2); - ZEPHIR_CALL_FUNCTION(NULL, "set_error_handler", NULL, 84, &_4, &_5); + + + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + if (ZEPHIR_IS_EMPTY(&_0)) { + RETURN_MM_BOOL(1); + } + if (Z_TYPE_P(data) != IS_ARRAY) { + zephir_read_property(&_1$$4, this_ptr, SL("data"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(data, &_1$$4); + } + if (Z_TYPE_P(entity) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "bind", NULL, 0, data, entity); + zephir_check_call_status(); + } else { + ZEPHIR_OBS_VAR(&_2$$6); + zephir_read_property(&_2$$6, this_ptr, SL("entity"), PH_NOISY_CC); + if (Z_TYPE_P(&_2$$6) == IS_OBJECT) { + zephir_read_property(&_3$$7, this_ptr, SL("entity"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "bind", NULL, 0, data, &_3$$7); + zephir_check_call_status(); + } + } + if ((zephir_method_exists_ex(this_ptr, SL("beforevalidation")) == SUCCESS)) { + ZEPHIR_CALL_METHOD(&_4$$8, this_ptr, "beforevalidation", NULL, 0, data, entity); + zephir_check_call_status(); + if (ZEPHIR_IS_FALSE_IDENTICAL(&_4$$8)) { + RETURN_MM_BOOL(0); + } + } + validationStatus = 1; + ZEPHIR_CALL_METHOD(&validation, this_ptr, "getvalidation", NULL, 0); zephir_check_call_status(); - ZEPHIR_CALL_FUNCTION(&_6, "unserialize", NULL, 14, &contents); + _5 = Z_TYPE_P(&validation) != IS_OBJECT; + if (!(_5)) { + _5 = !((zephir_instance_of_ev(&validation, phalcon_validation_validationinterface_ce))); + } + if (_5) { + ZEPHIR_INIT_NVAR(&validation); + object_init_ex(&validation, phalcon_validation_ce); + ZEPHIR_CALL_METHOD(NULL, &validation, "__construct", NULL, 244); + zephir_check_call_status(); + } + zephir_read_property(&_6, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + zephir_is_iterable(&_6, 0, "phalcon/Forms/Form.zep", 622); + if (Z_TYPE_P(&_6) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_6), _7) + { + ZEPHIR_INIT_NVAR(&element); + ZVAL_COPY(&element, _7); + ZEPHIR_CALL_METHOD(&validators, &element, "getvalidators", NULL, 0); + zephir_check_call_status(); + if (zephir_fast_count_int(&validators) == 0) { + continue; + } + ZEPHIR_CALL_METHOD(&name, &element, "getname", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&validators, 0, "phalcon/Forms/Form.zep", 609); + if (Z_TYPE_P(&validators) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&validators), _9$$11) + { + ZEPHIR_INIT_NVAR(&validator); + ZVAL_COPY(&validator, _9$$11); + ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_11, 245, &name, &validator); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &validators, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_10$$11, &validators, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_10$$11)) { + break; + } + ZEPHIR_CALL_METHOD(&validator, &validators, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_11, 245, &name, &validator); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &validators, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&validator); + ZEPHIR_CALL_METHOD(&filters, &element, "getfilters", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&filters) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(NULL, &validation, "setfilters", &_12, 246, &name, &filters); + zephir_check_call_status(); + } + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &_6, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_8, &_6, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_8)) { + break; + } + ZEPHIR_CALL_METHOD(&element, &_6, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&validators, &element, "getvalidators", NULL, 0); + zephir_check_call_status(); + if (zephir_fast_count_int(&validators) == 0) { + continue; + } + ZEPHIR_CALL_METHOD(&name, &element, "getname", NULL, 0); + zephir_check_call_status(); + zephir_is_iterable(&validators, 0, "phalcon/Forms/Form.zep", 609); + if (Z_TYPE_P(&validators) == IS_ARRAY) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&validators), _13$$16) + { + ZEPHIR_INIT_NVAR(&validator); + ZVAL_COPY(&validator, _13$$16); + ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_11, 245, &name, &validator); + zephir_check_call_status(); + } ZEND_HASH_FOREACH_END(); + } else { + ZEPHIR_CALL_METHOD(NULL, &validators, "rewind", NULL, 0); + zephir_check_call_status(); + while (1) { + ZEPHIR_CALL_METHOD(&_14$$16, &validators, "valid", NULL, 0); + zephir_check_call_status(); + if (!zend_is_true(&_14$$16)) { + break; + } + ZEPHIR_CALL_METHOD(&validator, &validators, "current", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &validation, "add", &_11, 245, &name, &validator); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &validators, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&validator); + ZEPHIR_CALL_METHOD(&filters, &element, "getfilters", NULL, 0); + zephir_check_call_status(); + if (Z_TYPE_P(&filters) == IS_ARRAY) { + ZEPHIR_CALL_METHOD(NULL, &validation, "setfilters", &_12, 246, &name, &filters); + zephir_check_call_status(); + } + ZEPHIR_CALL_METHOD(NULL, &_6, "next", NULL, 0); + zephir_check_call_status(); + } + } + ZEPHIR_INIT_NVAR(&element); + ZEPHIR_CALL_METHOD(&messages, &validation, "validate", NULL, 247, data, entity); zephir_check_call_status(); - ZEPHIR_CPY_WRT(&contents, &_6); - ZEPHIR_CALL_FUNCTION(NULL, "restore_error_handler", NULL, 86); + ZEPHIR_CALL_METHOD(&_15, &messages, "count", NULL, 0); zephir_check_call_status(); - if (UNEXPECTED(ZEPHIR_GLOBAL(warning).enable)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_RuntimeException, "Cannot read annotation data", "phalcon/Annotations/Adapter/Stream.zep", 92); - return; + if (zephir_is_true(&_15)) { + _16$$21 = zephir_get_iterator(&messages); + _16$$21->funcs->rewind(_16$$21); + for (;_16$$21->funcs->valid(_16$$21) == SUCCESS && !EG(exception); _16$$21->funcs->move_forward(_16$$21)) { + { + ZEPHIR_ITERATOR_COPY(&elementMessage, _16$$21); + } + ZEPHIR_CALL_METHOD(&_18$$22, &elementMessage, "getfield", NULL, 0); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(&_17$$22, this_ptr, "get", &_19, 0, &_18$$22); + zephir_check_call_status(); + ZEPHIR_CALL_METHOD(NULL, &_17$$22, "appendmessage", NULL, 0, &elementMessage); + zephir_check_call_status(); + } + zend_iterator_dtor(_16$$21); + ZEPHIR_CALL_METHOD(NULL, &messages, "rewind", NULL, 0); + zephir_check_call_status(); + validationStatus = 0; } - RETURN_CCTOR(&contents); + if (!(validationStatus)) { + zephir_update_property_zval(this_ptr, SL("messages"), &messages); + } + if ((zephir_method_exists_ex(this_ptr, SL("aftervalidation")) == SUCCESS)) { + ZEPHIR_CALL_METHOD(NULL, this_ptr, "aftervalidation", NULL, 0, &messages); + zephir_check_call_status(); + } + RETURN_MM_BOOL(validationStatus); } -static PHP_METHOD(Phalcon_Annotations_Adapter_Stream, write) { +static PHP_METHOD(Phalcon_Forms_Form, key) { + + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "position"); + +} + +static PHP_METHOD(Phalcon_Forms_Form, label) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *key_param = NULL, *data, data_sub, code, _0, _1, _2, _3, _4; - zval key, path; + zval attributes; + zval *name_param = NULL, *attributes_param = NULL, element, _0, _1$$3; + zval name, _2$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&key); - ZVAL_UNDEF(&path); - ZVAL_UNDEF(&data_sub); - ZVAL_UNDEF(&code); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&element); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_4); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&attributes); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &key_param, &data); + zephir_fetch_params(1, 1, 1, &name_param, &attributes_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")); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); RETURN_MM_NULL(); } - if (EXPECTED(Z_TYPE_P(key_param) == IS_STRING)) { - zephir_get_strval(&key, key_param); + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - ZEPHIR_INIT_VAR(&key); - ZVAL_EMPTY_STRING(&key); + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); + } + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); } - zephir_read_property(&_0, this_ptr, SL("annotationsDir"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "_"); - zephir_prepare_virtual_path(&_1, &key, &_2); - ZEPHIR_INIT_VAR(&_3); - ZEPHIR_CONCAT_VVS(&_3, &_0, &_1, ".php"); - zephir_get_strval(&path, &_3); - ZEPHIR_CALL_FUNCTION(&code, "serialize", NULL, 12, data); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_4); - zephir_file_put_contents(&_4, &path, &code); - if (UNEXPECTED(ZEPHIR_IS_FALSE_IDENTICAL(&_4))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_annotations_exception_ce, "Annotations directory cannot be written", "phalcon/Annotations/Adapter/Stream.zep", 113); + ZEPHIR_OBS_VAR(&element); + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(!(zephir_array_isset_fetch(&element, &_0, &name, 0)))) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_forms_exception_ce); + ZEPHIR_INIT_VAR(&_2$$3); + ZEPHIR_CONCAT_SVS(&_2$$3, "Element with ID=", &name, " is not part of the form"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 6, &_2$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Form.zep", 672); + ZEPHIR_MM_RESTORE(); return; } - ZEPHIR_MM_RESTORE(); - -} - - - - -#ifdef HAVE_CONFIG_H -#endif - - - - - -ZEPHIR_INIT_CLASS(Phalcon_Flash_AbstractFlash) { - - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Flash, AbstractFlash, phalcon, flash_abstractflash, phalcon_di_abstractinjectionaware_ce, phalcon_flash_abstractflash_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - - zend_declare_property_bool(phalcon_flash_abstractflash_ce, SL("autoescape"), 1, ZEND_ACC_PROTECTED); - - zend_declare_property_bool(phalcon_flash_abstractflash_ce, SL("automaticHtml"), 1, ZEND_ACC_PROTECTED); - - zend_declare_property_null(phalcon_flash_abstractflash_ce, SL("cssClasses"), ZEND_ACC_PROTECTED); - - zend_declare_property_string(phalcon_flash_abstractflash_ce, SL("customTemplate"), "", ZEND_ACC_PROTECTED); - - zend_declare_property_null(phalcon_flash_abstractflash_ce, SL("escaperService"), ZEND_ACC_PROTECTED); - - zend_declare_property_bool(phalcon_flash_abstractflash_ce, SL("implicitFlush"), 1, ZEND_ACC_PROTECTED); - - zend_declare_property_null(phalcon_flash_abstractflash_ce, SL("messages"), ZEND_ACC_PROTECTED); - - zend_declare_property_null(phalcon_flash_abstractflash_ce, SL("sessionService"), ZEND_ACC_PROTECTED); - - phalcon_flash_abstractflash_ce->create_object = zephir_init_properties_Phalcon_Flash_AbstractFlash; - - zend_class_implements(phalcon_flash_abstractflash_ce, 1, phalcon_flash_flashinterface_ce); - return SUCCESS; - -} - -static PHP_METHOD(Phalcon_Flash_AbstractFlash, getAutoescape) { - - zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "autoescape"); - -} - -static PHP_METHOD(Phalcon_Flash_AbstractFlash, getCssClasses) { - - zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "cssClasses"); + ZEPHIR_RETURN_CALL_METHOD(&element, "label", NULL, 0, &attributes); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, getCustomTemplate) { +static PHP_METHOD(Phalcon_Forms_Form, next) { zval *this_ptr = getThis(); - RETURN_MEMBER(getThis(), "customTemplate"); + RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("position"))); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, __construct) { +static PHP_METHOD(Phalcon_Forms_Form, render) { - zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *escaper = NULL, escaper_sub, *session = NULL, session_sub, __$null; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval attributes; + zval *name_param = NULL, *attributes_param = NULL, element, _0, _1$$3; + zval name, _2$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&escaper_sub); - ZVAL_UNDEF(&session_sub); - ZVAL_NULL(&__$null); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&_2$$3); + ZVAL_UNDEF(&element); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&attributes); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 2, &escaper, &session); + zephir_fetch_params(1, 1, 1, &name_param, &attributes_param); - if (!escaper) { - escaper = &escaper_sub; - escaper = &__$null; + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); } - if (!session) { - session = &session_sub; - session = &__$null; + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); + } else { + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); + } + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); } - zephir_update_property_zval(this_ptr, SL("escaperService"), escaper); - zephir_update_property_zval(this_ptr, SL("sessionService"), session); - ZEPHIR_INIT_VAR(&_0); - zephir_create_array(&_0, 4, 0); - add_assoc_stringl_ex(&_0, SL("error"), SL("errorMessage")); - add_assoc_stringl_ex(&_0, SL("notice"), SL("noticeMessage")); - add_assoc_stringl_ex(&_0, SL("success"), SL("successMessage")); - add_assoc_stringl_ex(&_0, SL("warning"), SL("warningMessage")); - zephir_update_property_zval(this_ptr, SL("cssClasses"), &_0); - ZEPHIR_MM_RESTORE(); + ZEPHIR_OBS_VAR(&element); + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(!(zephir_array_isset_fetch(&element, &_0, &name, 0)))) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_forms_exception_ce); + ZEPHIR_INIT_VAR(&_2$$3); + ZEPHIR_CONCAT_SVS(&_2$$3, "Element with ID=", &name, " is not part of the form"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 6, &_2$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Form.zep", 696); + ZEPHIR_MM_RESTORE(); + return; + } + ZEPHIR_RETURN_CALL_METHOD(&element, "render", NULL, 0, &attributes); + zephir_check_call_status(); + RETURN_MM(); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, clear) { +static PHP_METHOD(Phalcon_Forms_Form, remove) { - zval _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *name_param = NULL, __$null, _0, _1$$3; + zval name; zval *this_ptr = getThis(); + ZVAL_UNDEF(&name); + ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &name_param); - ZEPHIR_INIT_VAR(&_0); - array_init(&_0); - zephir_update_property_zval(this_ptr, SL("messages"), &_0); - ZEPHIR_MM_RESTORE(); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); + } + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); + } else { + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); + } + + + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + if (zephir_array_isset(&_0, &name)) { + zephir_read_property(&_1$$3, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + zephir_array_unset(&_1$$3, &name, PH_SEPARATE); + RETURN_MM_BOOL(1); + } + zephir_update_property_zval(this_ptr, SL("elementsIndexed"), &__$null); + RETURN_MM_BOOL(0); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, error) { +static PHP_METHOD(Phalcon_Forms_Form, rewind) { + zval _0, _1; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *message_param = NULL, _0; - zval message; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &message_param); - - zephir_get_strval(&message, message_param); - - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "error"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "message", NULL, 0, &_0, &message); + ZEPHIR_INIT_ZVAL_NREF(_0); + ZVAL_LONG(&_0, 0); + zephir_update_property_zval(this_ptr, SL("position"), &_0); + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_FUNCTION(&_1, "array_values", NULL, 11, &_0); zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_zval(this_ptr, SL("elementsIndexed"), &_1); + ZEPHIR_MM_RESTORE(); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, getEscaperService) { +static PHP_METHOD(Phalcon_Forms_Form, setAction) { - zval container, _0, _1, _6, _7, _2$$4, _3$$4, _5$$4, _8$$5, _9$$5, _10$$6, _11$$6, _12$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_4 = NULL; + zval *action_param = NULL, _0, _1; + zval action; zval *this_ptr = getThis(); - ZVAL_UNDEF(&container); + ZVAL_UNDEF(&action); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_10$$6); - ZVAL_UNDEF(&_11$$6); - ZVAL_UNDEF(&_12$$6); ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &action_param); - zephir_read_property(&_0, this_ptr, SL("escaperService"), PH_NOISY_CC | PH_READONLY); - if (zephir_is_true(&_0)) { - RETURN_MM_MEMBER(getThis(), "escaperService"); - } - zephir_read_property(&_1, this_ptr, SL("container"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&container, &_1); - if (UNEXPECTED(Z_TYPE_P(&container) != IS_OBJECT)) { - ZEPHIR_INIT_VAR(&_2$$4); - object_init_ex(&_2$$4, phalcon_flash_exception_ce); - ZEPHIR_INIT_VAR(&_5$$4); - ZVAL_STRING(&_5$$4, "the 'escaper' service"); - ZEPHIR_CALL_CE_STATIC(&_3$$4, phalcon_flash_exception_ce, "containerservicenotfound", &_4, 0, &_5$$4); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 6, &_3$$4); - zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$4, "phalcon/Flash/AbstractFlash.zep", 121); - ZEPHIR_MM_RESTORE(); - return; + if (UNEXPECTED(Z_TYPE_P(action_param) != IS_STRING && Z_TYPE_P(action_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'action' must be of the type string")); + RETURN_MM_NULL(); } - ZEPHIR_INIT_VAR(&_7); - ZVAL_STRING(&_7, "escaper"); - ZEPHIR_CALL_METHOD(&_6, &container, "has", NULL, 0, &_7); - zephir_check_call_status(); - if (UNEXPECTED(zephir_is_true(&_6))) { - ZEPHIR_INIT_VAR(&_9$$5); - ZVAL_STRING(&_9$$5, "escaper"); - ZEPHIR_CALL_METHOD(&_8$$5, &container, "getshared", NULL, 0, &_9$$5); - zephir_check_call_status(); - RETURN_CCTOR(&_8$$5); + if (EXPECTED(Z_TYPE_P(action_param) == IS_STRING)) { + zephir_get_strval(&action, action_param); } else { - ZEPHIR_INIT_VAR(&_10$$6); - object_init_ex(&_10$$6, phalcon_flash_exception_ce); - ZEPHIR_INIT_VAR(&_12$$6); - ZVAL_STRING(&_12$$6, "the 'escaper' service"); - ZEPHIR_CALL_CE_STATIC(&_11$$6, phalcon_flash_exception_ce, "containerservicenotfound", &_4, 0, &_12$$6); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_10$$6, "__construct", NULL, 6, &_11$$6); - zephir_check_call_status(); - zephir_throw_exception_debug(&_10$$6, "phalcon/Flash/AbstractFlash.zep", 129); - ZEPHIR_MM_RESTORE(); - return; + ZEPHIR_INIT_VAR(&action); + ZVAL_EMPTY_STRING(&action); } -} - -static PHP_METHOD(Phalcon_Flash_AbstractFlash, notice) { - - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *message_param = NULL, _0; - zval message; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &message_param); - - zephir_get_strval(&message, message_param); - - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "notice"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "message", NULL, 0, &_0, &message); + ZEPHIR_CALL_METHOD(&_0, this_ptr, "getattributes", NULL, 0); zephir_check_call_status(); - RETURN_MM(); + ZEPHIR_INIT_VAR(&_1); + ZVAL_STRING(&_1, "action"); + ZEPHIR_CALL_METHOD(NULL, &_0, "set", NULL, 0, &_1, &action); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, setAutoescape) { +static PHP_METHOD(Phalcon_Forms_Form, setEntity) { - zval *autoescape_param = NULL, __$true, __$false; - zend_bool autoescape; + zval *entity, entity_sub; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&entity_sub); - zephir_fetch_params_without_memory_grow(1, 0, &autoescape_param); + zephir_fetch_params_without_memory_grow(1, 0, &entity); - autoescape = zephir_get_boolval(autoescape_param); - if (autoescape) { - zephir_update_property_zval(this_ptr, SL("autoescape"), &__$true); - } else { - zephir_update_property_zval(this_ptr, SL("autoescape"), &__$false); - } + zephir_update_property_zval(this_ptr, SL("entity"), entity); RETURN_THISW(); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, setAutomaticHtml) { +static PHP_METHOD(Phalcon_Forms_Form, setAttributes) { - zval *automaticHtml_param = NULL, __$true, __$false; - zend_bool automaticHtml; + zval *attributes, attributes_sub; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&attributes_sub); - zephir_fetch_params_without_memory_grow(1, 0, &automaticHtml_param); + zephir_fetch_params_without_memory_grow(1, 0, &attributes); - automaticHtml = zephir_get_boolval(automaticHtml_param); - if (automaticHtml) { - zephir_update_property_zval(this_ptr, SL("automaticHtml"), &__$true); - } else { - zephir_update_property_zval(this_ptr, SL("automaticHtml"), &__$false); - } + zephir_update_property_zval(this_ptr, SL("attributes"), attributes); RETURN_THISW(); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, setCssClasses) { +static PHP_METHOD(Phalcon_Forms_Form, setUserOption) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *cssClasses_param = NULL; - zval cssClasses; + zval *option_param = NULL, *value, value_sub; + zval option; zval *this_ptr = getThis(); - ZVAL_UNDEF(&cssClasses); + ZVAL_UNDEF(&option); + ZVAL_UNDEF(&value_sub); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &cssClasses_param); + zephir_fetch_params(1, 2, 0, &option_param, &value); - ZEPHIR_OBS_COPY_OR_DUP(&cssClasses, cssClasses_param); + zephir_get_strval(&option, option_param); - zephir_update_property_zval(this_ptr, SL("cssClasses"), &cssClasses); + zephir_update_property_array(this_ptr, SL("options"), &option, value); RETURN_THIS(); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, setCustomTemplate) { +static PHP_METHOD(Phalcon_Forms_Form, setUserOptions) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *customTemplate_param = NULL; - zval customTemplate; + zval *options_param = NULL; + zval options; zval *this_ptr = getThis(); - ZVAL_UNDEF(&customTemplate); + ZVAL_UNDEF(&options); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &customTemplate_param); + zephir_fetch_params(1, 1, 0, &options_param); - if (UNEXPECTED(Z_TYPE_P(customTemplate_param) != IS_STRING && Z_TYPE_P(customTemplate_param) != IS_NULL)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'customTemplate' must be of the type string")); - RETURN_MM_NULL(); - } - if (EXPECTED(Z_TYPE_P(customTemplate_param) == IS_STRING)) { - zephir_get_strval(&customTemplate, customTemplate_param); - } else { - ZEPHIR_INIT_VAR(&customTemplate); - ZVAL_EMPTY_STRING(&customTemplate); - } + ZEPHIR_OBS_COPY_OR_DUP(&options, options_param); - zephir_update_property_zval(this_ptr, SL("customTemplate"), &customTemplate); + zephir_update_property_zval(this_ptr, SL("options"), &options); RETURN_THIS(); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, setEscaperService) { +static PHP_METHOD(Phalcon_Forms_Form, valid) { - zval *escaperService, escaperService_sub; + zval _0, _1; zval *this_ptr = getThis(); - ZVAL_UNDEF(&escaperService_sub); - - zephir_fetch_params_without_memory_grow(1, 0, &escaperService); - + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1); - zephir_update_property_zval(this_ptr, SL("escaperService"), escaperService); - RETURN_THISW(); + zephir_read_property(&_0, this_ptr, SL("elementsIndexed"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_1, this_ptr, SL("position"), PH_NOISY_CC | PH_READONLY); + RETURN_BOOL(zephir_array_isset(&_0, &_1)); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, setImplicitFlush) { - - zval *implicitFlush_param = NULL, __$true, __$false; - zend_bool implicitFlush; - zval *this_ptr = getThis(); - - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); - - zephir_fetch_params_without_memory_grow(1, 0, &implicitFlush_param); - - implicitFlush = zephir_get_boolval(implicitFlush_param); +zend_object *zephir_init_properties_Phalcon_Forms_Form(zend_class_entry *class_type TSRMLS_DC) { + zval _0, _1$$3; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); - if (implicitFlush) { - zephir_update_property_zval(this_ptr, SL("implicitFlush"), &__$true); - } else { - zephir_update_property_zval(this_ptr, SL("implicitFlush"), &__$false); + ZEPHIR_MM_GROW(); + + { + zval local_this_ptr, *this_ptr = &local_this_ptr; + ZEPHIR_CREATE_OBJECT(this_ptr, class_type); + zephir_read_property(&_0, this_ptr, SL("elements"), PH_NOISY_CC | PH_READONLY); + if (Z_TYPE_P(&_0) == IS_NULL) { + ZEPHIR_INIT_VAR(&_1$$3); + array_init(&_1$$3); + zephir_update_property_zval(this_ptr, SL("elements"), &_1$$3); + } + ZEPHIR_MM_RESTORE(); + return Z_OBJ_P(this_ptr); } - RETURN_THISW(); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, success) { - - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *message_param = NULL, _0; - zval message; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); - - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &message_param); - zephir_get_strval(&message, message_param); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "success"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "message", NULL, 0, &_0, &message); - zephir_check_call_status(); - RETURN_MM(); +#ifdef HAVE_CONFIG_H +#endif -} -static PHP_METHOD(Phalcon_Flash_AbstractFlash, outputMessage) { - zend_bool implicitFlush = 0; - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_3 = NULL, *_4 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *type_param = NULL, *message, message_sub, content, msg, htmlMessage, preparedMsg, _0, *_1$$3, _2$$3; - zval type; - zval *this_ptr = getThis(); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&message_sub); - ZVAL_UNDEF(&content); - ZVAL_UNDEF(&msg); - ZVAL_UNDEF(&htmlMessage); - ZVAL_UNDEF(&preparedMsg); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2$$3); - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &type_param, &message); +ZEPHIR_INIT_CLASS(Phalcon_Forms_Manager) { - zephir_get_strval(&type, type_param); + ZEPHIR_REGISTER_CLASS(Phalcon\\Forms, Manager, phalcon, forms_manager, phalcon_forms_manager_method_entry, 0); + zend_declare_property_null(phalcon_forms_manager_ce, SL("forms"), ZEND_ACC_PROTECTED); - ZEPHIR_OBS_VAR(&_0); - zephir_read_property(&_0, this_ptr, SL("implicitFlush"), PH_NOISY_CC); - implicitFlush = zephir_get_boolval(&_0); - if (Z_TYPE_P(message) == IS_ARRAY) { - if (!(implicitFlush)) { - ZEPHIR_INIT_VAR(&content); - ZVAL_STRING(&content, ""); - } - zephir_is_iterable(message, 0, "phalcon/Flash/AbstractFlash.zep", 269); - if (Z_TYPE_P(message) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(message), _1$$3) - { - ZEPHIR_INIT_NVAR(&msg); - ZVAL_COPY(&msg, _1$$3); - ZEPHIR_CALL_METHOD(&preparedMsg, this_ptr, "prepareescapedmessage", &_3, 98, &msg); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&htmlMessage, this_ptr, "preparehtmlmessage", &_4, 99, &type, &preparedMsg); - zephir_check_call_status(); - if (implicitFlush) { - zend_print_zval(&htmlMessage, 0); - } else { - zephir_concat_self(&content, &htmlMessage); - zephir_update_property_array_append(this_ptr, SL("messages"), &htmlMessage); - } - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, message, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2$$3, message, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2$$3)) { - break; - } - ZEPHIR_CALL_METHOD(&msg, message, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&preparedMsg, this_ptr, "prepareescapedmessage", &_3, 98, &msg); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&htmlMessage, this_ptr, "preparehtmlmessage", &_4, 99, &type, &preparedMsg); - zephir_check_call_status(); - if (implicitFlush) { - zend_print_zval(&htmlMessage, 0); - } else { - zephir_concat_self(&content, &htmlMessage); - zephir_update_property_array_append(this_ptr, SL("messages"), &htmlMessage); - } - ZEPHIR_CALL_METHOD(NULL, message, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&msg); - if (!(implicitFlush)) { - RETURN_CCTOR(&content); - } - } else { - ZEPHIR_CALL_METHOD(&preparedMsg, this_ptr, "prepareescapedmessage", &_3, 98, message); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&htmlMessage, this_ptr, "preparehtmlmessage", &_4, 99, &type, &preparedMsg); - zephir_check_call_status(); - if (implicitFlush) { - zend_print_zval(&htmlMessage, 0); - } else { - zephir_update_property_array_append(this_ptr, SL("messages"), &htmlMessage); - RETURN_CCTOR(&htmlMessage); - } - } - ZEPHIR_MM_RESTORE(); + phalcon_forms_manager_ce->create_object = zephir_init_properties_Phalcon_Forms_Manager; + return SUCCESS; } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, warning) { +static PHP_METHOD(Phalcon_Forms_Manager, create) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *message_param = NULL, _0; - zval message; + zval *name_param = NULL, *entity = NULL, entity_sub, __$null, form; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&entity_sub); + ZVAL_NULL(&__$null); + ZVAL_UNDEF(&form); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &message_param); + zephir_fetch_params(1, 1, 1, &name_param, &entity); - zephir_get_strval(&message, message_param); + zephir_get_strval(&name, name_param); + if (!entity) { + entity = &entity_sub; + entity = &__$null; + } - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "warning"); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "message", NULL, 0, &_0, &message); + ZEPHIR_INIT_VAR(&form); + object_init_ex(&form, phalcon_forms_form_ce); + ZEPHIR_CALL_METHOD(NULL, &form, "__construct", NULL, 248, entity); zephir_check_call_status(); - RETURN_MM(); + zephir_update_property_array(this_ptr, SL("forms"), &name, &form); + RETURN_CCTOR(&form); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, getTemplate) { +static PHP_METHOD(Phalcon_Forms_Manager, get) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zval *cssClassses_param = NULL, _0, _1, _2$$3, _3$$4, _4$$5; - zval cssClassses; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *name_param = NULL, form, _0, _1$$3; + zval name, _2$$3; zval *this_ptr = getThis(); - ZVAL_UNDEF(&cssClassses); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&name); ZVAL_UNDEF(&_2$$3); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_4$$5); + ZVAL_UNDEF(&form); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$3); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &cssClassses_param); + zephir_fetch_params(1, 1, 0, &name_param); - zephir_get_strval(&cssClassses, cssClassses_param); + zephir_get_strval(&name, name_param); - zephir_read_property(&_0, this_ptr, SL("customTemplate"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_INIT_VAR(&_1); - ZVAL_STRING(&_1, ""); - if (ZEPHIR_IS_IDENTICAL(&_1, &_0)) { + ZEPHIR_OBS_VAR(&form); + zephir_read_property(&_0, this_ptr, SL("forms"), PH_NOISY_CC | PH_READONLY); + if (UNEXPECTED(!(zephir_array_isset_fetch(&form, &_0, &name, 0)))) { + ZEPHIR_INIT_VAR(&_1$$3); + object_init_ex(&_1$$3, phalcon_forms_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); - ZVAL_STRING(&_2$$3, ""); - if (ZEPHIR_IS_IDENTICAL(&_2$$3, &cssClassses)) { - ZEPHIR_INIT_VAR(&_3$$4); - ZEPHIR_GET_CONSTANT(&_3$$4, "PHP_EOL"); - ZEPHIR_CONCAT_SV(return_value, "
%message%
", &_3$$4); - RETURN_MM(); - } else { - ZEPHIR_INIT_VAR(&_4$$5); - ZEPHIR_GET_CONSTANT(&_4$$5, "PHP_EOL"); - ZEPHIR_CONCAT_SV(return_value, "
%message%
", &_4$$5); - RETURN_MM(); - } + ZEPHIR_CONCAT_SVS(&_2$$3, "There is no form with name='", &name, "'"); + ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 6, &_2$$3); + zephir_check_call_status(); + zephir_throw_exception_debug(&_1$$3, "phalcon/Forms/Manager.zep", 43); + ZEPHIR_MM_RESTORE(); + return; } - RETURN_MM_MEMBER(getThis(), "customTemplate"); + RETURN_CCTOR(&form); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, prepareEscapedMessage) { +static PHP_METHOD(Phalcon_Forms_Manager, has) { - zend_bool autoEscape = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *message_param = NULL, escaper, _0; - zval message; + zval *name_param = NULL, _0; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&escaper); + ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &message_param); + zephir_fetch_params(1, 1, 0, &name_param); - zephir_get_strval(&message, message_param); + zephir_get_strval(&name, name_param); - ZEPHIR_OBS_VAR(&_0); - zephir_read_property(&_0, this_ptr, SL("autoescape"), PH_NOISY_CC); - autoEscape = zephir_get_boolval(&_0); - if (!(autoEscape)) { - RETURN_CTOR(&message); - } - ZEPHIR_CALL_METHOD(&escaper, this_ptr, "getescaperservice", NULL, 0); - zephir_check_call_status(); - ZEPHIR_RETURN_CALL_METHOD(&escaper, "escapehtml", NULL, 0, &message); - zephir_check_call_status(); - RETURN_MM(); + zephir_read_property(&_0, this_ptr, SL("forms"), PH_NOISY_CC | PH_READONLY); + RETURN_MM_BOOL(zephir_array_isset(&_0, &name)); } -static PHP_METHOD(Phalcon_Flash_AbstractFlash, prepareHtmlMessage) { +static PHP_METHOD(Phalcon_Forms_Manager, set) { - zval _1, _3; - zend_bool automaticHtml = 0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *type_param = NULL, *message_param = NULL, classes, cssClasses, typeClasses, _0, _2, _4; - zval type, message; + zval *name_param = NULL, *form, form_sub; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&classes); - ZVAL_UNDEF(&cssClasses); - ZVAL_UNDEF(&typeClasses); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); - ZVAL_UNDEF(&_4); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&form_sub); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &type_param, &message_param); + zephir_fetch_params(1, 2, 0, &name_param, &form); - zephir_get_strval(&type, type_param); - zephir_get_strval(&message, message_param); + zephir_get_strval(&name, name_param); - ZEPHIR_OBS_VAR(&_0); - zephir_read_property(&_0, this_ptr, SL("automaticHtml"), PH_NOISY_CC); - automaticHtml = zephir_get_boolval(&_0); - if (!(automaticHtml)) { - RETURN_CTOR(&message); - } - ZEPHIR_OBS_VAR(&classes); - zephir_read_property(&classes, this_ptr, SL("cssClasses"), PH_NOISY_CC); - ZEPHIR_OBS_VAR(&typeClasses); - if (zephir_array_isset_fetch(&typeClasses, &classes, &type, 0)) { - if (Z_TYPE_P(&typeClasses) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&cssClasses); - zephir_fast_join_str(&cssClasses, SL(" "), &typeClasses); - } else { - ZEPHIR_CPY_WRT(&cssClasses, &typeClasses); - } - } else { - ZEPHIR_INIT_NVAR(&cssClasses); - ZVAL_STRING(&cssClasses, ""); - } - ZEPHIR_INIT_VAR(&_1); - zephir_create_array(&_1, 2, 0); - ZEPHIR_INIT_VAR(&_2); - ZVAL_STRING(&_2, "%cssClass%"); - zephir_array_fast_append(&_1, &_2); - ZEPHIR_INIT_NVAR(&_2); - ZVAL_STRING(&_2, "%message%"); - zephir_array_fast_append(&_1, &_2); - ZEPHIR_INIT_VAR(&_3); - zephir_create_array(&_3, 2, 0); - zephir_array_fast_append(&_3, &cssClasses); - zephir_array_fast_append(&_3, &message); - ZEPHIR_CALL_METHOD(&_4, this_ptr, "gettemplate", NULL, 100, &cssClasses); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_2); - zephir_fast_str_replace(&_2, &_1, &_3, &_4); - RETURN_CCTOR(&_2); + zephir_update_property_array(this_ptr, SL("forms"), &name, form); + RETURN_THIS(); } -zend_object *zephir_init_properties_Phalcon_Flash_AbstractFlash(zend_class_entry *class_type TSRMLS_DC) { +zend_object *zephir_init_properties_Phalcon_Forms_Manager(zend_class_entry *class_type TSRMLS_DC) { - zval _0, _2, _1$$3, _3$$4; + zval _0, _1$$3; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_1$$3); - ZVAL_UNDEF(&_3$$4); ZEPHIR_MM_GROW(); { zval local_this_ptr, *this_ptr = &local_this_ptr; ZEPHIR_CREATE_OBJECT(this_ptr, class_type); - zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); + zephir_read_property(&_0, this_ptr, SL("forms"), PH_NOISY_CC | PH_READONLY); if (Z_TYPE_P(&_0) == IS_NULL) { ZEPHIR_INIT_VAR(&_1$$3); array_init(&_1$$3); - zephir_update_property_zval(this_ptr, SL("messages"), &_1$$3); - } - zephir_read_property(&_2, this_ptr, SL("cssClasses"), PH_NOISY_CC | PH_READONLY); - if (Z_TYPE_P(&_2) == IS_NULL) { - ZEPHIR_INIT_VAR(&_3$$4); - array_init(&_3$$4); - zephir_update_property_zval(this_ptr, SL("cssClasses"), &_3$$4); + zephir_update_property_zval(this_ptr, SL("forms"), &_1$$3); } ZEPHIR_MM_RESTORE(); return Z_OBJ_P(this_ptr); @@ -34588,1006 +33865,808 @@ zend_object *zephir_init_properties_Phalcon_Flash_AbstractFlash(zend_class_entry -ZEPHIR_INIT_CLASS(Phalcon_Flash_Direct) { +ZEPHIR_INIT_CLASS(Phalcon_Forms_Element_AbstractElement) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Flash, Direct, phalcon, flash_direct, phalcon_flash_abstractflash_ce, phalcon_flash_direct_method_entry, 0); + ZEPHIR_REGISTER_CLASS(Phalcon\\Forms\\Element, AbstractElement, phalcon, forms_element_abstractelement, phalcon_forms_element_abstractelement_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - return SUCCESS; + zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("attributes"), ZEND_ACC_PROTECTED); -} + zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("filters"), ZEND_ACC_PROTECTED); -static PHP_METHOD(Phalcon_Flash_Direct, message) { + zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("form"), ZEND_ACC_PROTECTED); - zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *type_param = NULL, *message, message_sub; - zval type; - zval *this_ptr = getThis(); + zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("label"), ZEND_ACC_PROTECTED); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&message_sub); + zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("messages"), ZEND_ACC_PROTECTED); - ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &type_param, &message); + zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("name"), ZEND_ACC_PROTECTED); - zephir_get_strval(&type, type_param); + zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("options"), ZEND_ACC_PROTECTED); + zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("validators"), ZEND_ACC_PROTECTED); - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "outputmessage", NULL, 0, &type, message); - zephir_check_call_status(); - RETURN_MM(); + zend_declare_property_null(phalcon_forms_element_abstractelement_ce, SL("value"), ZEND_ACC_PROTECTED); -} + phalcon_forms_element_abstractelement_ce->create_object = zephir_init_properties_Phalcon_Forms_Element_AbstractElement; -static PHP_METHOD(Phalcon_Flash_Direct, output) { + zend_class_implements(phalcon_forms_element_abstractelement_ce, 1, phalcon_forms_element_elementinterface_ce); + return SUCCESS; + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, __construct) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_3 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *remove_param = NULL, message, _0, *_1, _2; - zend_bool remove; + zval attributes; + zval *name_param = NULL, *attributes_param = NULL, _0, _1; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(&message); + ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&attributes); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &remove_param); + zephir_fetch_params(1, 1, 1, &name_param, &attributes_param); - if (!remove_param) { - remove = 1; + zephir_get_strval(&name, name_param); + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - remove = zephir_get_boolval(remove_param); + zephir_get_arrval(&attributes, attributes_param); } - zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); - zephir_is_iterable(&_0, 0, "phalcon/Flash/Direct.zep", 38); - if (Z_TYPE_P(&_0) == IS_ARRAY) { - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&_0), _1) - { - ZEPHIR_INIT_NVAR(&message); - ZVAL_COPY(&message, _1); - zend_print_zval(&message, 0); - } ZEND_HASH_FOREACH_END(); - } else { - ZEPHIR_CALL_METHOD(NULL, &_0, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2, &_0, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2)) { - break; - } - ZEPHIR_CALL_METHOD(&message, &_0, "current", NULL, 0); - zephir_check_call_status(); - zend_print_zval(&message, 0); - ZEPHIR_CALL_METHOD(NULL, &_0, "next", NULL, 0); - zephir_check_call_status(); - } - } - ZEPHIR_INIT_NVAR(&message); - if (remove) { - ZEPHIR_CALL_PARENT(NULL, phalcon_flash_direct_ce, getThis(), "clear", &_3, 0); - zephir_check_call_status(); + ZEPHIR_INIT_VAR(&_0); + zephir_fast_trim(&_0, &name, NULL , ZEPHIR_TRIM_BOTH); + zephir_get_strval(&name, &_0); + if (UNEXPECTED(ZEPHIR_IS_EMPTY(&name))) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Form element name is required", "phalcon/Forms/Element/AbstractElement.zep", 54); + return; } + zephir_update_property_zval(this_ptr, SL("name"), &name); + zephir_update_property_zval(this_ptr, SL("attributes"), &attributes); + ZEPHIR_INIT_VAR(&_1); + object_init_ex(&_1, phalcon_messages_messages_ce); + ZEPHIR_CALL_METHOD(NULL, &_1, "__construct", NULL, 7); + zephir_check_call_status(); + zephir_update_property_zval(this_ptr, SL("messages"), &_1); ZEPHIR_MM_RESTORE(); } +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, __toString) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *this_ptr = getThis(); -#ifdef HAVE_CONFIG_H -#endif - - + ZEPHIR_MM_GROW(); + ZEPHIR_RETURN_CALL_METHOD(this_ptr, "render", NULL, 0); + zephir_check_call_status(); + RETURN_MM(); +} -ZEPHIR_INIT_CLASS(Phalcon_Flash_Exception) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, addFilter) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Flash, Exception, phalcon, flash_exception, phalcon_exception_ce, NULL, 0); + zval _1$$5, _2$$6; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *filter_param = NULL, filters, _0; + zval filter; + zval *this_ptr = getThis(); - return SUCCESS; + ZVAL_UNDEF(&filter); + ZVAL_UNDEF(&filters); + ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&_1$$5); + ZVAL_UNDEF(&_2$$6); -} + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &filter_param); + zephir_get_strval(&filter, filter_param); + zephir_read_property(&_0, this_ptr, SL("filters"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&filters, &_0); + if (Z_TYPE_P(&filters) == IS_ARRAY) { + zephir_update_property_array_append(this_ptr, SL("filters"), &filter); + } else { + if (Z_TYPE_P(&filters) == IS_STRING) { + ZEPHIR_INIT_VAR(&_1$$5); + zephir_create_array(&_1$$5, 2, 0); + zephir_array_fast_append(&_1$$5, &filters); + zephir_array_fast_append(&_1$$5, &filter); + zephir_update_property_zval(this_ptr, SL("filters"), &_1$$5); + } else { + ZEPHIR_INIT_VAR(&_2$$6); + zephir_create_array(&_2$$6, 1, 0); + zephir_array_fast_append(&_2$$6, &filter); + zephir_update_property_zval(this_ptr, SL("filters"), &_2$$6); + } + } + RETURN_THIS(); -#ifdef HAVE_CONFIG_H -#endif +} +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, addValidator) { + zval *validator, validator_sub; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&validator_sub); + zephir_fetch_params_without_memory_grow(1, 0, &validator); -ZEPHIR_INIT_CLASS(Phalcon_Flash_FlashInterface) { - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Flash, FlashInterface, phalcon, flash_flashinterface, phalcon_flash_flashinterface_method_entry); - return SUCCESS; + zephir_update_property_array_append(this_ptr, SL("validators"), validator); + RETURN_THISW(); } -ZEPHIR_DOC_METHOD(Phalcon_Flash_FlashInterface, error); - -ZEPHIR_DOC_METHOD(Phalcon_Flash_FlashInterface, message); +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, addValidators) { -ZEPHIR_DOC_METHOD(Phalcon_Flash_FlashInterface, notice); + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_bool merge; + zval *validators_param = NULL, *merge_param = NULL, _0$$3, _1$$3; + zval validators; + zval *this_ptr = getThis(); -ZEPHIR_DOC_METHOD(Phalcon_Flash_FlashInterface, success); + ZVAL_UNDEF(&validators); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_1$$3); -ZEPHIR_DOC_METHOD(Phalcon_Flash_FlashInterface, warning); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 1, &validators_param, &merge_param); + ZEPHIR_OBS_COPY_OR_DUP(&validators, validators_param); + if (!merge_param) { + merge = 1; + } else { + merge = zephir_get_boolval(merge_param); + } + if (merge) { + ZEPHIR_INIT_VAR(&_0$$3); + zephir_read_property(&_1$$3, this_ptr, SL("validators"), PH_NOISY_CC | PH_READONLY); + zephir_fast_array_merge(&_0$$3, &_1$$3, &validators); + ZEPHIR_CPY_WRT(&validators, &_0$$3); + } + zephir_update_property_zval(this_ptr, SL("validators"), &validators); + RETURN_THIS(); -#ifdef HAVE_CONFIG_H -#endif +} +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, appendMessage) { + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval *message, message_sub, _0; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&message_sub); + ZVAL_UNDEF(&_0); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &message); -ZEPHIR_INIT_CLASS(Phalcon_Flash_Session) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Flash, Session, phalcon, flash_session, phalcon_flash_abstractflash_ce, phalcon_flash_session_method_entry, 0); - return SUCCESS; + zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CALL_METHOD(NULL, &_0, "appendmessage", NULL, 0, message); + zephir_check_call_status(); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Flash_Session, clear) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, clear) { - zval _0; + zval form, _0, name, value; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zephir_fcall_cache_entry *_1 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *this_ptr = getThis(); + ZVAL_UNDEF(&form); ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&value); ZEPHIR_MM_GROW(); - ZVAL_BOOL(&_0, 1); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "getsessionmessages", NULL, 0, &_0); - zephir_check_call_status(); - ZEPHIR_CALL_PARENT(NULL, phalcon_flash_session_ce, getThis(), "clear", &_1, 0); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + zephir_read_property(&_0, this_ptr, SL("form"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&form, &_0); + zephir_read_property(&_0, this_ptr, SL("name"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&name, &_0); + zephir_read_property(&_0, this_ptr, SL("value"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&value, &_0); + if (Z_TYPE_P(&form) == IS_OBJECT) { + ZEPHIR_CALL_METHOD(NULL, &form, "clear", NULL, 0, &name); + zephir_check_call_status(); + } else { + ZEPHIR_CALL_CE_STATIC(NULL, phalcon_tag_ce, "setdefault", &_1, 0, &name, &value); + zephir_check_call_status(); + } + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Flash_Session, getMessages) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getAttribute) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zend_bool remove; - zval *type = NULL, type_sub, *remove_param = NULL, __$null, _0; + zval *attribute_param = NULL, *defaultValue = NULL, defaultValue_sub, __$null, attributes, value, _0; + zval attribute; zval *this_ptr = getThis(); - ZVAL_UNDEF(&type_sub); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&defaultValue_sub); ZVAL_NULL(&__$null); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 2, &type, &remove_param); + zephir_fetch_params(1, 1, 1, &attribute_param, &defaultValue); - if (!type) { - type = &type_sub; - type = &__$null; - } - if (!remove_param) { - remove = 1; - } else { - remove = zephir_get_boolval(remove_param); + zephir_get_strval(&attribute, attribute_param); + if (!defaultValue) { + defaultValue = &defaultValue_sub; + defaultValue = &__$null; } - if (remove) { - ZVAL_BOOL(&_0, 1); - } else { - ZVAL_BOOL(&_0, 0); + zephir_read_property(&_0, this_ptr, SL("attributes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&attributes, &_0); + if (!(zephir_array_isset_fetch(&value, &attributes, &attribute, 1))) { + RETVAL_ZVAL(defaultValue, 1, 0); + RETURN_MM(); } - ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsessionmessages", NULL, 0, &_0, type); - zephir_check_call_status(); - RETURN_MM(); + RETURN_CTOR(&value); } -static PHP_METHOD(Phalcon_Flash_Session, has) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getAttributes) { + zval attributes, _0; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *type = NULL, type_sub, __$null, messages, _0; zval *this_ptr = getThis(); - ZVAL_UNDEF(&type_sub); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&_0); + + ZEPHIR_MM_GROW(); + + zephir_read_property(&_0, this_ptr, SL("attributes"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&attributes, &_0); + RETURN_CCTOR(&attributes); + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getDefault) { + + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "value"); + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getFilters) { + + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "filters"); + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getForm) { + + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "form"); + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getLabel) { + + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "label"); + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getMessages) { + + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "messages"); + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getName) { + + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "name"); + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getUserOption) { + + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *option_param = NULL, *defaultValue = NULL, defaultValue_sub, __$null, value, _0; + zval option; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&option); + ZVAL_UNDEF(&defaultValue_sub); ZVAL_NULL(&__$null); - ZVAL_UNDEF(&messages); + ZVAL_UNDEF(&value); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &type); + zephir_fetch_params(1, 1, 1, &option_param, &defaultValue); - if (!type) { - type = &type_sub; - type = &__$null; + zephir_get_strval(&option, option_param); + if (!defaultValue) { + defaultValue = &defaultValue_sub; + defaultValue = &__$null; } - ZVAL_BOOL(&_0, 0); - ZEPHIR_CALL_METHOD(&messages, this_ptr, "getsessionmessages", NULL, 0, &_0); - zephir_check_call_status(); - if (Z_TYPE_P(type) != IS_STRING) { - RETURN_MM_BOOL(1); + zephir_read_property(&_0, this_ptr, SL("options"), PH_NOISY_CC | PH_READONLY); + if (!(zephir_array_isset_fetch(&value, &_0, &option, 1))) { + RETVAL_ZVAL(defaultValue, 1, 0); + RETURN_MM(); } - RETURN_MM_BOOL(zephir_array_isset(&messages, type)); + RETURN_CTOR(&value); } -static PHP_METHOD(Phalcon_Flash_Session, message) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getUserOptions) { + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "options"); + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getValidators) { + + zval *this_ptr = getThis(); + + + RETURN_MEMBER(getThis(), "validators"); + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, getValue) { + + zval name, _0, form, value, _1, _4$$5; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_2 = NULL, *_3 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *type_param = NULL, *message_param = NULL, messages, _0, _1$$3; - zval type, message; zval *this_ptr = getThis(); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&messages); + ZVAL_UNDEF(&name); ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1$$3); + ZVAL_UNDEF(&form); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_4$$5); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 2, 0, &type_param, &message_param); - zephir_get_strval(&type, type_param); - zephir_get_strval(&message, message_param); - - - ZVAL_BOOL(&_0, 0); - ZEPHIR_CALL_METHOD(&messages, this_ptr, "getsessionmessages", NULL, 0, &_0); - zephir_check_call_status(); - if (!(zephir_array_isset(&messages, &type))) { - ZEPHIR_INIT_VAR(&_1$$3); - array_init(&_1$$3); - zephir_array_update_zval(&messages, &type, &_1$$3, PH_COPY | PH_SEPARATE); + zephir_read_property(&_0, this_ptr, SL("name"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&name, &_0); + zephir_read_property(&_0, this_ptr, SL("form"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&form, &_0); + ZEPHIR_INIT_VAR(&value); + ZVAL_NULL(&value); + if (Z_TYPE_P(&form) == IS_OBJECT) { + ZEPHIR_RETURN_CALL_METHOD(&form, "getvalue", NULL, 0, &name); + zephir_check_call_status(); + RETURN_MM(); } - zephir_array_update_multi(&messages, &message, SL("za"), 2, &type); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "setsessionmessages", NULL, 0, &messages); + ZEPHIR_CALL_CE_STATIC(&_1, phalcon_tag_ce, "hasvalue", &_2, 0, &name); zephir_check_call_status(); - RETURN_MM_NULL(); + if (zephir_is_true(&_1)) { + ZEPHIR_CALL_CE_STATIC(&value, phalcon_tag_ce, "getvalue", &_3, 0, &name); + zephir_check_call_status(); + } + if (Z_TYPE_P(&value) == IS_NULL) { + zephir_read_property(&_4$$5, this_ptr, SL("value"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&value, &_4$$5); + } + RETURN_CCTOR(&value); } -static PHP_METHOD(Phalcon_Flash_Session, output) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, hasMessages) { - zend_string *_4; - zend_ulong _3; + zval _0; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&_0); + + + zephir_read_property(&_0, this_ptr, SL("messages"), PH_NOISY_CC | PH_READONLY); + RETURN_BOOL(zephir_fast_count_int(&_0) > 0); + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, label) { + + zend_bool _4; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_5 = NULL, *_6 = NULL; + zephir_fcall_cache_entry *_1 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *remove_param = NULL, type, message, messages, _0, *_1, _2; - zend_bool remove; + zval *attributes_param = NULL, internalAttributes, label, name, code, _2, _3, _0$$3, _5$$5, _6$$6; + zval attributes; zval *this_ptr = getThis(); - ZVAL_UNDEF(&type); - ZVAL_UNDEF(&message); - ZVAL_UNDEF(&messages); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&internalAttributes); + ZVAL_UNDEF(&label); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&code); ZVAL_UNDEF(&_2); + ZVAL_UNDEF(&_3); + ZVAL_UNDEF(&_0$$3); + ZVAL_UNDEF(&_5$$5); + ZVAL_UNDEF(&_6$$6); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 0, 1, &remove_param); + zephir_fetch_params(1, 0, 1, &attributes_param); - if (!remove_param) { - remove = 1; + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); } else { - remove = zephir_get_boolval(remove_param); + zephir_get_arrval(&attributes, attributes_param); } - if (remove) { - ZVAL_BOOL(&_0, 1); - } else { - ZVAL_BOOL(&_0, 0); + ZEPHIR_CALL_METHOD(&internalAttributes, this_ptr, "getattributes", NULL, 0); + zephir_check_call_status(); + ZEPHIR_OBS_VAR(&name); + if (!(zephir_array_isset_string_fetch(&name, &internalAttributes, SL("id"), 0))) { + zephir_read_property(&_0$$3, this_ptr, SL("name"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&name, &_0$$3); } - ZEPHIR_CALL_METHOD(&messages, this_ptr, "getsessionmessages", NULL, 0, &_0); + if (!(zephir_array_isset_string(&attributes, SL("for")))) { + zephir_array_update_string(&attributes, SL("for"), &name, PH_COPY | PH_SEPARATE); + } + ZEPHIR_INIT_VAR(&_2); + ZVAL_STRING(&_2, "", &label, ""); + zephir_concat_self(&code, &_5$$5); } else { - ZEPHIR_CALL_METHOD(NULL, &messages, "rewind", NULL, 0); - zephir_check_call_status(); - while (1) { - ZEPHIR_CALL_METHOD(&_2, &messages, "valid", NULL, 0); - zephir_check_call_status(); - if (!zend_is_true(&_2)) { - break; - } - ZEPHIR_CALL_METHOD(&type, &messages, "key", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(&message, &messages, "current", NULL, 0); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "outputmessage", &_5, 0, &type, &message); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &messages, "next", NULL, 0); - zephir_check_call_status(); - } + ZEPHIR_INIT_VAR(&_6$$6); + ZEPHIR_CONCAT_SVS(&_6$$6, ">", &name, ""); + zephir_concat_self(&code, &_6$$6); } - ZEPHIR_INIT_NVAR(&message); - ZEPHIR_INIT_NVAR(&type); - ZEPHIR_CALL_PARENT(NULL, phalcon_flash_session_ce, getThis(), "clear", &_6, 0); - zephir_check_call_status(); - ZEPHIR_MM_RESTORE(); + RETURN_CCTOR(&code); } -static PHP_METHOD(Phalcon_Flash_Session, getSessionMessages) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, prepareAttributes) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; - zval *remove_param = NULL, *type = NULL, type_sub, __$null, session, messages, returnMessages, _0, _1$$6, _2$$7; - zend_bool remove; + zend_bool useChecked; + zval *attributes_param = NULL, *useChecked_param = NULL, value, name, mergedAttributes, defaultAttributes, currentValue, _0, _1$$6, _2$$8; + zval attributes; zval *this_ptr = getThis(); - ZVAL_UNDEF(&type_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(&session); - ZVAL_UNDEF(&messages); - ZVAL_UNDEF(&returnMessages); + ZVAL_UNDEF(&attributes); + ZVAL_UNDEF(&value); + ZVAL_UNDEF(&name); + ZVAL_UNDEF(&mergedAttributes); + ZVAL_UNDEF(&defaultAttributes); + ZVAL_UNDEF(¤tValue); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1$$6); - ZVAL_UNDEF(&_2$$7); + ZVAL_UNDEF(&_2$$8); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, &remove_param, &type); + zephir_fetch_params(1, 0, 2, &attributes_param, &useChecked_param); - remove = zephir_get_boolval(remove_param); - if (!type) { - type = &type_sub; - type = &__$null; + if (!attributes_param) { + ZEPHIR_INIT_VAR(&attributes); + array_init(&attributes); + } else { + zephir_get_arrval(&attributes, attributes_param); + } + if (!useChecked_param) { + useChecked = 0; + } else { + useChecked = zephir_get_boolval(useChecked_param); } - ZEPHIR_CALL_METHOD(&session, this_ptr, "getsessionservice", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "_flashMessages"); - ZEPHIR_CALL_METHOD(&messages, &session, "get", NULL, 0, &_0); + zephir_read_property(&_0, this_ptr, SL("name"), PH_NOISY_CC | PH_READONLY); + ZEPHIR_CPY_WRT(&name, &_0); + zephir_array_update_long(&attributes, 0, &name, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); + ZEPHIR_OBS_VAR(&defaultAttributes); + zephir_read_property(&defaultAttributes, this_ptr, SL("attributes"), PH_NOISY_CC); + ZEPHIR_INIT_VAR(&mergedAttributes); + zephir_fast_array_merge(&mergedAttributes, &defaultAttributes, &attributes); + ZEPHIR_CALL_METHOD(&value, this_ptr, "getvalue", NULL, 0); zephir_check_call_status(); - if (Z_TYPE_P(&messages) != IS_ARRAY) { - ZEPHIR_INIT_NVAR(&messages); - array_init(&messages); - } - if (Z_TYPE_P(type) == IS_STRING) { - ZEPHIR_OBS_VAR(&returnMessages); - if (zephir_array_isset_fetch(&returnMessages, &messages, type, 0)) { - if (remove) { - zephir_array_unset(&messages, type, PH_SEPARATE); - ZEPHIR_INIT_VAR(&_1$$6); - ZVAL_STRING(&_1$$6, "_flashMessages"); - ZEPHIR_CALL_METHOD(NULL, &session, "set", NULL, 0, &_1$$6, &messages); - zephir_check_call_status(); + if (Z_TYPE_P(&value) != IS_NULL) { + if (useChecked) { + if (zephir_array_isset_string_fetch(¤tValue, &mergedAttributes, SL("value"), 1)) { + if (ZEPHIR_IS_EQUAL(¤tValue, &value)) { + ZEPHIR_INIT_VAR(&_1$$6); + ZVAL_STRING(&_1$$6, "checked"); + zephir_array_update_string(&mergedAttributes, SL("checked"), &_1$$6, PH_COPY | PH_SEPARATE); + } + } else { + if (zephir_is_true(&value)) { + ZEPHIR_INIT_VAR(&_2$$8); + ZVAL_STRING(&_2$$8, "checked"); + zephir_array_update_string(&mergedAttributes, SL("checked"), &_2$$8, PH_COPY | PH_SEPARATE); + } + zephir_array_update_string(&mergedAttributes, SL("value"), &value, PH_COPY | PH_SEPARATE); } - RETURN_CCTOR(&returnMessages); + } else { + zephir_array_update_string(&mergedAttributes, SL("value"), &value, PH_COPY | PH_SEPARATE); } - array_init(return_value); - RETURN_MM(); - } - if (remove) { - ZEPHIR_INIT_VAR(&_2$$7); - ZVAL_STRING(&_2$$7, "_flashMessages"); - ZEPHIR_CALL_METHOD(NULL, &session, "remove", NULL, 0, &_2$$7); - zephir_check_call_status(); } - RETURN_CCTOR(&messages); + RETURN_CCTOR(&mergedAttributes); } -static PHP_METHOD(Phalcon_Flash_Session, setSessionMessages) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setAttribute) { zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval *messages_param = NULL, session, _0; - zval messages; + zval *attribute_param = NULL, *value, value_sub; + zval attribute; zval *this_ptr = getThis(); - ZVAL_UNDEF(&messages); - ZVAL_UNDEF(&session); - ZVAL_UNDEF(&_0); + ZVAL_UNDEF(&attribute); + ZVAL_UNDEF(&value_sub); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 0, &messages_param); + zephir_fetch_params(1, 2, 0, &attribute_param, &value); - ZEPHIR_OBS_COPY_OR_DUP(&messages, messages_param); + zephir_get_strval(&attribute, attribute_param); - ZEPHIR_CALL_METHOD(&session, this_ptr, "getsessionservice", NULL, 0); - zephir_check_call_status(); - ZEPHIR_INIT_VAR(&_0); - ZVAL_STRING(&_0, "_flashMessages"); - ZEPHIR_CALL_METHOD(NULL, &session, "set", NULL, 0, &_0, &messages); - zephir_check_call_status(); - RETURN_CTOR(&messages); + zephir_update_property_array(this_ptr, SL("attributes"), &attribute, value); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Flash_Session, getSessionService) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setAttributes) { - zval container, _0, _1, _6, _7, _2$$4, _3$$4, _5$$4, _8$$5, _9$$5, _10$$6, _11$$6, _12$$6; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_4 = NULL; + zval *attributes_param = NULL; + zval attributes; zval *this_ptr = getThis(); - ZVAL_UNDEF(&container); - ZVAL_UNDEF(&_0); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_6); - ZVAL_UNDEF(&_7); - ZVAL_UNDEF(&_2$$4); - ZVAL_UNDEF(&_3$$4); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_8$$5); - ZVAL_UNDEF(&_9$$5); - ZVAL_UNDEF(&_10$$6); - ZVAL_UNDEF(&_11$$6); - ZVAL_UNDEF(&_12$$6); + ZVAL_UNDEF(&attributes); ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &attributes_param); - zephir_read_property(&_0, this_ptr, SL("sessionService"), PH_NOISY_CC | PH_READONLY); - if (zephir_is_true(&_0)) { - RETURN_MM_MEMBER(getThis(), "sessionService"); - } - zephir_read_property(&_1, this_ptr, SL("container"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CPY_WRT(&container, &_1); - if (UNEXPECTED(Z_TYPE_P(&container) != IS_OBJECT)) { - ZEPHIR_INIT_VAR(&_2$$4); - object_init_ex(&_2$$4, phalcon_flash_exception_ce); - ZEPHIR_INIT_VAR(&_5$$4); - ZVAL_STRING(&_5$$4, "the 'session' service"); - ZEPHIR_CALL_CE_STATIC(&_3$$4, phalcon_flash_exception_ce, "containerservicenotfound", &_4, 0, &_5$$4); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_2$$4, "__construct", NULL, 6, &_3$$4); - zephir_check_call_status(); - zephir_throw_exception_debug(&_2$$4, "phalcon/Flash/Session.zep", 157); - ZEPHIR_MM_RESTORE(); - return; + ZEPHIR_OBS_COPY_OR_DUP(&attributes, attributes_param); + + + zephir_update_property_zval(this_ptr, SL("attributes"), &attributes); + RETURN_THIS(); + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setDefault) { + + zval *value, value_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&value_sub); + + zephir_fetch_params_without_memory_grow(1, 0, &value); + + + + zephir_update_property_zval(this_ptr, SL("value"), value); + RETURN_THISW(); + +} + +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setFilters) { + + zend_bool _0; + zval *filters, filters_sub; + zval *this_ptr = getThis(); + + ZVAL_UNDEF(&filters_sub); + + zephir_fetch_params_without_memory_grow(1, 0, &filters); + + + + _0 = Z_TYPE_P(filters) != IS_STRING; + if (_0) { + _0 = Z_TYPE_P(filters) != IS_ARRAY; } - ZEPHIR_INIT_VAR(&_7); - ZVAL_STRING(&_7, "session"); - ZEPHIR_CALL_METHOD(&_6, &container, "has", NULL, 0, &_7); - zephir_check_call_status(); - if (UNEXPECTED(zephir_is_true(&_6))) { - ZEPHIR_INIT_VAR(&_9$$5); - ZVAL_STRING(&_9$$5, "session"); - ZEPHIR_CALL_METHOD(&_8$$5, &container, "getshared", NULL, 0, &_9$$5); - zephir_check_call_status(); - RETURN_CCTOR(&_8$$5); - } else { - ZEPHIR_INIT_VAR(&_10$$6); - object_init_ex(&_10$$6, phalcon_flash_exception_ce); - ZEPHIR_INIT_VAR(&_12$$6); - ZVAL_STRING(&_12$$6, "the 'session' service"); - ZEPHIR_CALL_CE_STATIC(&_11$$6, phalcon_flash_exception_ce, "containerservicenotfound", &_4, 0, &_12$$6); - zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, &_10$$6, "__construct", NULL, 6, &_11$$6); - zephir_check_call_status(); - zephir_throw_exception_debug(&_10$$6, "phalcon/Flash/Session.zep", 165); - ZEPHIR_MM_RESTORE(); + if (UNEXPECTED(_0)) { + ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_forms_exception_ce, "Wrong filter type added", "phalcon/Forms/Element/AbstractElement.zep", 435); return; } + zephir_update_property_zval(this_ptr, SL("filters"), filters); + RETURN_THISW(); } +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setForm) { + zval *form, form_sub; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&form_sub); -#ifdef HAVE_CONFIG_H -#endif + zephir_fetch_params_without_memory_grow(1, 0, &form); + zephir_update_property_zval(this_ptr, SL("form"), form); + RETURN_THISW(); +} -ZEPHIR_INIT_CLASS(Phalcon_Tag_Exception) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setLabel) { - ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Tag, Exception, phalcon, tag_exception, phalcon_exception_ce, NULL, 0); + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zval *label_param = NULL; + zval label; + zval *this_ptr = getThis(); - return SUCCESS; + ZVAL_UNDEF(&label); -} + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 1, 0, &label_param); + zephir_get_strval(&label, label_param); + zephir_update_property_zval(this_ptr, SL("label"), &label); + RETURN_THIS(); -#ifdef HAVE_CONFIG_H -#endif +} +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setMessages) { + zval *messages, messages_sub; + zval *this_ptr = getThis(); + ZVAL_UNDEF(&messages_sub); + zephir_fetch_params_without_memory_grow(1, 0, &messages); -ZEPHIR_INIT_CLASS(Phalcon_Tag_Select) { - ZEPHIR_REGISTER_CLASS(Phalcon\\Tag, Select, phalcon, tag_select, phalcon_tag_select_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - return SUCCESS; + zephir_update_property_zval(this_ptr, SL("messages"), messages); + RETURN_THISW(); } -static PHP_METHOD(Phalcon_Tag_Select, selectField) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setName) { - zend_bool _2$$19; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zephir_fcall_cache_entry *_1 = NULL, *_4 = NULL, *_9 = NULL, *_13 = NULL; - zval *parameters, parameters_sub, *data = NULL, data_sub, __$null, params, name, id, value, useEmpty, code, emptyValue, emptyText, options, using, _3, _5, _0$$5, _6$$22, _7$$22, _8$$23, _10$$23, _11$$23, _12$$25, _14$$25, _15$$25; + zval *name_param = NULL; + zval name; zval *this_ptr = getThis(); - ZVAL_UNDEF(¶meters_sub); - ZVAL_UNDEF(&data_sub); - ZVAL_NULL(&__$null); - ZVAL_UNDEF(¶ms); ZVAL_UNDEF(&name); - ZVAL_UNDEF(&id); - ZVAL_UNDEF(&value); - ZVAL_UNDEF(&useEmpty); - ZVAL_UNDEF(&code); - ZVAL_UNDEF(&emptyValue); - ZVAL_UNDEF(&emptyText); - ZVAL_UNDEF(&options); - ZVAL_UNDEF(&using); - ZVAL_UNDEF(&_3); - ZVAL_UNDEF(&_5); - ZVAL_UNDEF(&_0$$5); - ZVAL_UNDEF(&_6$$22); - ZVAL_UNDEF(&_7$$22); - ZVAL_UNDEF(&_8$$23); - ZVAL_UNDEF(&_10$$23); - ZVAL_UNDEF(&_11$$23); - ZVAL_UNDEF(&_12$$25); - ZVAL_UNDEF(&_14$$25); - ZVAL_UNDEF(&_15$$25); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 1, 1, ¶meters, &data); - - if (!data) { - data = &data_sub; - data = &__$null; - } - + zephir_fetch_params(1, 1, 0, &name_param); - if (Z_TYPE_P(parameters) != IS_ARRAY) { - ZEPHIR_INIT_VAR(¶ms); - zephir_create_array(¶ms, 2, 0); - zephir_array_fast_append(¶ms, parameters); - zephir_array_fast_append(¶ms, data); - } else { - ZEPHIR_CPY_WRT(¶ms, parameters); - } - ZEPHIR_OBS_VAR(&id); - if (!(zephir_array_isset_long_fetch(&id, ¶ms, 0, 0))) { - zephir_array_fetch_string(&_0$$5, ¶ms, SL("id"), PH_NOISY | PH_READONLY, "phalcon/Tag/Select.zep", 50); - zephir_array_update_long(¶ms, 0, &_0$$5, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY); - } - if (!(zephir_memnstr_str(&id, SL("["), "phalcon/Tag/Select.zep", 56))) { - if (!(zephir_array_isset_string(¶ms, SL("id")))) { - zephir_array_update_string(¶ms, SL("id"), &id, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_OBS_VAR(&name); - if (!(zephir_array_isset_string_fetch(&name, ¶ms, SL("name"), 0))) { - zephir_array_update_string(¶ms, SL("name"), &id, PH_COPY | PH_SEPARATE); - } else { - if (!(zephir_is_true(&name))) { - zephir_array_update_string(¶ms, SL("name"), &id, PH_COPY | PH_SEPARATE); - } - } - ZEPHIR_OBS_VAR(&value); - if (!(zephir_array_isset_string_fetch(&value, ¶ms, SL("value"), 0))) { - ZEPHIR_CALL_CE_STATIC(&value, phalcon_tag_ce, "getvalue", &_1, 0, &id, ¶ms); - zephir_check_call_status(); - } else { - zephir_array_unset_string(¶ms, SL("value"), PH_SEPARATE); - } - ZEPHIR_OBS_VAR(&useEmpty); - if (zephir_array_isset_string_fetch(&useEmpty, ¶ms, SL("useEmpty"), 0)) { - ZEPHIR_OBS_VAR(&emptyValue); - if (!(zephir_array_isset_string_fetch(&emptyValue, ¶ms, SL("emptyValue"), 0))) { - ZEPHIR_INIT_NVAR(&emptyValue); - ZVAL_STRING(&emptyValue, ""); - } else { - zephir_array_unset_string(¶ms, SL("emptyValue"), PH_SEPARATE); - } - ZEPHIR_OBS_VAR(&emptyText); - if (!(zephir_array_isset_string_fetch(&emptyText, ¶ms, SL("emptyText"), 0))) { - ZEPHIR_INIT_NVAR(&emptyText); - ZVAL_STRING(&emptyText, "Choose..."); - } else { - zephir_array_unset_string(¶ms, SL("emptyText"), PH_SEPARATE); - } - zephir_array_unset_string(¶ms, SL("useEmpty"), PH_SEPARATE); - } - ZEPHIR_OBS_VAR(&options); - if (!(zephir_array_isset_long_fetch(&options, ¶ms, 1, 0))) { - ZEPHIR_CPY_WRT(&options, data); - } - if (Z_TYPE_P(&options) == IS_OBJECT) { - ZEPHIR_OBS_VAR(&using); - if (UNEXPECTED(!(zephir_array_isset_string_fetch(&using, ¶ms, SL("using"), 0)))) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_tag_exception_ce, "The 'using' parameter is required", "phalcon/Tag/Select.zep", 101); - return; - } - _2$$19 = Z_TYPE_P(&using) != IS_ARRAY; - if (_2$$19) { - _2$$19 = Z_TYPE_P(&using) != IS_OBJECT; - } - if (UNEXPECTED(_2$$19)) { - ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_tag_exception_ce, "The 'using' parameter should be an array", "phalcon/Tag/Select.zep", 107); - return; - } - } - zephir_array_unset_string(¶ms, SL("using"), PH_SEPARATE); - ZEPHIR_INIT_VAR(&_5); - ZVAL_STRING(&_5, "", &_5); - if (zephir_is_true(&useEmpty)) { - ZEPHIR_INIT_VAR(&_6$$22); - ZEPHIR_GET_CONSTANT(&_6$$22, "PHP_EOL"); - ZEPHIR_INIT_VAR(&_7$$22); - ZEPHIR_CONCAT_SVSVSV(&_7$$22, "\t", &_6$$22); - zephir_concat_self(&code, &_7$$22); + if (UNEXPECTED(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { + zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be of the type string")); + RETURN_MM_NULL(); } - if (Z_TYPE_P(&options) == IS_OBJECT) { - ZEPHIR_INIT_VAR(&_10$$23); - ZEPHIR_GET_CONSTANT(&_10$$23, "PHP_EOL"); - ZEPHIR_INIT_VAR(&_11$$23); - ZEPHIR_CONCAT_SV(&_11$$23, "", &_10$$23); - ZEPHIR_CALL_SELF(&_8$$23, "optionsfromresultset", &_9, 505, &options, &using, &value, &_11$$23); - zephir_check_call_status(); - zephir_concat_self(&code, &_8$$23); + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - if (Z_TYPE_P(&options) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&_14$$25); - ZEPHIR_GET_CONSTANT(&_14$$25, "PHP_EOL"); - ZEPHIR_INIT_VAR(&_15$$25); - ZEPHIR_CONCAT_SV(&_15$$25, "", &_14$$25); - ZEPHIR_CALL_SELF(&_12$$25, "optionsfromarray", &_13, 506, &options, &value, &_15$$25); - zephir_check_call_status(); - zephir_concat_self(&code, &_12$$25); - } + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); } - zephir_concat_self_str(&code, SL("")); - RETURN_CCTOR(&code); + + + zephir_update_property_zval(this_ptr, SL("name"), &name); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Tag_Select, optionsFromArray) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setUserOption) { - zend_string *_3; - zend_ulong _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval closeOption, _12$$8, _13$$8, _22$$16, _23$$16; - zval *data_param = NULL, *value, value_sub, *closeOption_param = NULL, strValue, strOptionValue, code, optionValue, optionText, escaped, *_0, _1, _5$$4, _6$$4, _8$$4, _9$$4, _10$$6, _11$$7, _14$$9, _15$$10, _16$$12, _17$$12, _18$$12, _19$$12, _20$$14, _21$$15, _24$$17, _25$$18; - zval data; + zval *option_param = NULL, *value, value_sub; + zval option; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data); + ZVAL_UNDEF(&option); ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&strValue); - ZVAL_UNDEF(&strOptionValue); - ZVAL_UNDEF(&code); - ZVAL_UNDEF(&optionValue); - ZVAL_UNDEF(&optionText); - ZVAL_UNDEF(&escaped); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_10$$6); - ZVAL_UNDEF(&_11$$7); - ZVAL_UNDEF(&_14$$9); - ZVAL_UNDEF(&_15$$10); - ZVAL_UNDEF(&_16$$12); - ZVAL_UNDEF(&_17$$12); - ZVAL_UNDEF(&_18$$12); - ZVAL_UNDEF(&_19$$12); - ZVAL_UNDEF(&_20$$14); - ZVAL_UNDEF(&_21$$15); - ZVAL_UNDEF(&_24$$17); - ZVAL_UNDEF(&_25$$18); - ZVAL_UNDEF(&closeOption); - ZVAL_UNDEF(&_12$$8); - ZVAL_UNDEF(&_13$$8); - ZVAL_UNDEF(&_22$$16); - ZVAL_UNDEF(&_23$$16); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &data_param, &value, &closeOption_param); + zephir_fetch_params(1, 2, 0, &option_param, &value); - zephir_get_arrval(&data, data_param); - zephir_get_strval(&closeOption, closeOption_param); + zephir_get_strval(&option, option_param); - ZEPHIR_INIT_VAR(&code); - ZVAL_STRING(&code, ""); - zephir_is_iterable(&data, 0, "phalcon/Tag/Select.zep", 186); - if (Z_TYPE_P(&data) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2, _3, _0) - { - ZEPHIR_INIT_NVAR(&optionValue); - if (_3 != NULL) { - ZVAL_STR_COPY(&optionValue, _3); - } else { - ZVAL_LONG(&optionValue, _2); - } - ZEPHIR_INIT_NVAR(&optionText); - ZVAL_COPY(&optionText, _0); - ZEPHIR_CALL_FUNCTION(&escaped, "htmlspecialchars", &_4, 227, &optionValue); - zephir_check_call_status(); - if (Z_TYPE_P(&optionText) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(&_5$$4); - ZEPHIR_GET_CONSTANT(&_5$$4, "PHP_EOL"); - ZEPHIR_CALL_SELF(&_6$$4, "optionsfromarray", &_7, 506, &optionText, value, &closeOption); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_8$$4); - ZEPHIR_GET_CONSTANT(&_8$$4, "PHP_EOL"); - ZEPHIR_INIT_NVAR(&_9$$4); - ZEPHIR_CONCAT_SVSVVSV(&_9$$4, "\t", &_5$$4, &_6$$4, "\t", &_8$$4); - zephir_concat_self(&code, &_9$$4); - continue; - } - if (Z_TYPE_P(value) == IS_ARRAY) { - if (zephir_fast_in_array(&optionValue, value)) { - ZEPHIR_INIT_NVAR(&_10$$6); - ZEPHIR_CONCAT_SVSVV(&_10$$6, "\t", &_16$$12, &_17$$12, "\t", &_18$$12); - zephir_concat_self(&code, &_19$$12); - continue; - } - if (Z_TYPE_P(value) == IS_ARRAY) { - if (zephir_fast_in_array(&optionValue, value)) { - ZEPHIR_INIT_NVAR(&_20$$14); - ZEPHIR_CONCAT_SVSVV(&_20$$14, "\t", &_10$$23); + ZEPHIR_CALL_SELF(&_8$$23, "optionsfromresultset", &_9, 505, &options, &using, &value, &_11$$23); + zephir_check_call_status(); + zephir_concat_self(&code, &_8$$23); + } else { + if (Z_TYPE_P(&options) == IS_ARRAY) { + ZEPHIR_INIT_VAR(&_14$$25); + ZEPHIR_GET_CONSTANT(&_14$$25, "PHP_EOL"); + ZEPHIR_INIT_VAR(&_15$$25); + ZEPHIR_CONCAT_SV(&_15$$25, "", &_14$$25); + ZEPHIR_CALL_SELF(&_12$$25, "optionsfromarray", &_13, 506, &options, &value, &_15$$25); + zephir_check_call_status(); + zephir_concat_self(&code, &_12$$25); + } + } + zephir_concat_self_str(&code, SL("")); + RETURN_CCTOR(&code); } -static PHP_METHOD(Phalcon_Assets_Collection, setTargetLocal) { +static PHP_METHOD(Phalcon_Tag_Select, optionsFromArray) { - zval *targetLocal_param = NULL, __$true, __$false; - zend_bool targetLocal; + zend_string *_3; + zend_ulong _2; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval closeOption, _12$$8, _13$$8, _22$$16, _23$$16; + zval *data_param = NULL, *value, value_sub, *closeOption_param = NULL, strValue, strOptionValue, code, optionValue, optionText, escaped, *_0, _1, _5$$4, _6$$4, _8$$4, _9$$4, _10$$6, _11$$7, _14$$9, _15$$10, _16$$12, _17$$12, _18$$12, _19$$12, _20$$14, _21$$15, _24$$17, _25$$18; + zval data; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&strValue); + ZVAL_UNDEF(&strOptionValue); + ZVAL_UNDEF(&code); + ZVAL_UNDEF(&optionValue); + ZVAL_UNDEF(&optionText); + ZVAL_UNDEF(&escaped); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_10$$6); + ZVAL_UNDEF(&_11$$7); + ZVAL_UNDEF(&_14$$9); + ZVAL_UNDEF(&_15$$10); + ZVAL_UNDEF(&_16$$12); + ZVAL_UNDEF(&_17$$12); + ZVAL_UNDEF(&_18$$12); + ZVAL_UNDEF(&_19$$12); + ZVAL_UNDEF(&_20$$14); + ZVAL_UNDEF(&_21$$15); + ZVAL_UNDEF(&_24$$17); + ZVAL_UNDEF(&_25$$18); + ZVAL_UNDEF(&closeOption); + ZVAL_UNDEF(&_12$$8); + ZVAL_UNDEF(&_13$$8); + ZVAL_UNDEF(&_22$$16); + ZVAL_UNDEF(&_23$$16); - zephir_fetch_params_without_memory_grow(1, 0, &targetLocal_param); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 0, &data_param, &value, &closeOption_param); - if (UNEXPECTED(Z_TYPE_P(targetLocal_param) != IS_TRUE && Z_TYPE_P(targetLocal_param) != IS_FALSE)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'targetLocal' must be of the type bool")); - RETURN_NULL(); - } - targetLocal = (Z_TYPE_P(targetLocal_param) == IS_TRUE); + zephir_get_arrval(&data, data_param); + zephir_get_strval(&closeOption, closeOption_param); - if (targetLocal) { - zephir_update_property_zval(this_ptr, SL("targetLocal"), &__$true); + ZEPHIR_INIT_VAR(&code); + ZVAL_STRING(&code, ""); + zephir_is_iterable(&data, 0, "phalcon/Tag/Select.zep", 186); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&optionValue); + if (_3 != NULL) { + ZVAL_STR_COPY(&optionValue, _3); + } else { + ZVAL_LONG(&optionValue, _2); + } + ZEPHIR_INIT_NVAR(&optionText); + ZVAL_COPY(&optionText, _0); + ZEPHIR_CALL_FUNCTION(&escaped, "htmlspecialchars", &_4, 227, &optionValue); + zephir_check_call_status(); + if (Z_TYPE_P(&optionText) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&_5$$4); + ZEPHIR_GET_CONSTANT(&_5$$4, "PHP_EOL"); + ZEPHIR_CALL_SELF(&_6$$4, "optionsfromarray", &_7, 506, &optionText, value, &closeOption); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_8$$4); + ZEPHIR_GET_CONSTANT(&_8$$4, "PHP_EOL"); + ZEPHIR_INIT_NVAR(&_9$$4); + ZEPHIR_CONCAT_SVSVVSV(&_9$$4, "\t", &_5$$4, &_6$$4, "\t", &_8$$4); + zephir_concat_self(&code, &_9$$4); + continue; + } + if (Z_TYPE_P(value) == IS_ARRAY) { + if (zephir_fast_in_array(&optionValue, value)) { + ZEPHIR_INIT_NVAR(&_10$$6); + ZEPHIR_CONCAT_SVSVV(&_10$$6, "\t", &_16$$12, &_17$$12, "\t", &_18$$12); + zephir_concat_self(&code, &_19$$12); + continue; + } + if (Z_TYPE_P(value) == IS_ARRAY) { + if (zephir_fast_in_array(&optionValue, value)) { + ZEPHIR_INIT_NVAR(&_20$$14); + ZEPHIR_CONCAT_SVSVV(&_20$$14, "\t", &_10$$23); - ZEPHIR_CALL_SELF(&_8$$23, "optionsfromresultset", &_9, 505, &options, &using, &value, &_11$$23); - zephir_check_call_status(); - zephir_concat_self(&code, &_8$$23); + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - if (Z_TYPE_P(&options) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&_14$$25); - ZEPHIR_GET_CONSTANT(&_14$$25, "PHP_EOL"); - ZEPHIR_INIT_VAR(&_15$$25); - ZEPHIR_CONCAT_SV(&_15$$25, "", &_14$$25); - ZEPHIR_CALL_SELF(&_12$$25, "optionsfromarray", &_13, 506, &options, &value, &_15$$25); - zephir_check_call_status(); - zephir_concat_self(&code, &_12$$25); - } + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); } - zephir_concat_self_str(&code, SL("")); - RETURN_CCTOR(&code); + + + zephir_update_property_zval(this_ptr, SL("name"), &name); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Tag_Select, optionsFromArray) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setUserOption) { - zend_string *_3; - zend_ulong _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval closeOption, _12$$8, _13$$8, _22$$16, _23$$16; - zval *data_param = NULL, *value, value_sub, *closeOption_param = NULL, strValue, strOptionValue, code, optionValue, optionText, escaped, *_0, _1, _5$$4, _6$$4, _8$$4, _9$$4, _10$$6, _11$$7, _14$$9, _15$$10, _16$$12, _17$$12, _18$$12, _19$$12, _20$$14, _21$$15, _24$$17, _25$$18; - zval data; + zval *option_param = NULL, *value, value_sub; + zval option; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data); + ZVAL_UNDEF(&option); ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&strValue); - ZVAL_UNDEF(&strOptionValue); - ZVAL_UNDEF(&code); - ZVAL_UNDEF(&optionValue); - ZVAL_UNDEF(&optionText); - ZVAL_UNDEF(&escaped); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_10$$6); - ZVAL_UNDEF(&_11$$7); - ZVAL_UNDEF(&_14$$9); - ZVAL_UNDEF(&_15$$10); - ZVAL_UNDEF(&_16$$12); - ZVAL_UNDEF(&_17$$12); - ZVAL_UNDEF(&_18$$12); - ZVAL_UNDEF(&_19$$12); - ZVAL_UNDEF(&_20$$14); - ZVAL_UNDEF(&_21$$15); - ZVAL_UNDEF(&_24$$17); - ZVAL_UNDEF(&_25$$18); - ZVAL_UNDEF(&closeOption); - ZVAL_UNDEF(&_12$$8); - ZVAL_UNDEF(&_13$$8); - ZVAL_UNDEF(&_22$$16); - ZVAL_UNDEF(&_23$$16); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &data_param, &value, &closeOption_param); + zephir_fetch_params(1, 2, 0, &option_param, &value); - zephir_get_arrval(&data, data_param); - zephir_get_strval(&closeOption, closeOption_param); + zephir_get_strval(&option, option_param); - ZEPHIR_INIT_VAR(&code); - ZVAL_STRING(&code, ""); - zephir_is_iterable(&data, 0, "phalcon/Tag/Select.zep", 186); - if (Z_TYPE_P(&data) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2, _3, _0) - { - ZEPHIR_INIT_NVAR(&optionValue); - if (_3 != NULL) { - ZVAL_STR_COPY(&optionValue, _3); - } else { - ZVAL_LONG(&optionValue, _2); - } - ZEPHIR_INIT_NVAR(&optionText); - ZVAL_COPY(&optionText, _0); - ZEPHIR_CALL_FUNCTION(&escaped, "htmlspecialchars", &_4, 227, &optionValue); - zephir_check_call_status(); - if (Z_TYPE_P(&optionText) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(&_5$$4); - ZEPHIR_GET_CONSTANT(&_5$$4, "PHP_EOL"); - ZEPHIR_CALL_SELF(&_6$$4, "optionsfromarray", &_7, 506, &optionText, value, &closeOption); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_8$$4); - ZEPHIR_GET_CONSTANT(&_8$$4, "PHP_EOL"); - ZEPHIR_INIT_NVAR(&_9$$4); - ZEPHIR_CONCAT_SVSVVSV(&_9$$4, "\t", &_5$$4, &_6$$4, "\t", &_8$$4); - zephir_concat_self(&code, &_9$$4); - continue; - } - if (Z_TYPE_P(value) == IS_ARRAY) { - if (zephir_fast_in_array(&optionValue, value)) { - ZEPHIR_INIT_NVAR(&_10$$6); - ZEPHIR_CONCAT_SVSVV(&_10$$6, "\t", &_16$$12, &_17$$12, "\t", &_18$$12); - zephir_concat_self(&code, &_19$$12); - continue; - } - if (Z_TYPE_P(value) == IS_ARRAY) { - if (zephir_fast_in_array(&optionValue, value)) { - ZEPHIR_INIT_NVAR(&_20$$14); - ZEPHIR_CONCAT_SVSVV(&_20$$14, "\t", &_10$$23); + ZEPHIR_CALL_SELF(&_8$$23, "optionsfromresultset", &_9, 505, &options, &using, &value, &_11$$23); + zephir_check_call_status(); + zephir_concat_self(&code, &_8$$23); + } else { + if (Z_TYPE_P(&options) == IS_ARRAY) { + ZEPHIR_INIT_VAR(&_14$$25); + ZEPHIR_GET_CONSTANT(&_14$$25, "PHP_EOL"); + ZEPHIR_INIT_VAR(&_15$$25); + ZEPHIR_CONCAT_SV(&_15$$25, "", &_14$$25); + ZEPHIR_CALL_SELF(&_12$$25, "optionsfromarray", &_13, 506, &options, &value, &_15$$25); + zephir_check_call_status(); + zephir_concat_self(&code, &_12$$25); + } + } + zephir_concat_self_str(&code, SL("")); + RETURN_CCTOR(&code); } -static PHP_METHOD(Phalcon_Assets_Collection, setTargetLocal) { +static PHP_METHOD(Phalcon_Tag_Select, optionsFromArray) { - zval *targetLocal_param = NULL, __$true, __$false; - zend_bool targetLocal; + zend_string *_3; + zend_ulong _2; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval closeOption, _12$$8, _13$$8, _22$$16, _23$$16; + zval *data_param = NULL, *value, value_sub, *closeOption_param = NULL, strValue, strOptionValue, code, optionValue, optionText, escaped, *_0, _1, _5$$4, _6$$4, _8$$4, _9$$4, _10$$6, _11$$7, _14$$9, _15$$10, _16$$12, _17$$12, _18$$12, _19$$12, _20$$14, _21$$15, _24$$17, _25$$18; + zval data; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&strValue); + ZVAL_UNDEF(&strOptionValue); + ZVAL_UNDEF(&code); + ZVAL_UNDEF(&optionValue); + ZVAL_UNDEF(&optionText); + ZVAL_UNDEF(&escaped); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_10$$6); + ZVAL_UNDEF(&_11$$7); + ZVAL_UNDEF(&_14$$9); + ZVAL_UNDEF(&_15$$10); + ZVAL_UNDEF(&_16$$12); + ZVAL_UNDEF(&_17$$12); + ZVAL_UNDEF(&_18$$12); + ZVAL_UNDEF(&_19$$12); + ZVAL_UNDEF(&_20$$14); + ZVAL_UNDEF(&_21$$15); + ZVAL_UNDEF(&_24$$17); + ZVAL_UNDEF(&_25$$18); + ZVAL_UNDEF(&closeOption); + ZVAL_UNDEF(&_12$$8); + ZVAL_UNDEF(&_13$$8); + ZVAL_UNDEF(&_22$$16); + ZVAL_UNDEF(&_23$$16); - zephir_fetch_params_without_memory_grow(1, 0, &targetLocal_param); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 0, &data_param, &value, &closeOption_param); - if (UNEXPECTED(Z_TYPE_P(targetLocal_param) != IS_TRUE && Z_TYPE_P(targetLocal_param) != IS_FALSE)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'targetLocal' must be of the type bool")); - RETURN_NULL(); - } - targetLocal = (Z_TYPE_P(targetLocal_param) == IS_TRUE); + zephir_get_arrval(&data, data_param); + zephir_get_strval(&closeOption, closeOption_param); - if (targetLocal) { - zephir_update_property_zval(this_ptr, SL("targetLocal"), &__$true); + ZEPHIR_INIT_VAR(&code); + ZVAL_STRING(&code, ""); + zephir_is_iterable(&data, 0, "phalcon/Tag/Select.zep", 186); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&optionValue); + if (_3 != NULL) { + ZVAL_STR_COPY(&optionValue, _3); + } else { + ZVAL_LONG(&optionValue, _2); + } + ZEPHIR_INIT_NVAR(&optionText); + ZVAL_COPY(&optionText, _0); + ZEPHIR_CALL_FUNCTION(&escaped, "htmlspecialchars", &_4, 227, &optionValue); + zephir_check_call_status(); + if (Z_TYPE_P(&optionText) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&_5$$4); + ZEPHIR_GET_CONSTANT(&_5$$4, "PHP_EOL"); + ZEPHIR_CALL_SELF(&_6$$4, "optionsfromarray", &_7, 506, &optionText, value, &closeOption); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_8$$4); + ZEPHIR_GET_CONSTANT(&_8$$4, "PHP_EOL"); + ZEPHIR_INIT_NVAR(&_9$$4); + ZEPHIR_CONCAT_SVSVVSV(&_9$$4, "\t", &_5$$4, &_6$$4, "\t", &_8$$4); + zephir_concat_self(&code, &_9$$4); + continue; + } + if (Z_TYPE_P(value) == IS_ARRAY) { + if (zephir_fast_in_array(&optionValue, value)) { + ZEPHIR_INIT_NVAR(&_10$$6); + ZEPHIR_CONCAT_SVSVV(&_10$$6, "\t", &_16$$12, &_17$$12, "\t", &_18$$12); + zephir_concat_self(&code, &_19$$12); + continue; + } + if (Z_TYPE_P(value) == IS_ARRAY) { + if (zephir_fast_in_array(&optionValue, value)) { + ZEPHIR_INIT_NVAR(&_20$$14); + ZEPHIR_CONCAT_SVSVV(&_20$$14, "\t", &_10$$23); - ZEPHIR_CALL_SELF(&_8$$23, "optionsfromresultset", &_9, 505, &options, &using, &value, &_11$$23); - zephir_check_call_status(); - zephir_concat_self(&code, &_8$$23); + if (EXPECTED(Z_TYPE_P(name_param) == IS_STRING)) { + zephir_get_strval(&name, name_param); } else { - if (Z_TYPE_P(&options) == IS_ARRAY) { - ZEPHIR_INIT_VAR(&_14$$25); - ZEPHIR_GET_CONSTANT(&_14$$25, "PHP_EOL"); - ZEPHIR_INIT_VAR(&_15$$25); - ZEPHIR_CONCAT_SV(&_15$$25, "", &_14$$25); - ZEPHIR_CALL_SELF(&_12$$25, "optionsfromarray", &_13, 506, &options, &value, &_15$$25); - zephir_check_call_status(); - zephir_concat_self(&code, &_12$$25); - } + ZEPHIR_INIT_VAR(&name); + ZVAL_EMPTY_STRING(&name); } - zephir_concat_self_str(&code, SL("")); - RETURN_CCTOR(&code); + + + zephir_update_property_zval(this_ptr, SL("name"), &name); + RETURN_THIS(); } -static PHP_METHOD(Phalcon_Tag_Select, optionsFromArray) { +static PHP_METHOD(Phalcon_Forms_Element_AbstractElement, setUserOption) { - zend_string *_3; - zend_ulong _2; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; - zend_long ZEPHIR_LAST_CALL_STATUS; - zval closeOption, _12$$8, _13$$8, _22$$16, _23$$16; - zval *data_param = NULL, *value, value_sub, *closeOption_param = NULL, strValue, strOptionValue, code, optionValue, optionText, escaped, *_0, _1, _5$$4, _6$$4, _8$$4, _9$$4, _10$$6, _11$$7, _14$$9, _15$$10, _16$$12, _17$$12, _18$$12, _19$$12, _20$$14, _21$$15, _24$$17, _25$$18; - zval data; + zval *option_param = NULL, *value, value_sub; + zval option; zval *this_ptr = getThis(); - ZVAL_UNDEF(&data); + ZVAL_UNDEF(&option); ZVAL_UNDEF(&value_sub); - ZVAL_UNDEF(&strValue); - ZVAL_UNDEF(&strOptionValue); - ZVAL_UNDEF(&code); - ZVAL_UNDEF(&optionValue); - ZVAL_UNDEF(&optionText); - ZVAL_UNDEF(&escaped); - ZVAL_UNDEF(&_1); - ZVAL_UNDEF(&_5$$4); - ZVAL_UNDEF(&_6$$4); - ZVAL_UNDEF(&_8$$4); - ZVAL_UNDEF(&_9$$4); - ZVAL_UNDEF(&_10$$6); - ZVAL_UNDEF(&_11$$7); - ZVAL_UNDEF(&_14$$9); - ZVAL_UNDEF(&_15$$10); - ZVAL_UNDEF(&_16$$12); - ZVAL_UNDEF(&_17$$12); - ZVAL_UNDEF(&_18$$12); - ZVAL_UNDEF(&_19$$12); - ZVAL_UNDEF(&_20$$14); - ZVAL_UNDEF(&_21$$15); - ZVAL_UNDEF(&_24$$17); - ZVAL_UNDEF(&_25$$18); - ZVAL_UNDEF(&closeOption); - ZVAL_UNDEF(&_12$$8); - ZVAL_UNDEF(&_13$$8); - ZVAL_UNDEF(&_22$$16); - ZVAL_UNDEF(&_23$$16); ZEPHIR_MM_GROW(); - zephir_fetch_params(1, 3, 0, &data_param, &value, &closeOption_param); + zephir_fetch_params(1, 2, 0, &option_param, &value); - zephir_get_arrval(&data, data_param); - zephir_get_strval(&closeOption, closeOption_param); + zephir_get_strval(&option, option_param); - ZEPHIR_INIT_VAR(&code); - ZVAL_STRING(&code, ""); - zephir_is_iterable(&data, 0, "phalcon/Tag/Select.zep", 186); - if (Z_TYPE_P(&data) == IS_ARRAY) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2, _3, _0) - { - ZEPHIR_INIT_NVAR(&optionValue); - if (_3 != NULL) { - ZVAL_STR_COPY(&optionValue, _3); - } else { - ZVAL_LONG(&optionValue, _2); - } - ZEPHIR_INIT_NVAR(&optionText); - ZVAL_COPY(&optionText, _0); - ZEPHIR_CALL_FUNCTION(&escaped, "htmlspecialchars", &_4, 227, &optionValue); - zephir_check_call_status(); - if (Z_TYPE_P(&optionText) == IS_ARRAY) { - ZEPHIR_INIT_NVAR(&_5$$4); - ZEPHIR_GET_CONSTANT(&_5$$4, "PHP_EOL"); - ZEPHIR_CALL_SELF(&_6$$4, "optionsfromarray", &_7, 506, &optionText, value, &closeOption); - zephir_check_call_status(); - ZEPHIR_INIT_NVAR(&_8$$4); - ZEPHIR_GET_CONSTANT(&_8$$4, "PHP_EOL"); - ZEPHIR_INIT_NVAR(&_9$$4); - ZEPHIR_CONCAT_SVSVVSV(&_9$$4, "\t", &_5$$4, &_6$$4, "\t", &_8$$4); - zephir_concat_self(&code, &_9$$4); - continue; - } - if (Z_TYPE_P(value) == IS_ARRAY) { - if (zephir_fast_in_array(&optionValue, value)) { - ZEPHIR_INIT_NVAR(&_10$$6); - ZEPHIR_CONCAT_SVSVV(&_10$$6, "\t", &_16$$12, &_17$$12, "\t", &_18$$12); - zephir_concat_self(&code, &_19$$12); - continue; - } - if (Z_TYPE_P(value) == IS_ARRAY) { - if (zephir_fast_in_array(&optionValue, value)) { - ZEPHIR_INIT_NVAR(&_20$$14); - ZEPHIR_CONCAT_SVSVV(&_20$$14, "\t", &_10$$23); + ZEPHIR_CALL_SELF(&_8$$23, "optionsfromresultset", &_9, 505, &options, &using, &value, &_11$$23); + zephir_check_call_status(); + zephir_concat_self(&code, &_8$$23); + } else { + if (Z_TYPE_P(&options) == IS_ARRAY) { + ZEPHIR_INIT_VAR(&_14$$25); + ZEPHIR_GET_CONSTANT(&_14$$25, "PHP_EOL"); + ZEPHIR_INIT_VAR(&_15$$25); + ZEPHIR_CONCAT_SV(&_15$$25, "", &_14$$25); + ZEPHIR_CALL_SELF(&_12$$25, "optionsfromarray", &_13, 506, &options, &value, &_15$$25); + zephir_check_call_status(); + zephir_concat_self(&code, &_12$$25); + } + } + zephir_concat_self_str(&code, SL("")); + RETURN_CCTOR(&code); } -static PHP_METHOD(Phalcon_Assets_Collection, setTargetLocal) { +static PHP_METHOD(Phalcon_Tag_Select, optionsFromArray) { - zval *targetLocal_param = NULL, __$true, __$false; - zend_bool targetLocal; + zend_string *_3; + zend_ulong _2; + zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; + zend_long ZEPHIR_LAST_CALL_STATUS; + zval closeOption, _12$$8, _13$$8, _22$$16, _23$$16; + zval *data_param = NULL, *value, value_sub, *closeOption_param = NULL, strValue, strOptionValue, code, optionValue, optionText, escaped, *_0, _1, _5$$4, _6$$4, _8$$4, _9$$4, _10$$6, _11$$7, _14$$9, _15$$10, _16$$12, _17$$12, _18$$12, _19$$12, _20$$14, _21$$15, _24$$17, _25$$18; + zval data; zval *this_ptr = getThis(); - ZVAL_BOOL(&__$true, 1); - ZVAL_BOOL(&__$false, 0); + ZVAL_UNDEF(&data); + ZVAL_UNDEF(&value_sub); + ZVAL_UNDEF(&strValue); + ZVAL_UNDEF(&strOptionValue); + ZVAL_UNDEF(&code); + ZVAL_UNDEF(&optionValue); + ZVAL_UNDEF(&optionText); + ZVAL_UNDEF(&escaped); + ZVAL_UNDEF(&_1); + ZVAL_UNDEF(&_5$$4); + ZVAL_UNDEF(&_6$$4); + ZVAL_UNDEF(&_8$$4); + ZVAL_UNDEF(&_9$$4); + ZVAL_UNDEF(&_10$$6); + ZVAL_UNDEF(&_11$$7); + ZVAL_UNDEF(&_14$$9); + ZVAL_UNDEF(&_15$$10); + ZVAL_UNDEF(&_16$$12); + ZVAL_UNDEF(&_17$$12); + ZVAL_UNDEF(&_18$$12); + ZVAL_UNDEF(&_19$$12); + ZVAL_UNDEF(&_20$$14); + ZVAL_UNDEF(&_21$$15); + ZVAL_UNDEF(&_24$$17); + ZVAL_UNDEF(&_25$$18); + ZVAL_UNDEF(&closeOption); + ZVAL_UNDEF(&_12$$8); + ZVAL_UNDEF(&_13$$8); + ZVAL_UNDEF(&_22$$16); + ZVAL_UNDEF(&_23$$16); - zephir_fetch_params_without_memory_grow(1, 0, &targetLocal_param); + ZEPHIR_MM_GROW(); + zephir_fetch_params(1, 3, 0, &data_param, &value, &closeOption_param); - if (UNEXPECTED(Z_TYPE_P(targetLocal_param) != IS_TRUE && Z_TYPE_P(targetLocal_param) != IS_FALSE)) { - zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'targetLocal' must be of the type bool")); - RETURN_NULL(); - } - targetLocal = (Z_TYPE_P(targetLocal_param) == IS_TRUE); + zephir_get_arrval(&data, data_param); + zephir_get_strval(&closeOption, closeOption_param); - if (targetLocal) { - zephir_update_property_zval(this_ptr, SL("targetLocal"), &__$true); + ZEPHIR_INIT_VAR(&code); + ZVAL_STRING(&code, ""); + zephir_is_iterable(&data, 0, "phalcon/Tag/Select.zep", 186); + if (Z_TYPE_P(&data) == IS_ARRAY) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&data), _2, _3, _0) + { + ZEPHIR_INIT_NVAR(&optionValue); + if (_3 != NULL) { + ZVAL_STR_COPY(&optionValue, _3); + } else { + ZVAL_LONG(&optionValue, _2); + } + ZEPHIR_INIT_NVAR(&optionText); + ZVAL_COPY(&optionText, _0); + ZEPHIR_CALL_FUNCTION(&escaped, "htmlspecialchars", &_4, 227, &optionValue); + zephir_check_call_status(); + if (Z_TYPE_P(&optionText) == IS_ARRAY) { + ZEPHIR_INIT_NVAR(&_5$$4); + ZEPHIR_GET_CONSTANT(&_5$$4, "PHP_EOL"); + ZEPHIR_CALL_SELF(&_6$$4, "optionsfromarray", &_7, 506, &optionText, value, &closeOption); + zephir_check_call_status(); + ZEPHIR_INIT_NVAR(&_8$$4); + ZEPHIR_GET_CONSTANT(&_8$$4, "PHP_EOL"); + ZEPHIR_INIT_NVAR(&_9$$4); + ZEPHIR_CONCAT_SVSVVSV(&_9$$4, "\t", &_5$$4, &_6$$4, "\t", &_8$$4); + zephir_concat_self(&code, &_9$$4); + continue; + } + if (Z_TYPE_P(value) == IS_ARRAY) { + if (zephir_fast_in_array(&optionValue, value)) { + ZEPHIR_INIT_NVAR(&_10$$6); + ZEPHIR_CONCAT_SVSVV(&_10$$6, "\t", &_16$$12, &_17$$12, "\t", &_18$$12); + zephir_concat_self(&code, &_19$$12); + continue; + } + if (Z_TYPE_P(value) == IS_ARRAY) { + if (zephir_fast_in_array(&optionValue, value)) { + ZEPHIR_INIT_NVAR(&_20$$14); + ZEPHIR_CONCAT_SVSVV(&_20$$14, "\t