Esempio n. 1
0
/**
 * Parses a raw doc block returning the annotations found
 *
 * @param string $docBlock
 * @param string $file
 * @param int $line
 * @return array
 */
PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock){

	zval *doc_block, *file = NULL, *line = NULL;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 1, 2, &doc_block, &file, &line);
	
	if (!file) {
		PHALCON_INIT_VAR(file);
	} else {
		PHALCON_SEPARATE_PARAM(file);
	}
	
	if (!line) {
		PHALCON_INIT_VAR(line);
	}
	
	if (Z_TYPE_P(file) != IS_STRING) {
		PHALCON_INIT_NVAR(file);
		ZVAL_STRING(file, "eval code", 1);
	}
	if (phannot_parse_annotations(return_value, doc_block, file, line TSRMLS_CC) == FAILURE) {
		return;
	}
	RETURN_MM();
}
Esempio n. 2
0
/**
 * Parses a raw doc block returning the annotations found
 */
PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *docBlock_param = NULL, *file = NULL, *line = NULL;
	zval *docBlock = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 2, &docBlock_param, &file, &line);

	zephir_get_strval(docBlock, docBlock_param);
	if (!file) {
		ZEPHIR_CPY_WRT(file, ZEPHIR_GLOBAL(global_null));
	} else {
		ZEPHIR_SEPARATE_PARAM(file);
	}
	if (!line) {
		line = ZEPHIR_GLOBAL(global_null);
	}


	if (Z_TYPE_P(file) != IS_STRING) {
		ZEPHIR_INIT_NVAR(file);
		ZVAL_STRING(file, "eval code", 1);
	}
	ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(return_value, docBlock, file, line TSRMLS_CC);
	zephir_check_call_status();
	RETURN_MM();

}
Esempio n. 3
0
/**
 * Parses a raw doc block returning the annotations found
 *
 * @param string $docBlock
 * @param string $file
 * @param int $line
 * @return array
 */
PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock)
{
	zval **doc_block, **file = NULL, **line = NULL;

	phalcon_fetch_params_ex(3, 0, &doc_block, &file, &line);

	PHALCON_ENSURE_IS_STRING(doc_block);
	PHALCON_ENSURE_IS_STRING(file);
	PHALCON_ENSURE_IS_LONG(line);

	RETURN_ON_FAILURE(phannot_parse_annotations(return_value, Z_STRVAL_PP(doc_block), Z_STRLEN_PP(doc_block), Z_STRVAL_PP(file), Z_LVAL_PP(line) TSRMLS_CC));
}
Esempio n. 4
0
PHP_METHOD(Owl_Annotations_Reader, parse) {

	zval *comment_param = NULL, _0, _1;
	zval *comment = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &comment_param);

	zephir_get_strval(comment, comment_param);


	ZEPHIR_SINIT_VAR(_0);
	ZVAL_LONG(&_0, 1);
	ZEPHIR_SINIT_VAR(_1);
	ZVAL_LONG(&_1, 2);
	phannot_parse_annotations(return_value, comment, &_0, &_1 TSRMLS_CC);
	RETURN_MM();

}
Esempio n. 5
0
/**
 * Reads annotations from the class dockblocks, its methods and/or properties
 *
 * @param string $className
 * @return array
 */
PHP_METHOD(Phalcon_Annotations_Reader, parse){

	zval *class_name, *annotations;
	zval *class_annotations, *annotations_properties, *annotations_methods;
	zend_class_entry *class_ce;
	const char *file;
	uint32_t line;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 1, 0, &class_name);

	if (unlikely(Z_TYPE_P(class_name) != IS_STRING)) {
		PHALCON_THROW_EXCEPTION_STR(phalcon_annotations_exception_ce, "The class name must be a string");
		return;
	}

	class_ce = zend_fetch_class(Z_STR_P(class_name), ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_SILENT);
	if (!class_ce) {
		PHALCON_THROW_EXCEPTION_FORMAT(phalcon_annotations_exception_ce, "Class %s does not exist", Z_STRVAL_P(class_name));
		return;
	}

	if (class_ce->type != ZEND_USER_CLASS) {
		array_init(return_value);
		RETURN_MM();
	}

	PHALCON_INIT_VAR(annotations);
	array_init(annotations);

	file = ZSTR_VAL(phalcon_get_class_filename(class_ce));
	if (!file) {
		file = "(unknown)";
	}

	/* Class info */
	{
		zend_string *cmt;

		if ((cmt = phalcon_get_class_doc_comment(class_ce)) != NULL) {
			line = phalcon_get_class_startline(class_ce);

			PHALCON_INIT_VAR(class_annotations);
			RETURN_MM_ON_FAILURE(phannot_parse_annotations(class_annotations, cmt, file, line));

			if (Z_TYPE_P(class_annotations) == IS_ARRAY) {
				phalcon_array_update_str(annotations, SL("class"), class_annotations, PH_COPY);
			}
		}
	}

	/* Get class properties */
	{
		HashTable *props = &class_ce->properties_info;
		if (zend_hash_num_elements(props) > 0) {
			zend_property_info *property;

			PHALCON_INIT_VAR(annotations_properties);
			array_init_size(annotations_properties, zend_hash_num_elements(props));

			ZEND_HASH_FOREACH_PTR(props, property) {
				zend_string *cmt;

				if ((cmt = phalcon_get_property_doc_comment(property)) != NULL) {
					zval *property_annotations;

					PHALCON_ALLOC_INIT_ZVAL(property_annotations);
					if (FAILURE == phannot_parse_annotations(property_annotations, cmt, file, 0)) {
						zval_ptr_dtor(property_annotations);
						RETURN_MM();
					}

					if (Z_TYPE_P(property_annotations) == IS_ARRAY) {
						const char *prop_name, *class_name;
						if (zend_unmangle_property_name(property->name, &class_name, &prop_name) == SUCCESS) {
							add_assoc_zval_ex(annotations_properties, prop_name, strlen(prop_name), property_annotations);
						}
					} else {
						zval_ptr_dtor(property_annotations);
					}
				}
			} ZEND_HASH_FOREACH_END();

			if (zend_hash_num_elements(Z_ARRVAL_P(annotations_properties))) {
				phalcon_array_update_str(annotations, SL("properties"), annotations_properties, PH_COPY);
			}
		}
Esempio n. 6
0
/**
 * Reads annotations from the class dockblocks, its methods and/or properties
 *
 * @param string $className
 * @return array
 */
PHP_METHOD(Phalcon_Annotations_Reader, parse){

	zval *class_name, *annotations, *reflection;
	zval *comment = NULL, *file = NULL, *line = NULL, *class_annotations;
	zval *properties, *annotations_properties;
	zval *property = NULL, *property_annotations = NULL, *name = NULL;
	zval *methods, *annotations_methods, *method = NULL;
	zval *method_annotations = NULL;
	HashTable *ah0, *ah1;
	HashPosition hp0, hp1;
	zval **hd;
	zend_class_entry *ce0;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 1, 0, &class_name);
	
	if (unlikely(Z_TYPE_P(class_name) != IS_STRING)) {
		PHALCON_THROW_EXCEPTION_STR(phalcon_annotations_exception_ce, "The class name must be an object");
		return;
	}
	
	PHALCON_INIT_VAR(annotations);
	array_init(annotations);
	
	/** 
	 * A ReflectionClass is used to obtain the class dockblock
	 */
	ce0 = zend_fetch_class(SL("ReflectionClass"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
	
	PHALCON_INIT_VAR(reflection);
	object_init_ex(reflection, ce0);
	if (phalcon_has_constructor(reflection TSRMLS_CC)) {
		phalcon_call_method_p1_noret(reflection, "__construct", class_name);
	}
	
	PHALCON_INIT_VAR(comment);
	phalcon_call_method(comment, reflection, "getdoccomment");
	if (Z_TYPE_P(comment) == IS_STRING) {
	
		/** 
		 * Get the file where the class was declared
		 */
		PHALCON_INIT_VAR(file);
		phalcon_call_method(file, reflection, "getfilename");
	
		/** 
		 * Get the line where the class was declared
		 */
		PHALCON_INIT_VAR(line);
		phalcon_call_method(line, reflection, "getstartline");
	
		/** 
		 * Read annotations from class
		 */
		PHALCON_INIT_VAR(class_annotations);
		if (phannot_parse_annotations(class_annotations, comment, file, line TSRMLS_CC) == FAILURE) {
			return;
		}
	
		/** 
		 * Append the class annotations to the annotations var
		 */
		if (Z_TYPE_P(class_annotations) == IS_ARRAY) { 
			phalcon_array_update_string(&annotations, SL("class"), &class_annotations, PH_COPY | PH_SEPARATE);
		}
	}
	
	/** 
	 * Get the class properties
	 */
	PHALCON_INIT_VAR(properties);
	phalcon_call_method(properties, reflection, "getproperties");
	if (phalcon_fast_count_ev(properties TSRMLS_CC)) {
	
		/** 
		 * Line declaration for properties isn't available
		 */
		PHALCON_INIT_NVAR(line);
		ZVAL_LONG(line, 1);
	
		PHALCON_INIT_VAR(annotations_properties);
		array_init(annotations_properties);
	
		phalcon_is_iterable(properties, &ah0, &hp0, 0, 0);
	
		while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) {
	
			PHALCON_GET_HVALUE(property);
	
			/** 
			 * Read comment from method
			 */
			PHALCON_INIT_NVAR(comment);
			phalcon_call_method(comment, property, "getdoccomment");
			if (Z_TYPE_P(comment) == IS_STRING) {
	
				/** 
				 * Get the file where the property was declared
				 */
				PHALCON_INIT_NVAR(file);
				phalcon_call_method(file, reflection, "getfilename");
	
				/** 
				 * Read annotations from the docblock
				 */
				PHALCON_INIT_NVAR(property_annotations);
				if (phannot_parse_annotations(property_annotations, comment, file, line TSRMLS_CC) == FAILURE) {
					return;
				}
				if (Z_TYPE_P(property_annotations) == IS_ARRAY) { 
					PHALCON_OBS_NVAR(name);
					phalcon_read_property(&name, property, SL("name"), PH_NOISY_CC);
					phalcon_array_update_zval(&annotations_properties, name, &property_annotations, PH_COPY | PH_SEPARATE);
				}
			}
	
			zend_hash_move_forward_ex(ah0, &hp0);
		}
	
		if (phalcon_fast_count_ev(annotations_properties TSRMLS_CC)) {
			phalcon_array_update_string(&annotations, SL("properties"), &annotations_properties, PH_COPY | PH_SEPARATE);
		}
	}
	
	/** 
	 * Get the class methods
	 */
	PHALCON_INIT_VAR(methods);
	phalcon_call_method(methods, reflection, "getmethods");
	if (phalcon_fast_count_ev(methods TSRMLS_CC)) {
	
		PHALCON_INIT_VAR(annotations_methods);
		array_init(annotations_methods);
	
		phalcon_is_iterable(methods, &ah1, &hp1, 0, 0);
	
		while (zend_hash_get_current_data_ex(ah1, (void**) &hd, &hp1) == SUCCESS) {
	
			PHALCON_GET_HVALUE(method);
	
			/** 
			 * Read comment from method
			 */
			PHALCON_INIT_NVAR(comment);
			phalcon_call_method(comment, method, "getdoccomment");
			if (Z_TYPE_P(comment) == IS_STRING) {
	
				/** 
				 * Get the file where the method was declared
				 */
				PHALCON_INIT_NVAR(file);
				phalcon_call_method(file, method, "getfilename");
	
				/** 
				 * Get the line where the method was declared
				 */
				PHALCON_INIT_NVAR(line);
				phalcon_call_method(line, method, "getstartline");
	
				/** 
				 * Read annotations from class
				 */
				PHALCON_INIT_NVAR(method_annotations);
				if (phannot_parse_annotations(method_annotations, comment, file, line TSRMLS_CC) == FAILURE) {
					return;
				}
				if (Z_TYPE_P(method_annotations) == IS_ARRAY) { 
					PHALCON_OBS_NVAR(name);
					phalcon_read_property(&name, method, SL("name"), PH_NOISY_CC);
					phalcon_array_update_zval(&annotations_methods, name, &method_annotations, PH_COPY | PH_SEPARATE);
				}
			}
	
			zend_hash_move_forward_ex(ah1, &hp1);
		}
	
		if (phalcon_fast_count_ev(annotations_methods TSRMLS_CC)) {
			phalcon_array_update_string(&annotations, SL("methods"), &annotations_methods, PH_COPY | PH_SEPARATE);
		}
	}
	
	RETURN_CTOR(annotations);
}
Esempio n. 7
0
/**
 * Reads annotations from the class dockblocks, its methods and/or properties
 */
PHP_METHOD(Phalcon_Annotations_Reader, parse) {

	HashTable *_3$$5, *_9$$10;
	HashPosition _2$$5, _8$$10;
	int ZEPHIR_LAST_CALL_STATUS, line = 0;
	zval *className_param = NULL, *annotations = NULL, *reflection = NULL, *comment = NULL, *properties = NULL, *methods = NULL, *property = NULL, *method = NULL, *classAnnotations = NULL, *annotationsProperties = NULL, *propertyAnnotations = NULL, *annotationsMethods = NULL, *methodAnnotations = NULL, *_0$$3 = NULL, *_1$$3 = NULL, **_4$$5, *_5$$7 = NULL, *_6$$7 = NULL, *_7$$8 = NULL, **_10$$10, *_11$$12 = NULL, *_12$$12 = NULL, *_13$$13 = NULL;
	zval *className = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &className_param);

	zephir_get_strval(className, className_param);


	ZEPHIR_INIT_VAR(annotations);
	array_init(annotations);
	ZEPHIR_INIT_VAR(reflection);
	object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC));
	ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 66, className);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&comment, reflection, "getdoccomment", NULL, 89);
	zephir_check_call_status();
	if (Z_TYPE_P(comment) == IS_STRING) {
		ZEPHIR_INIT_VAR(classAnnotations);
		ZEPHIR_CALL_METHOD(&_0$$3, reflection, "getfilename", NULL, 90);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(&_1$$3, reflection, "getstartline", NULL, 91);
		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_CALL_METHOD(&properties, reflection, "getproperties", NULL, 92);
	zephir_check_call_status();
	if (zephir_fast_count_int(properties TSRMLS_CC)) {
		line = 1;
		ZEPHIR_INIT_VAR(annotationsProperties);
		array_init(annotationsProperties);
		zephir_is_iterable(properties, &_3$$5, &_2$$5, 0, 0, "phalcon/annotations/reader.zep", 96);
		for (
		  ; zephir_hash_get_current_data_ex(_3$$5, (void**) &_4$$5, &_2$$5) == SUCCESS
		  ; zephir_hash_move_forward_ex(_3$$5, &_2$$5)
		) {
			ZEPHIR_GET_HVALUE(property, _4$$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(&_5$$7, reflection, "getfilename", NULL, 90);
				zephir_check_call_status();
				ZEPHIR_INIT_NVAR(_6$$7);
				ZVAL_LONG(_6$$7, line);
				ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(propertyAnnotations, comment, _5$$7, _6$$7 TSRMLS_CC);
				zephir_check_call_status();
				if (Z_TYPE_P(propertyAnnotations) == IS_ARRAY) {
					ZEPHIR_OBS_NVAR(_7$$8);
					zephir_read_property(&_7$$8, property, SL("name"), PH_NOISY_CC);
					zephir_array_update_zval(&annotationsProperties, _7$$8, &propertyAnnotations, PH_COPY | PH_SEPARATE);
				}
			}
		}
		if (zephir_fast_count_int(annotationsProperties TSRMLS_CC)) {
			zephir_array_update_string(&annotations, SL("properties"), &annotationsProperties, PH_COPY | PH_SEPARATE);
		}
	}
	ZEPHIR_CALL_METHOD(&methods, reflection, "getmethods", NULL, 93);
	zephir_check_call_status();
	if (zephir_fast_count_int(methods TSRMLS_CC)) {
		ZEPHIR_INIT_VAR(annotationsMethods);
		array_init(annotationsMethods);
		zephir_is_iterable(methods, &_9$$10, &_8$$10, 0, 0, "phalcon/annotations/reader.zep", 126);
		for (
		  ; zephir_hash_get_current_data_ex(_9$$10, (void**) &_10$$10, &_8$$10) == SUCCESS
		  ; zephir_hash_move_forward_ex(_9$$10, &_8$$10)
		) {
			ZEPHIR_GET_HVALUE(method, _10$$10);
			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(&_11$$12, method, "getfilename", NULL, 0);
				zephir_check_call_status();
				ZEPHIR_CALL_METHOD(&_12$$12, method, "getstartline", NULL, 0);
				zephir_check_call_status();
				ZEPHIR_LAST_CALL_STATUS = phannot_parse_annotations(methodAnnotations, comment, _11$$12, _12$$12 TSRMLS_CC);
				zephir_check_call_status();
				if (Z_TYPE_P(methodAnnotations) == IS_ARRAY) {
					ZEPHIR_OBS_NVAR(_13$$13);
					zephir_read_property(&_13$$13, method, SL("name"), PH_NOISY_CC);
					zephir_array_update_zval(&annotationsMethods, _13$$13, &methodAnnotations, PH_COPY | PH_SEPARATE);
				}
			}
		}
		if (zephir_fast_count_int(annotationsMethods TSRMLS_CC)) {
			zephir_array_update_string(&annotations, SL("methods"), &annotationsMethods, PH_COPY | PH_SEPARATE);
		}
	}
	RETURN_CCTOR(annotations);

}
Esempio n. 8
0
/**
 * Reads annotations from the class dockblocks, its methods and/or properties
 *
 * @param string $className
 * @return array
 */
PHP_METHOD(Phalcon_Annotations_Reader, parse){

	zval *class_name, *annotations;
	zval *class_annotations, *annotations_properties, *annotations_methods;
	zend_class_entry *class_ce;
	const char *file;
	zend_uint line;

	phalcon_fetch_params(0, 1, 0, &class_name);

	if (unlikely(Z_TYPE_P(class_name) != IS_STRING)) {
		PHALCON_THROW_EXCEPTION_STRW(phalcon_annotations_exception_ce, "The class name must be a string");
		return;
	}

	class_ce = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_SILENT TSRMLS_CC);
	if (!class_ce) {
		zend_throw_exception_ex(phalcon_annotations_exception_ce, 0 TSRMLS_CC, "Class %s does not exist", Z_STRVAL_P(class_name));
		return;
	}

	if (class_ce->type != ZEND_USER_CLASS) {
		array_init(return_value);
		return;
	}

	PHALCON_MM_GROW();
	PHALCON_INIT_VAR(annotations);
	array_init(annotations);

	file = phalcon_get_class_filename(class_ce);
	if (!file) {
		file = "(unknown)";
	}

	/* Class info */
	{
		const char *cmt;
		zend_uint cmt_len;

		if (phalcon_get_class_doc_comment(class_ce, &cmt, &cmt_len)) {
			line = phalcon_get_class_startline(class_ce);

			PHALCON_INIT_VAR(class_annotations);
			RETURN_MM_ON_FAILURE(phannot_parse_annotations(class_annotations, cmt, cmt_len, file, line TSRMLS_CC));

			if (Z_TYPE_P(class_annotations) == IS_ARRAY) {
				phalcon_array_update_string(&annotations, SL("class"), class_annotations, PH_COPY);
			}
		}
	}

	/* Get class properties */
	{
		HashTable *props = &class_ce->properties_info;
		if (zend_hash_num_elements(props) > 0) {
			HashPosition hp;
			zend_property_info *property;

			PHALCON_INIT_VAR(annotations_properties);
			array_init_size(annotations_properties, zend_hash_num_elements(props));

			for (
				zend_hash_internal_pointer_reset_ex(props, &hp);
				zend_hash_get_current_data_ex(props, (void**)&property, &hp) != FAILURE;
				zend_hash_move_forward_ex(props, &hp)
			) {
				const char *cmt;
				zend_uint cmt_len;

				if (phalcon_get_property_doc_comment(property, &cmt, &cmt_len)) {
					zval *property_annotations;

					MAKE_STD_ZVAL(property_annotations);
					if (FAILURE == phannot_parse_annotations(property_annotations, cmt, cmt_len, file, 0 TSRMLS_CC)) {
						zval_ptr_dtor(&property_annotations);
						RETURN_MM();
					}

					if (Z_TYPE_P(property_annotations) == IS_ARRAY) {
						#if PHP_VERSION_ID >= 50400
						{
							const char *prop_name, *class_name;
							if (zend_unmangle_property_name(property->name, property->name_length - 1, &class_name, &prop_name) == SUCCESS) {
								add_assoc_zval_ex(annotations_properties, prop_name, strlen(prop_name) + 1, property_annotations);
							}
						}
						#else
						{
							char *prop_name, *class_name;
							if (zend_unmangle_property_name(property->name, property->name_length - 1, &class_name, &prop_name) == SUCCESS) {
								add_assoc_zval_ex(annotations_properties, prop_name, strlen(prop_name) + 1, property_annotations);
							}
						}
						#endif
					} else {
						zval_ptr_dtor(&property_annotations);
					}
				}
			}

			if (zend_hash_num_elements(Z_ARRVAL_P(annotations_properties))) {
				phalcon_array_update_string(&annotations, SL("properties"), annotations_properties, PH_COPY);
			}
		}
	}

	/* Get class methods */
	{
		HashTable *methods = &class_ce->function_table;
		if (zend_hash_num_elements(methods) > 0) {
			HashPosition hp;
			zend_function *method;

			PHALCON_INIT_VAR(annotations_methods);
			array_init_size(annotations_methods, zend_hash_num_elements(methods));

			for (
				zend_hash_internal_pointer_reset_ex(methods, &hp);
				zend_hash_get_current_data_ex(methods, (void**)&method, &hp) != FAILURE;
				zend_hash_move_forward_ex(methods, &hp)
			) {
				const char *cmt;
				zend_uint cmt_len;

				if (phalcon_get_function_doc_comment(method, &cmt, &cmt_len)) {
					zval *method_annotations;

					line = phalcon_get_function_startline(method);

					MAKE_STD_ZVAL(method_annotations);
					if (FAILURE == phannot_parse_annotations(method_annotations, cmt, cmt_len, file, line TSRMLS_CC)) {
						zval_ptr_dtor(&method_annotations);
						RETURN_MM();
					}

					if (Z_TYPE_P(method_annotations) == IS_ARRAY) {
						add_assoc_zval_ex(annotations_methods, method->common.function_name, strlen(method->common.function_name) + 1, method_annotations);
					}
					else {
						zval_ptr_dtor(&method_annotations);
					}
				}
			}

			if (zend_hash_num_elements(Z_ARRVAL_P(annotations_methods))) {
				phalcon_array_update_string(&annotations, SL("methods"), annotations_methods, PH_COPY);
			}
		}
	}

	RETURN_CTOR(annotations);
}