Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Sep 29, 2013
1 parent f390c19 commit 4d85b6c
Show file tree
Hide file tree
Showing 53 changed files with 412 additions and 599 deletions.
15 changes: 6 additions & 9 deletions ext/annotations/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,16 @@ PHP_METHOD(Phalcon_Annotations_Adapter, setReader){
*/
PHP_METHOD(Phalcon_Annotations_Adapter, getReader){

zval *reader = NULL;

PHALCON_MM_GROW();
zval *reader;

PHALCON_OBS_VAR(reader);
phalcon_read_property_this(&reader, this_ptr, SL("_reader"), PH_NOISY_CC);
reader = phalcon_fetch_nproperty_this(this_ptr, SL("_reader"), PH_NOISY_CC);
if (Z_TYPE_P(reader) != IS_OBJECT) {
PHALCON_INIT_NVAR(reader);
object_init_ex(reader, phalcon_annotations_reader_ce);
phalcon_update_property_this(this_ptr, SL("_reader"), reader TSRMLS_CC);
object_init_ex(return_value, phalcon_annotations_reader_ce);
phalcon_update_property_this(this_ptr, SL("_reader"), return_value TSRMLS_CC);
return;
}

RETURN_CCTOR(reader);
RETURN_ZVAL(reader, 1, 0);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion ext/annotations/adapter/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ PHP_METHOD(Phalcon_Annotations_Adapter_Memory, read){
PHALCON_INIT_VAR(lowercased_key);
phalcon_fast_strtolower(lowercased_key, key);
if (phalcon_array_isset_fetch(&annotations, data, lowercased_key)) {
RETURN_CCTOR(annotations);
RETURN_CTOR(annotations);
}

RETURN_MM_NULL();
Expand Down
17 changes: 5 additions & 12 deletions ext/annotations/collection.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,13 @@ PHP_METHOD(Phalcon_Annotations_Collection, current){

zval *position, *annotations, *annotation;

PHALCON_MM_GROW();

PHALCON_OBS_VAR(position);
phalcon_read_property_this(&position, this_ptr, SL("_position"), PH_NOISY_CC);

PHALCON_OBS_VAR(annotations);
phalcon_read_property_this(&annotations, this_ptr, SL("_annotations"), PH_NOISY_CC);
if (phalcon_array_isset(annotations, position)) {
PHALCON_OBS_VAR(annotation);
phalcon_array_fetch(&annotation, annotations, position, PH_NOISY);
RETURN_CCTOR(annotation);
position = phalcon_fetch_nproperty_this(this_ptr, SL("_position"), PH_NOISY_CC);
annotations = phalcon_fetch_nproperty_this(this_ptr, SL("_annotations"), PH_NOISY_CC);
if (phalcon_array_isset_fetch(&annotation, annotations, position)) {
RETURN_ZVAL(annotation, 1, 0);
}

RETURN_MM_NULL();
RETURN_NULL();
}

/**
Expand Down
70 changes: 26 additions & 44 deletions ext/annotations/reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,33 +96,26 @@ PHP_METHOD(Phalcon_Annotations_Reflection, __construct){
PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations){

zval *annotations, *reflection_data, *reflection_class;
zval *collection;

PHALCON_MM_GROW();

PHALCON_OBS_VAR(annotations);
phalcon_read_property_this(&annotations, this_ptr, SL("_classAnnotations"), PH_NOISY_CC);
annotations = phalcon_fetch_nproperty_this(this_ptr, SL("_classAnnotations"), PH_NOISY_CC);
if (Z_TYPE_P(annotations) != IS_OBJECT) {

PHALCON_OBS_VAR(reflection_data);
phalcon_read_property_this(&reflection_data, this_ptr, SL("_reflectionData"), PH_NOISY_CC);
if (phalcon_array_isset_string(reflection_data, SS("class"))) {
PHALCON_OBS_VAR(reflection_class);
phalcon_array_fetch_string(&reflection_class, reflection_data, SL("class"), PH_NOISY);
reflection_data = phalcon_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC);
if (phalcon_array_isset_string_fetch(&reflection_class, reflection_data, SS("class"))) {
object_init_ex(return_value, phalcon_annotations_collection_ce);
phalcon_call_method_p1_noret(return_value, "__construct", reflection_class);

PHALCON_INIT_VAR(collection);
object_init_ex(collection, phalcon_annotations_collection_ce);
phalcon_call_method_p1_noret(collection, "__construct", reflection_class);

phalcon_update_property_this(this_ptr, SL("_classAnnotations"), collection TSRMLS_CC);
RETURN_CTOR(collection);
phalcon_update_property_this(this_ptr, SL("_classAnnotations"), return_value TSRMLS_CC);
RETURN_MM();
}

phalcon_update_property_this(this_ptr, SL("_classAnnotations"), PHALCON_GLOBAL(z_false) TSRMLS_CC);
RETURN_MM_FALSE;
}

RETURN_CCTOR(annotations);
RETURN_CTOR(annotations);
}

/**
Expand All @@ -133,28 +126,22 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations){
PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations){

zval *annotations, *reflection_data, *reflection_methods;
zval *collections, *reflection_method = NULL, *method_name = NULL;
zval *reflection_method = NULL, *method_name = NULL;
zval *collection = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;

PHALCON_MM_GROW();

PHALCON_OBS_VAR(annotations);
phalcon_read_property_this(&annotations, this_ptr, SL("_methodAnnotations"), PH_NOISY_CC);
annotations = phalcon_fetch_nproperty_this(this_ptr, SL("_methodAnnotations"), PH_NOISY_CC);
if (Z_TYPE_P(annotations) != IS_OBJECT) {

PHALCON_OBS_VAR(reflection_data);
phalcon_read_property_this(&reflection_data, this_ptr, SL("_reflectionData"), PH_NOISY_CC);
if (phalcon_array_isset_string(reflection_data, SS("methods"))) {

PHALCON_OBS_VAR(reflection_methods);
phalcon_array_fetch_string(&reflection_methods, reflection_data, SL("methods"), PH_NOISY);
reflection_data = phalcon_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC);
if (phalcon_array_isset_string_fetch(&reflection_methods, reflection_data, SS("methods"))) {
if (phalcon_fast_count_ev(reflection_methods TSRMLS_CC)) {

PHALCON_INIT_VAR(collections);
array_init(collections);
array_init(return_value);

phalcon_is_iterable(reflection_methods, &ah0, &hp0, 0, 0);

Expand All @@ -167,22 +154,22 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations){
object_init_ex(collection, phalcon_annotations_collection_ce);
phalcon_call_method_p1_noret(collection, "__construct", reflection_method);

phalcon_array_update_zval(&collections, method_name, &collection, PH_COPY | PH_SEPARATE);
phalcon_array_update_zval(&return_value, method_name, &collection, PH_COPY);

zend_hash_move_forward_ex(ah0, &hp0);
}

phalcon_update_property_this(this_ptr, SL("_methodAnnotations"), collections TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_methodAnnotations"), return_value TSRMLS_CC);

RETURN_CTOR(collections);
RETURN_MM();
}
}

phalcon_update_property_bool(this_ptr, SL("_methodAnnotations"), 0 TSRMLS_CC);
RETURN_MM_FALSE;
}

RETURN_CCTOR(annotations);
RETURN_CTOR(annotations);
}

/**
Expand All @@ -193,28 +180,23 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getMethodsAnnotations){
PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations){

zval *annotations, *reflection_data, *reflection_properties;
zval *collections, *reflection_property = NULL, *property = NULL;
zval *reflection_property = NULL, *property = NULL;
zval *collection = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;

PHALCON_MM_GROW();

PHALCON_OBS_VAR(annotations);
phalcon_read_property_this(&annotations, this_ptr, SL("_propertyAnnotations"), PH_NOISY_CC);
annotations = phalcon_fetch_nproperty_this(this_ptr, SL("_propertyAnnotations"), PH_NOISY_CC);
if (Z_TYPE_P(annotations) != IS_OBJECT) {

PHALCON_OBS_VAR(reflection_data);
phalcon_read_property_this(&reflection_data, this_ptr, SL("_reflectionData"), PH_NOISY_CC);
if (phalcon_array_isset_string(reflection_data, SS("properties"))) {
reflection_data = phalcon_fetch_nproperty_this(this_ptr, SL("_reflectionData"), PH_NOISY_CC);
if (phalcon_array_isset_string_fetch(&reflection_properties, reflection_data, SS("properties"))) {

PHALCON_OBS_VAR(reflection_properties);
phalcon_array_fetch_string(&reflection_properties, reflection_data, SL("properties"), PH_NOISY);
if (phalcon_fast_count_ev(reflection_properties TSRMLS_CC)) {

PHALCON_INIT_VAR(collections);
array_init(collections);
array_init(return_value);

phalcon_is_iterable(reflection_properties, &ah0, &hp0, 0, 0);

Expand All @@ -227,22 +209,22 @@ PHP_METHOD(Phalcon_Annotations_Reflection, getPropertiesAnnotations){
object_init_ex(collection, phalcon_annotations_collection_ce);
phalcon_call_method_p1_noret(collection, "__construct", reflection_property);

phalcon_array_update_zval(&collections, property, &collection, PH_COPY | PH_SEPARATE);
phalcon_array_update_zval(&return_value, property, &collection, PH_COPY);

zend_hash_move_forward_ex(ah0, &hp0);
}

phalcon_update_property_this(this_ptr, SL("_propertyAnnotations"), collections TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_propertyAnnotations"), return_value TSRMLS_CC);

RETURN_CTOR(collections);
RETURN_MM();
}
}

phalcon_update_property_bool(this_ptr, SL("_propertyAnnotations"), 0 TSRMLS_CC);
RETURN_MM_FALSE;
}

RETURN_CCTOR(annotations);
RETURN_CTOR(annotations);
}

/**
Expand Down
27 changes: 9 additions & 18 deletions ext/assets/collection.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,13 @@ PHP_METHOD(Phalcon_Assets_Collection, getResources){

zval *resources;

PHALCON_MM_GROW();

PHALCON_OBS_VAR(resources);
phalcon_read_property_this(&resources, this_ptr, SL("_resources"), PH_NOISY_CC);
resources = phalcon_fetch_nproperty_this(this_ptr, SL("_resources"), PH_NOISY_CC);
if (Z_TYPE_P(resources) != IS_ARRAY) {
RETURN_MM_EMPTY_ARRAY();
array_init(return_value);
return;
}

RETURN_CCTOR(resources);
RETURN_ZVAL(resources, 1, 0);
}

/**
Expand Down Expand Up @@ -248,20 +246,13 @@ PHP_METHOD(Phalcon_Assets_Collection, current){

zval *position, *resources, *resource;

PHALCON_MM_GROW();

PHALCON_OBS_VAR(position);
phalcon_read_property_this(&position, this_ptr, SL("_position"), PH_NOISY_CC);

PHALCON_OBS_VAR(resources);
phalcon_read_property_this(&resources, this_ptr, SL("_resources"), PH_NOISY_CC);
if (phalcon_array_isset(resources, position)) {
PHALCON_OBS_VAR(resource);
phalcon_array_fetch(&resource, resources, position, PH_NOISY);
RETURN_CCTOR(resource);
position = phalcon_fetch_nproperty_this(this_ptr, SL("_position"), PH_NOISY_CC);
resources = phalcon_fetch_nproperty_this(this_ptr, SL("_resources"), PH_NOISY_CC);
if (phalcon_array_isset_fetch(&resource, resources, position)) {
RETURN_ZVAL(resource, 1, 0);
}

RETURN_MM_NULL();
RETURN_NULL();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion ext/assets/filters/none.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ PHP_METHOD(Phalcon_Assets_Filters_None, filter){

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

RETURN_CCTORW(content);
RETURN_CTORW(content);
}

Loading

0 comments on commit 4d85b6c

Please sign in to comment.