/** * Converts strings to camelize style * * <code> * echo Phalcon\Text::camelize('coco_bongo'); // CocoBongo * echo Phalcon\Text::camelize('co_co-bon_go', '-'); // Co_coBon_go * echo Phalcon\Text::camelize('co_co-bon_go', '_-'); // CoCoBonGo * </code> */ PHP_METHOD(Phalcon_Text, camelize) { zval *str_param = NULL, *delimiter = NULL, *_0; zval *str = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &str_param, &delimiter); if (unlikely(Z_TYPE_P(str_param) != IS_STRING && Z_TYPE_P(str_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'str' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(str_param) == IS_STRING)) { zephir_get_strval(str, str_param); } else { ZEPHIR_INIT_VAR(str); ZVAL_EMPTY_STRING(str); } if (!delimiter) { delimiter = ZEPHIR_GLOBAL(global_null); } ZEPHIR_INIT_VAR(_0); zephir_camelize(_0, str, delimiter ); RETURN_CCTOR(_0); }
/** * Possible class name that will be located to dispatch the request */ PHP_METHOD(Phalcon_Dispatcher, getHandlerClass) { zval *handlerSuffix = NULL, *handlerName = NULL, *namespaceName = NULL, *camelizedClass = NULL, *handlerClass = NULL; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_CALL_METHOD(NULL, this_ptr, "_resolveemptyproperties", NULL, 0); zephir_check_call_status(); ZEPHIR_OBS_VAR(handlerSuffix); zephir_read_property_this(&handlerSuffix, this_ptr, SL("_handlerSuffix"), PH_NOISY_CC); ZEPHIR_OBS_VAR(handlerName); zephir_read_property_this(&handlerName, this_ptr, SL("_handlerName"), PH_NOISY_CC); ZEPHIR_OBS_VAR(namespaceName); zephir_read_property_this(&namespaceName, this_ptr, SL("_namespaceName"), PH_NOISY_CC); if (!(zephir_memnstr_str(handlerName, SL("\\"), "phalcon/dispatcher.zep", 709))) { ZEPHIR_INIT_VAR(camelizedClass); zephir_camelize(camelizedClass, handlerName, NULL ); } else { ZEPHIR_CPY_WRT(camelizedClass, handlerName); } if (zephir_is_true(namespaceName)) { ZEPHIR_INIT_VAR(handlerClass); if (zephir_end_with_str(namespaceName, SL("\\"))) { ZEPHIR_CONCAT_VVV(handlerClass, namespaceName, camelizedClass, handlerSuffix); } else { ZEPHIR_CONCAT_VSVV(handlerClass, namespaceName, "\\", camelizedClass, handlerSuffix); } } else { ZEPHIR_INIT_NVAR(handlerClass); ZEPHIR_CONCAT_VV(handlerClass, camelizedClass, handlerSuffix); } RETURN_CCTOR(handlerClass); }
PHP_METHOD(Test_Strings, camelize) { zval *str_param = NULL, *delimiter = NULL, delimiter_sub, __$null; zval str; zval *this_ptr = getThis(); ZVAL_UNDEF(&str); ZVAL_UNDEF(&delimiter_sub); ZVAL_NULL(&__$null); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &str_param, &delimiter); zephir_get_strval(&str, str_param); if (!delimiter) { delimiter = &delimiter_sub; delimiter = &__$null; } zephir_camelize(return_value, &str, delimiter ); RETURN_MM(); }
/** * Gets the a value to validate in the array/object data source * * @param string field * @return mixed */ PHP_METHOD(Phalcon_Validation, getValue) { zend_bool _0$$10; zephir_fcall_cache_entry *_1 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *field_param = NULL, *entity = NULL, *method = NULL, *value = NULL, *data = NULL, *values = NULL, *filters = NULL, *fieldFilters = NULL, *dependencyInjector = NULL, *filterService = NULL, *camelizedField = NULL, *_2$$20, *_3$$20 = NULL, *_4$$28 = NULL; zval *field = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &field_param); zephir_get_strval(field, field_param); ZEPHIR_OBS_VAR(entity); zephir_read_property_this(&entity, this_ptr, SL("_entity"), PH_NOISY_CC); if (Z_TYPE_P(entity) == IS_OBJECT) { ZEPHIR_INIT_VAR(camelizedField); zephir_camelize(camelizedField, field, NULL ); ZEPHIR_INIT_VAR(method); ZEPHIR_CONCAT_SV(method, "get", camelizedField); if ((zephir_method_exists(entity, method TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD_ZVAL(&value, entity, method, NULL, 0); zephir_check_call_status(); } else { if ((zephir_method_exists_ex(entity, SS("readattribute") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&value, entity, "readattribute", NULL, 0, field); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(value); if (zephir_isset_property_zval(entity, field TSRMLS_CC)) { zephir_read_property_zval(&value, entity, field, PH_NOISY_CC); } else { ZVAL_NULL(value); } } } } else { ZEPHIR_OBS_VAR(data); zephir_read_property_this(&data, this_ptr, SL("_data"), PH_NOISY_CC); _0$$10 = Z_TYPE_P(data) != IS_ARRAY; if (_0$$10) { _0$$10 = Z_TYPE_P(data) != IS_OBJECT; } if (_0$$10) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "There is no data to validate", "phalcon/validation.zep", 499); return; } ZEPHIR_OBS_VAR(values); zephir_read_property_this(&values, this_ptr, SL("_values"), PH_NOISY_CC); ZEPHIR_OBS_NVAR(value); if (zephir_array_isset_fetch(&value, values, field, 0 TSRMLS_CC)) { RETURN_CCTOR(value); } ZEPHIR_INIT_NVAR(value); ZVAL_NULL(value); if (Z_TYPE_P(data) == IS_ARRAY) { if (zephir_array_isset(data, field)) { ZEPHIR_OBS_NVAR(value); zephir_array_fetch(&value, data, field, PH_NOISY, "phalcon/validation.zep", 511 TSRMLS_CC); } } else { if (Z_TYPE_P(data) == IS_OBJECT) { if (zephir_isset_property_zval(data, field TSRMLS_CC)) { ZEPHIR_OBS_NVAR(value); zephir_read_property_zval(&value, data, field, PH_NOISY_CC); } } } } if (Z_TYPE_P(value) == IS_NULL) { RETURN_MM_NULL(); } ZEPHIR_OBS_VAR(filters); zephir_read_property_this(&filters, this_ptr, SL("_filters"), PH_NOISY_CC); ZEPHIR_OBS_VAR(fieldFilters); if (zephir_array_isset_fetch(&fieldFilters, filters, field, 0 TSRMLS_CC)) { if (zephir_is_true(fieldFilters)) { ZEPHIR_CALL_METHOD(&dependencyInjector, this_ptr, "getdi", NULL, 0); zephir_check_call_status(); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_CALL_CE_STATIC(&dependencyInjector, phalcon_di_ce, "getdefault", &_1, 1); zephir_check_call_status(); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "A dependency injector is required to obtain the 'filter' service", "phalcon/validation.zep", 536); return; } } ZEPHIR_INIT_VAR(_2$$20); ZVAL_STRING(_2$$20, "filter", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&filterService, dependencyInjector, "getshared", NULL, 0, _2$$20); zephir_check_temp_parameter(_2$$20); zephir_check_call_status(); if (Z_TYPE_P(filterService) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Returned 'filter' service is invalid", "phalcon/validation.zep", 542); return; } ZEPHIR_CALL_METHOD(&_3$$20, filterService, "sanitize", NULL, 0, value, fieldFilters); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, _3$$20); if (Z_TYPE_P(entity) == IS_OBJECT) { ZEPHIR_INIT_NVAR(method); ZEPHIR_CONCAT_SV(method, "set", camelizedField); if ((zephir_method_exists(entity, method TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD_ZVAL(NULL, entity, method, NULL, 0, value); zephir_check_call_status(); } else { if ((zephir_method_exists_ex(entity, SS("writeattribute") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(NULL, entity, "writeattribute", NULL, 0, field, value); zephir_check_call_status(); } else { ZEPHIR_CALL_FUNCTION(&_4$$28, "property_exists", NULL, 329, entity, field); zephir_check_call_status(); if (zephir_is_true(_4$$28)) { zephir_update_property_zval_zval(entity, field, value TSRMLS_CC); } } } } RETURN_CCTOR(value); } } if (Z_TYPE_P(entity) != IS_OBJECT) { zephir_update_property_array(this_ptr, SL("_values"), field, value TSRMLS_CC); } RETURN_CCTOR(value); }
/** * Gets a value from the internal related entity or from the default value */ PHP_METHOD(Phalcon_Forms_Form, getValue) { zend_long ZEPHIR_LAST_CALL_STATUS; zval *name_param = NULL, *entity = NULL, *method = NULL, *value = NULL, *data = NULL, *internal = NULL, *forbidden = NULL, *_1, *_0$$4; zval *name = NULL; 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 a string") TSRMLS_CC); 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_OBS_VAR(entity); zephir_read_property_this(&entity, this_ptr, SL("_entity"), PH_NOISY_CC); ZEPHIR_OBS_VAR(data); zephir_read_property_this(&data, this_ptr, SL("_data"), PH_NOISY_CC); if ((zephir_method_exists_ex(this_ptr, SS("getcustomvalue") TSRMLS_CC) == SUCCESS)) { ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getcustomvalue", NULL, 0, name, entity, data); zephir_check_call_status(); RETURN_MM(); } if (Z_TYPE_P(entity) == IS_OBJECT) { ZEPHIR_INIT_VAR(_0$$4); zephir_camelize(_0$$4, name, NULL ); ZEPHIR_INIT_VAR(method); ZEPHIR_CONCAT_SV(method, "get", _0$$4); if ((zephir_method_exists(entity, method TSRMLS_CC) == 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 TSRMLS_CC)) { RETURN_CCTOR(value); } } ZEPHIR_INIT_VAR(forbidden); zephir_create_array(forbidden, 12, 0 TSRMLS_CC); zephir_array_update_string(&forbidden, SL("validation"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("action"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("useroption"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("useroptions"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("entity"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("elements"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("messages"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("messagesfor"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("label"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("value"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("di"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); zephir_array_update_string(&forbidden, SL("eventsmanager"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(internal); zephir_fast_strtolower(internal, name); if (zephir_array_isset(forbidden, internal)) { RETURN_MM_NULL(); } ZEPHIR_INIT_VAR(_1); zephir_camelize(_1, name, NULL ); ZEPHIR_INIT_NVAR(method); ZEPHIR_CONCAT_SV(method, "get", _1); if ((zephir_method_exists(this_ptr, method TSRMLS_CC) == SUCCESS)) { ZEPHIR_RETURN_CALL_METHOD_ZVAL(this_ptr, method, NULL, 0); zephir_check_call_status(); RETURN_MM(); } RETURN_MM_NULL(); }
/** * Binds data to the entity * * @param array data * @param object entity * @param array whitelist */ PHP_METHOD(Phalcon_Forms_Form, bind) { HashTable *_2; HashPosition _1; zephir_fcall_cache_entry *_5 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *data_param = NULL, *entity, *whitelist = NULL, *filter = NULL, *key = NULL, *value = NULL, *element = NULL, *filters = NULL, *dependencyInjector = NULL, *filteredValue = NULL, *method = NULL, *_0, **_3, *_4$$4, *_8$$4 = NULL, *_6$$9 = NULL, *_7$$9 = NULL; zval *data = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &data_param, &entity, &whitelist); data = data_param; ZEPHIR_SEPARATE_PARAM(entity); if (!whitelist) { whitelist = ZEPHIR_GLOBAL(global_null); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_elements"), PH_NOISY_CC); if (ZEPHIR_IS_EMPTY(_0)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_forms_exception_ce, "There are no elements in the form", "phalcon/forms/form.zep", 189); return; } ZEPHIR_INIT_VAR(filter); ZVAL_NULL(filter); zephir_is_iterable(data, &_2, &_1, 0, 0, "phalcon/forms/form.zep", 246); for ( ; zend_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zend_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(key, _2, _1); ZEPHIR_GET_HVALUE(value, _3); ZEPHIR_OBS_NVAR(element); _4$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_elements"), PH_NOISY_CC); if (!(zephir_array_isset_fetch(&element, _4$$4, key, 0 TSRMLS_CC))) { continue; } if (Z_TYPE_P(whitelist) == IS_ARRAY) { if (!(zephir_fast_in_array(key, whitelist TSRMLS_CC))) { 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(&dependencyInjector, this_ptr, "getdi", &_5, 0); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_7$$9); ZVAL_STRING(_7$$9, "filter", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_6$$9, dependencyInjector, "getshared", NULL, 0, _7$$9); zephir_check_temp_parameter(_7$$9); zephir_check_call_status(); ZEPHIR_CPY_WRT(filter, _6$$9); } ZEPHIR_CALL_METHOD(&filteredValue, filter, "sanitize", NULL, 0, value, filters); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(filteredValue, value); } ZEPHIR_INIT_NVAR(_8$$4); zephir_camelize(_8$$4, key, NULL ); ZEPHIR_INIT_NVAR(method); ZEPHIR_CONCAT_SV(method, "set", _8$$4); if ((zephir_method_exists(entity, method TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD_ZVAL(NULL, entity, method, NULL, 0, filteredValue); zephir_check_call_status(); continue; } zephir_update_property_zval_zval(entity, key, filteredValue TSRMLS_CC); } zephir_update_property_this(getThis(), SL("_data"), data TSRMLS_CC); RETURN_THIS(); }
/** * Dispatches a handle action taking into account the routing parameters * * @return object */ PHP_METHOD(Phalcon_Dispatcher, dispatch) { zval *_18 = NULL; zephir_fcall_cache_entry *_4 = NULL, *_5 = NULL, *_8 = NULL, *_10 = NULL, *_11 = NULL, *_12 = NULL, *_13 = NULL, *_14 = NULL, *_16 = NULL, *_19 = NULL; zval *value, *handler = NULL, *dependencyInjector = NULL, *namespaceName = NULL, *handlerName = NULL, *actionName = NULL, *camelizedClass = NULL, *params = NULL, *eventsManager = NULL, *handlerSuffix, *actionSuffix, *handlerClass = NULL, *status = NULL, *actionMethod = NULL, *e = NULL, *_0, *_1 = NULL, *_2 = NULL, *_3 = NULL, *_6, *_7 = NULL, *_9 = NULL, *_15 = NULL, *_17; int numberDispatches, ZEPHIR_LAST_CALL_STATUS; zend_bool hasService, wasFresh = 0; ZEPHIR_MM_GROW(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _0); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "A dependency injection container is required to access related dispatching services", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_2); ZVAL_LONG(_2, 0); ZEPHIR_CALL_METHOD(NULL, this_ptr, "_throwdispatchexception", NULL, _1, _2); zephir_check_temp_parameter(_1); zephir_check_call_status(); RETURN_MM_BOOL(0); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC); ZEPHIR_CPY_WRT(eventsManager, _0); if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "dispatch:beforeDispatchLoop", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_3, eventsManager, "fire", NULL, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_3)) { RETURN_MM_BOOL(0); } } ZEPHIR_INIT_VAR(value); ZVAL_NULL(value); ZEPHIR_INIT_VAR(handler); ZVAL_NULL(handler); numberDispatches = 0; ZEPHIR_OBS_VAR(handlerSuffix); zephir_read_property_this(&handlerSuffix, this_ptr, SL("_handlerSuffix"), PH_NOISY_CC); ZEPHIR_OBS_VAR(actionSuffix); zephir_read_property_this(&actionSuffix, this_ptr, SL("_actionSuffix"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_finished"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); while (1) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (!(!(zephir_is_true(_0)))) { break; } numberDispatches++; if (numberDispatches == 256) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "Dispatcher has detected a cyclic routing causing stability problems", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_2); ZVAL_LONG(_2, 1); ZEPHIR_CALL_METHOD(NULL, this_ptr, "_throwdispatchexception", &_4, _1, _2); zephir_check_temp_parameter(_1); zephir_check_call_status(); break; } zephir_update_property_this(this_ptr, SL("_finished"), (1) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); ZEPHIR_OBS_NVAR(namespaceName); zephir_read_property_this(&namespaceName, this_ptr, SL("_namespaceName"), PH_NOISY_CC); if (!(zephir_is_true(namespaceName))) { ZEPHIR_OBS_NVAR(namespaceName); zephir_read_property_this(&namespaceName, this_ptr, SL("_defaultNamespace"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_namespaceName"), namespaceName TSRMLS_CC); } ZEPHIR_OBS_NVAR(handlerName); zephir_read_property_this(&handlerName, this_ptr, SL("_handlerName"), PH_NOISY_CC); if (!(zephir_is_true(handlerName))) { ZEPHIR_OBS_NVAR(handlerName); zephir_read_property_this(&handlerName, this_ptr, SL("_defaultHandler"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_handlerName"), handlerName TSRMLS_CC); } ZEPHIR_OBS_NVAR(actionName); zephir_read_property_this(&actionName, this_ptr, SL("_actionName"), PH_NOISY_CC); if (!(zephir_is_true(actionName))) { ZEPHIR_OBS_NVAR(actionName); zephir_read_property_this(&actionName, this_ptr, SL("_defaultAction"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_actionName"), actionName TSRMLS_CC); } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "dispatch:beforeDispatch", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_3, eventsManager, "fire", &_5, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_3)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } if (!(zephir_memnstr_str(handlerName, SL("\\"), "phalcon/dispatcher.zep", 390))) { ZEPHIR_INIT_NVAR(camelizedClass); zephir_camelize(camelizedClass, handlerName); } else { ZEPHIR_CPY_WRT(camelizedClass, handlerName); } if (zephir_is_true(namespaceName)) { ZEPHIR_INIT_NVAR(handlerClass); if (zephir_end_with_str(namespaceName, SL("\\"))) { ZEPHIR_CONCAT_VVV(handlerClass, namespaceName, camelizedClass, handlerSuffix); } else { ZEPHIR_CONCAT_VSVV(handlerClass, namespaceName, "\\", camelizedClass, handlerSuffix); } } else { ZEPHIR_INIT_NVAR(handlerClass); ZEPHIR_CONCAT_VV(handlerClass, camelizedClass, handlerSuffix); } ZEPHIR_CALL_METHOD(&_7, dependencyInjector, "has", &_8, handlerClass); zephir_check_call_status(); hasService = zephir_get_boolval(_7); if (!(hasService)) { hasService = zephir_class_exists(handlerClass, 1 TSRMLS_CC); } if (!(hasService)) { ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_VS(_9, handlerClass, " handler class cannot be loaded"); ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, 2); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_10, _9, _1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } break; } ZEPHIR_CALL_METHOD(&handler, dependencyInjector, "getshared", &_11, handlerClass); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_7, dependencyInjector, "wasfreshinstance", &_12); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_7)) { wasFresh = 1; } if (Z_TYPE_P(handler) != IS_OBJECT) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "Invalid handler returned from the services container", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_2); ZVAL_LONG(_2, 3); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_13, _1, _2); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } break; } zephir_update_property_this(this_ptr, SL("_activeHandler"), handler TSRMLS_CC); ZEPHIR_OBS_NVAR(params); zephir_read_property_this(¶ms, this_ptr, SL("_params"), PH_NOISY_CC); if (Z_TYPE_P(params) != IS_ARRAY) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "Action parameters must be an Array", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_2); ZVAL_LONG(_2, 4); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_14, _1, _2); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } break; } ZEPHIR_INIT_NVAR(actionMethod); ZEPHIR_CONCAT_VV(actionMethod, actionName, actionSuffix); if (!((zephir_method_exists(handler, actionMethod TSRMLS_CC) == SUCCESS))) { if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "dispatch:beforeNotFoundAction", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_15, eventsManager, "fire", &_5, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } ZEPHIR_INIT_LNVAR(_9); ZEPHIR_CONCAT_SVSVS(_9, "Action '", actionName, "' was not found on handler '", handlerName, "'"); ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, 5); ZEPHIR_CALL_METHOD(&status, this_ptr, "_throwdispatchexception", &_16, _9, _1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(status)) { _17 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_17)) { continue; } } break; } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "dispatch:beforeExecuteRoute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_15, eventsManager, "fire", &_5, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } if ((zephir_method_exists_ex(handler, SS("beforeexecuteroute") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&_15, handler, "beforeexecuteroute", NULL, this_ptr); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } if (wasFresh == 1) { if ((zephir_method_exists_ex(handler, SS("initialize") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(NULL, handler, "initialize", NULL); zephir_check_call_status(); } if (zephir_is_true(eventsManager)) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "dispatch:afterInitialize", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_15, eventsManager, "fire", &_5, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } } /* try_start_1: */ ZEPHIR_INIT_NVAR(_1); ZEPHIR_INIT_NVAR(_18); zephir_create_array(_18, 2, 0 TSRMLS_CC); zephir_array_fast_append(_18, handler); zephir_array_fast_append(_18, actionMethod); ZEPHIR_CALL_USER_FUNC_ARRAY(_1, _18, params); zephir_check_call_status_or_jump(try_end_1); zephir_update_property_this(this_ptr, SL("_returnedValue"), _1 TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_lastHandler"), handler TSRMLS_CC); try_end_1: if (EG(exception)) { ZEPHIR_CPY_WRT(e, EG(exception)); if (zephir_instance_of_ev(e, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); ZEPHIR_CALL_METHOD(&_15, this_ptr, "_handleexception", &_19, e); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } else { zephir_throw_exception_debug(e, "phalcon/dispatcher.zep", 550 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_2); ZVAL_STRING(_2, "dispatch:afterExecuteRoute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_15, eventsManager, "fire", &_5, _2, this_ptr, value); zephir_check_temp_parameter(_2); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } ZEPHIR_INIT_NVAR(_2); ZVAL_STRING(_2, "dispatch:afterDispatch", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_5, _2, this_ptr); zephir_check_temp_parameter(_2); zephir_check_call_status(); } if ((zephir_method_exists_ex(handler, SS("afterexecuteroute") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&_15, handler, "afterexecuteroute", NULL, this_ptr, value); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(_15)) { continue; } _6 = zephir_fetch_nproperty_this(this_ptr, SL("_finished"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(_6)) { continue; } } } if (Z_TYPE_P(eventsManager) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "dispatch:afterDispatchLoop", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, eventsManager, "fire", &_5, _1, this_ptr); zephir_check_temp_parameter(_1); zephir_check_call_status(); } RETURN_CCTOR(handler); }