/** * CacheExecute * * @param string statement String query to execute * @param array vars Array of variables to bind [optional] * @return ResultSet|false object or false if fail */ PHP_METHOD(ADOdb_Connection, execute) { zval *vars = NULL; zval *statement_param = NULL, *vars_param = NULL, *st; zval *statement = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &statement_param, &vars_param); zephir_get_strval(statement, statement_param); if (!vars_param) { ZEPHIR_INIT_VAR(vars); array_init(vars); } else { zephir_get_arrval(vars, vars_param); } ZEPHIR_INIT_VAR(st); zephir_call_method_p2(st, this_ptr, "query", statement, vars); if (!ZEPHIR_IS_FALSE(st)) { object_init_ex(return_value, adodb_resultset_ce); zephir_call_method_p1_noret(return_value, "__construct", st); RETURN_MM(); } else { RETURN_MM_BOOL(0); } ZEPHIR_MM_RESTORE(); }
/** * Defined by Iterator interface * * @return boolean */ PHP_METHOD(Yaf_Session, valid) { zend_bool _3; int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_1 = NULL; zval *key = NULL, *_0, *_2; ZEPHIR_MM_GROW(); _0 = zephir_fetch_nproperty_this(this_ptr, SL("session"), PH_NOISY_CC); Z_SET_ISREF_P(_0); ZEPHIR_CALL_FUNCTION(&key, "key", &_1, _0); Z_UNSET_ISREF_P(_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(_2); _3 = Z_TYPE_P(key) == IS_NULL; if (!(_3)) { _3 = ZEPHIR_IS_FALSE(key); } if (_3) { ZVAL_BOOL(_2, 0); } else { ZVAL_BOOL(_2, 1); } RETURN_CCTOR(_2); }
/** * 判断字母是否在某个区域内。用于判断某个字符只能介于[a-h](包含)之间的类似情况。 * @param string alpha 原值。 * @param string start_alpha 起始值。 * @param string end_alpha 截止值。 * @return boolean */ PHP_METHOD(Winer_Validator, alpha_between) { int ZEPHIR_LAST_CALL_STATUS; zval *alpha_param = NULL, *start_alpha_param = NULL, *end_alpha_param = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL; zval *alpha = NULL, *start_alpha = NULL, *end_alpha = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 0, &alpha_param, &start_alpha_param, &end_alpha_param); zephir_get_strval(alpha, alpha_param); zephir_get_strval(start_alpha, start_alpha_param); zephir_get_strval(end_alpha, end_alpha_param); ZEPHIR_CALL_SELF(&_0, "is_alpha", NULL, alpha); zephir_check_call_status(); if (ZEPHIR_IS_FALSE(_0)) { RETURN_MM_BOOL(0); } ZEPHIR_CALL_SELF(&_1, "is_alpha", NULL, start_alpha); zephir_check_call_status(); if (ZEPHIR_IS_FALSE(_1)) { RETURN_MM_BOOL(0); } ZEPHIR_CALL_SELF(&_2, "is_alpha", NULL, end_alpha); zephir_check_call_status(); if (ZEPHIR_IS_FALSE(_2)) { RETURN_MM_BOOL(0); } if (ZEPHIR_GE(start_alpha, end_alpha)) { RETURN_MM_BOOL(0); } if (ZEPHIR_LT(alpha, start_alpha)) { RETURN_MM_BOOL(0); } if (ZEPHIR_GT(alpha, end_alpha)) { RETURN_MM_BOOL(0); } RETURN_MM_BOOL(1); }
PHP_METHOD(Test_Fcall, testCall3) { int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_2 = NULL, *_3 = NULL; zval *handle = NULL, *handle2 = NULL, *buffer = NULL, _0 = zval_used_for_init, _1 = zval_used_for_init; ZEPHIR_MM_GROW(); ZEPHIR_SINIT_VAR(_0); ZVAL_STRING(&_0, "inputfile.txt", 0); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "r", 0); ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, &_0, &_1); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "outputfile.txt", 0); ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "w", 0); ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, &_0, &_1); zephir_check_call_status(); if (zephir_is_true(handle)) { while (1) { ZEPHIR_SINIT_NVAR(_0); ZVAL_LONG(&_0, 4096); ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_3, handle, &_0); zephir_check_call_status(); if (ZEPHIR_IS_FALSE(buffer)) { break; } zephir_fwrite(NULL, handle2, buffer TSRMLS_CC); } zephir_fclose(handle TSRMLS_CC); zephir_fclose(handle2 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); }
PHP_METHOD(ADOdb_Cache, unserializeStatement) { zval *serializedStatement, *rawSt, *_0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &serializedStatement); ZEPHIR_INIT_VAR(_0); zephir_call_func_p1(_0, "gzuncompress", serializedStatement); ZEPHIR_INIT_VAR(rawSt); zephir_call_func_p1(rawSt, "unserialize", _0); if (!ZEPHIR_IS_FALSE(rawSt)) { object_init_ex(return_value, adodb_driver_cache_statement_ce); zephir_call_method_p1_noret(return_value, "__construct", rawSt); RETURN_MM(); } else { ZEPHIR_THROW_EXCEPTION_STR(adodb_exception_ce, "Unserialize error"); return; } ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Test_Fcall, testCall3) { zend_function *_2 = NULL; zval *handle, *handle2, *buffer = NULL, _0 = zval_used_for_init, _1 = zval_used_for_init; ZEPHIR_MM_GROW(); ZEPHIR_SINIT_VAR(_0); ZVAL_STRING(&_0, "inputfile.txt", 0); ZEPHIR_SINIT_VAR(_1); ZVAL_STRING(&_1, "r", 0); ZEPHIR_INIT_VAR(handle); zephir_call_func_p2(handle, "fopen", &_0, &_1); ZEPHIR_SINIT_NVAR(_0); ZVAL_STRING(&_0, "outputfile.txt", 0); ZEPHIR_SINIT_NVAR(_1); ZVAL_STRING(&_1, "w", 0); ZEPHIR_INIT_VAR(handle2); zephir_call_func_p2(handle2, "fopen", &_0, &_1); if (zephir_is_true(handle)) { while (1) { ZEPHIR_SINIT_NVAR(_0); ZVAL_LONG(&_0, 4096); ZEPHIR_INIT_NVAR(buffer); ZEPHIR_CALL_INTERNAL_FUNCTION(buffer, &buffer, "fgets", &_2, 2, handle, &_0); if (ZEPHIR_IS_FALSE(buffer)) { break; } zephir_fwrite(NULL, handle2, buffer TSRMLS_CC); } zephir_fclose(handle TSRMLS_CC); zephir_fclose(handle2 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); }
/** * Handles routing information received from the rewrite engine * *<code> * //Read the info from the rewrite engine * $router->handle(); * * //Manually passing an URL * $router->handle('/posts/edit/1'); *</code> * * @param string uri */ PHP_METHOD(Test_Router, handle) { zephir_nts_static zephir_fcall_cache_entry *_12 = NULL; HashTable *_2, *_9; HashPosition _1, _8; int ZEPHIR_LAST_CALL_STATUS; zval *uri = NULL, *realUri = NULL, *request = NULL, *currentHostName = NULL, *routeFound = NULL, *parts = NULL, *params, *matches, *notFoundPaths, *vnamespace, *module, *controller, *action, *paramsStr, *strParams = NULL, *paramsMerge = NULL, *route = NULL, *methods = NULL, *dependencyInjector = NULL, *hostname = NULL, *regexHostName = NULL, *matched = NULL, *pattern = NULL, *handledUri = NULL, *beforeMatch = NULL, *paths = NULL, *converters = NULL, *part = NULL, *position = NULL, *matchPosition = NULL, *_0, **_3, *_4, *_5 = NULL, *_6 = NULL, *_7 = NULL, **_10, _11, *_13, *_14, *_15, *_16; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &uri); if (!uri) { uri = ZEPHIR_GLOBAL(global_null); } if (!(zephir_is_true(uri))) { ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(realUri, uri); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_removeExtraSlashes"), PH_NOISY_CC); if (zephir_is_true(_0)) { ZEPHIR_CALL_METHOD(&handledUri, this_ptr, "doremoveextraslashes", NULL, realUri); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(handledUri, realUri); } ZEPHIR_INIT_VAR(request); ZVAL_NULL(request); ZEPHIR_INIT_VAR(currentHostName); ZVAL_NULL(currentHostName); ZEPHIR_INIT_VAR(routeFound); ZVAL_BOOL(routeFound, 0); ZEPHIR_INIT_VAR(parts); array_init(parts); ZEPHIR_INIT_VAR(params); array_init(params); ZEPHIR_INIT_VAR(matches); ZVAL_NULL(matches); zephir_update_property_this(this_ptr, SL("_wasMatched"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_matchedRoute"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_routes"), PH_NOISY_CC); zephir_is_iterable(_0, &_2, &_1, 0, 1); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_backwards_ex(_2, &_1) ) { ZEPHIR_GET_HVALUE(route, _3); ZEPHIR_CALL_METHOD(&methods, route, "gethttpmethods", NULL); zephir_check_call_status(); if (Z_TYPE_P(methods) != IS_NULL) { if (Z_TYPE_P(request) == IS_NULL) { _4 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _4); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_STR(test_router_exception_ce, "A dependency injection container is required to access the 'request' service"); return; } ZEPHIR_INIT_NVAR(_5); ZVAL_STRING(_5, "request", 0); ZEPHIR_CALL_METHOD(&request, dependencyInjector, "getshared", NULL, _5); zephir_check_temp_parameter(_5); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&_6, request, "ismethod", NULL, methods); zephir_check_call_status(); if (ZEPHIR_IS_FALSE(_6)) { continue; } } ZEPHIR_CALL_METHOD(&hostname, route, "gethostname", NULL); zephir_check_call_status(); if (Z_TYPE_P(hostname) != IS_NULL) { if (Z_TYPE_P(request) == IS_NULL) { ZEPHIR_OBS_NVAR(dependencyInjector); zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_STR(test_router_exception_ce, "A dependency injection container is required to access the 'request' service"); return; } ZEPHIR_INIT_NVAR(_5); ZVAL_STRING(_5, "request", 0); ZEPHIR_CALL_METHOD(&request, dependencyInjector, "getshared", NULL, _5); zephir_check_temp_parameter(_5); zephir_check_call_status(); } if (Z_TYPE_P(currentHostName) != IS_OBJECT) { ZEPHIR_CALL_METHOD(¤tHostName, request, "gethttphost", NULL); zephir_check_call_status(); } if (Z_TYPE_P(currentHostName) != IS_NULL) { continue; } ZEPHIR_INIT_NVAR(matched); if (zephir_memnstr_str(hostname, SL("("), "test/router.zep", 381)) { if (zephir_memnstr_str(hostname, SL("#"), "test/router.zep", 382)) { ZEPHIR_INIT_NVAR(regexHostName); ZEPHIR_CONCAT_SVS(regexHostName, "#^", hostname, "$#"); } else { ZEPHIR_CPY_WRT(regexHostName, hostname); } ZEPHIR_INIT_NVAR(_7); zephir_preg_match(matched, &(matched), regexHostName, currentHostName, _7, 0, 0 , 0 TSRMLS_CC); } else { ZVAL_BOOL(matched, ZEPHIR_IS_EQUAL(currentHostName, hostname)); } if (!(zephir_is_true(matched))) { continue; } } ZEPHIR_CALL_METHOD(&pattern, route, "getcompiledpattern", NULL); zephir_check_call_status(); ZEPHIR_INIT_NVAR(routeFound); if (zephir_memnstr_str(pattern, SL("^"), "test/router.zep", 400)) { zephir_preg_match(routeFound, &(routeFound), pattern, handledUri, matches, 0, 0 , 0 TSRMLS_CC); } else { ZVAL_BOOL(routeFound, ZEPHIR_IS_EQUAL(pattern, handledUri)); } if (zephir_is_true(routeFound)) { ZEPHIR_CALL_METHOD(&beforeMatch, route, "getbeforematch", NULL); zephir_check_call_status(); if (Z_TYPE_P(beforeMatch) != IS_NULL) { if (zephir_is_callable(beforeMatch TSRMLS_CC)) { ZEPHIR_THROW_EXCEPTION_STR(test_router_exception_ce, "Before-Match callback is not callable in matched route"); return; } } } if (zephir_is_true(routeFound)) { ZEPHIR_CALL_METHOD(&paths, route, "getpaths", NULL); zephir_check_call_status(); ZEPHIR_CPY_WRT(parts, paths); if (Z_TYPE_P(matches) == IS_ARRAY) { ZEPHIR_CALL_METHOD(&converters, route, "getconverters", NULL); zephir_check_call_status(); zephir_is_iterable(paths, &_9, &_8, 0, 0); for ( ; zephir_hash_get_current_data_ex(_9, (void**) &_10, &_8) == SUCCESS ; zephir_hash_move_forward_ex(_9, &_8) ) { ZEPHIR_GET_HMKEY(part, _9, _8); ZEPHIR_GET_HVALUE(position, _10); ZEPHIR_OBS_NVAR(matchPosition); if (zephir_array_isset_fetch(&matchPosition, matches, position, 0 TSRMLS_CC)) { if (Z_TYPE_P(converters) == IS_ARRAY) { if (zephir_array_isset(converters, part)) { continue; } } zephir_array_update_zval(&parts, part, &matchPosition, PH_COPY | PH_SEPARATE); } else { if (Z_TYPE_P(converters) == IS_ARRAY) { if (zephir_array_isset(converters, part)) { } } } } zephir_update_property_this(this_ptr, SL("_matches"), matches TSRMLS_CC); } zephir_update_property_this(this_ptr, SL("_matchedRoute"), route TSRMLS_CC); break; } } if (zephir_is_true(routeFound)) { zephir_update_property_this(this_ptr, SL("_wasMatched"), (1) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_wasMatched"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } if (!(zephir_is_true(routeFound))) { ZEPHIR_OBS_VAR(notFoundPaths); zephir_read_property_this(¬FoundPaths, this_ptr, SL("_notFoundPaths"), PH_NOISY_CC); if (Z_TYPE_P(notFoundPaths) != IS_NULL) { ZEPHIR_CPY_WRT(parts, notFoundPaths); ZEPHIR_INIT_BNVAR(routeFound); ZVAL_BOOL(routeFound, 1); } } if (zephir_is_true(routeFound)) { ZEPHIR_OBS_VAR(vnamespace); if (zephir_array_isset_string_fetch(&vnamespace, parts, SS("namespace"), 0 TSRMLS_CC)) { if (!(zephir_is_numeric(vnamespace))) { zephir_update_property_this(this_ptr, SL("_namespace"), vnamespace TSRMLS_CC); } zephir_array_unset_string(&parts, SS("namespace"), PH_SEPARATE); } else { _4 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultNamespace"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_namespace"), _4 TSRMLS_CC); } ZEPHIR_OBS_VAR(module); if (zephir_array_isset_string_fetch(&module, parts, SS("module"), 0 TSRMLS_CC)) { if (!(zephir_is_numeric(module))) { zephir_update_property_this(this_ptr, SL("_module"), module TSRMLS_CC); } zephir_array_unset_string(&parts, SS("module"), PH_SEPARATE); } else { _4 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultModule"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_module"), _4 TSRMLS_CC); } ZEPHIR_OBS_VAR(controller); if (zephir_array_isset_string_fetch(&controller, parts, SS("controller"), 0 TSRMLS_CC)) { if (!(zephir_is_numeric(controller))) { zephir_update_property_this(this_ptr, SL("_controller"), controller TSRMLS_CC); } zephir_array_unset_string(&parts, SS("controller"), PH_SEPARATE); } else { _4 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultController"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_controller"), _4 TSRMLS_CC); } ZEPHIR_OBS_VAR(action); if (zephir_array_isset_string_fetch(&action, parts, SS("action"), 0 TSRMLS_CC)) { if (!(zephir_is_numeric(action))) { zephir_update_property_this(this_ptr, SL("_action"), action TSRMLS_CC); } zephir_array_unset_string(&parts, SS("action"), PH_SEPARATE); } else { _4 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAction"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_action"), _4 TSRMLS_CC); } ZEPHIR_OBS_VAR(paramsStr); if (zephir_array_isset_string_fetch(¶msStr, parts, SS("params"), 0 TSRMLS_CC)) { ZEPHIR_SINIT_VAR(_11); ZVAL_LONG(&_11, 1); ZEPHIR_CALL_FUNCTION(&strParams, "substr", &_12, paramsStr, &_11); zephir_check_call_status(); if (zephir_is_true(strParams)) { ZEPHIR_INIT_BNVAR(params); zephir_fast_explode_str(params, SL("/"), strParams, LONG_MAX TSRMLS_CC); } zephir_array_unset_string(&parts, SS("params"), PH_SEPARATE); } if (zephir_fast_count_int(params TSRMLS_CC)) { ZEPHIR_INIT_VAR(paramsMerge); zephir_fast_array_merge(paramsMerge, &(params), &(parts) TSRMLS_CC); } else { ZEPHIR_CPY_WRT(paramsMerge, parts); } zephir_update_property_this(this_ptr, SL("_params"), paramsMerge TSRMLS_CC); } else { _4 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultNamespace"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_namespace"), _4 TSRMLS_CC); _13 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultModule"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_module"), _13 TSRMLS_CC); _14 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultController"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_controller"), _14 TSRMLS_CC); _15 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAction"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_action"), _15 TSRMLS_CC); _16 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultParams"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_params"), _16 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); }
PHP_METHOD(PhalconPlus_Logger_Formatter_LinePlus, format) { zephir_fcall_cache_entry *_13 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *message, message_sub, *type, type_sub, *timestamp, timestamp_sub, *context = NULL, context_sub, __$null, _0, _1, _2, _3, matches, result, _4, _5, _6, replace0, replace1, val1, val2, processors, *_10, logStr, _15, _16, _7$$3, _8$$3, _9$$3, _11$$4, _12$$5, _14$$6; zval *this_ptr = getThis(); ZVAL_UNDEF(&message_sub); ZVAL_UNDEF(&type_sub); ZVAL_UNDEF(×tamp_sub); ZVAL_UNDEF(&context_sub); ZVAL_NULL(&__$null); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_3); ZVAL_UNDEF(&matches); ZVAL_UNDEF(&result); ZVAL_UNDEF(&_4); ZVAL_UNDEF(&_5); ZVAL_UNDEF(&_6); ZVAL_UNDEF(&replace0); ZVAL_UNDEF(&replace1); ZVAL_UNDEF(&val1); ZVAL_UNDEF(&val2); ZVAL_UNDEF(&processors); ZVAL_UNDEF(&logStr); ZVAL_UNDEF(&_15); ZVAL_UNDEF(&_16); ZVAL_UNDEF(&_7$$3); ZVAL_UNDEF(&_8$$3); ZVAL_UNDEF(&_9$$3); ZVAL_UNDEF(&_11$$4); ZVAL_UNDEF(&_12$$5); ZVAL_UNDEF(&_14$$6); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 1, &message, &type, ×tamp, &context); if (!context) { context = &context_sub; context = &__$null; } ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "message"); zephir_update_property_array(this_ptr, SL("processors"), &_0, message TSRMLS_CC); ZEPHIR_INIT_VAR(&_1); ZVAL_STRING(&_1, "Y-m-d H:i:s"); ZEPHIR_CALL_FUNCTION(&_2, "date", NULL, 33, &_1, timestamp); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_1); ZVAL_STRING(&_1, "date"); zephir_update_property_array(this_ptr, SL("processors"), &_1, &_2 TSRMLS_CC); ZEPHIR_CALL_METHOD(&_2, this_ptr, "gettypestring", NULL, 0, type); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "type"); zephir_update_property_array(this_ptr, SL("processors"), &_3, &_2 TSRMLS_CC); ZEPHIR_INIT_VAR(&matches); array_init(&matches); zephir_read_property(&_4, this_ptr, SL("formatString"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_5); ZVAL_STRING(&_5, "/%(\\w+)%/"); ZEPHIR_INIT_VAR(&_6); ZVAL_STRING(&_6, "/%(\\w+)%/"); ZEPHIR_INIT_VAR(&result); zephir_preg_match(&result, &_6, &_4, &matches, 1, 0 , 0 TSRMLS_CC); if (ZEPHIR_IS_FALSE(&result)) { ZEPHIR_INIT_VAR(&_7$$3); object_init_ex(&_7$$3, spl_ce_InvalidArgumentException); zephir_read_property(&_8$$3, this_ptr, SL("formatString"), PH_NOISY_CC | PH_READONLY); ZEPHIR_INIT_VAR(&_9$$3); ZEPHIR_CONCAT_SV(&_9$$3, "Logger format is not valid: ", &_8$$3); ZEPHIR_CALL_METHOD(NULL, &_7$$3, "__construct", NULL, 15, &_9$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_7$$3, "phalconplus/Logger/Formatter/LinePlus.zep", 29 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_MAKE_REF(&matches); ZEPHIR_CALL_FUNCTION(&replace0, "reset", NULL, 47, &matches); ZEPHIR_UNREF(&matches); zephir_check_call_status(); ZEPHIR_MAKE_REF(&matches); ZEPHIR_CALL_FUNCTION(&replace1, "end", NULL, 31, &matches); ZEPHIR_UNREF(&matches); zephir_check_call_status(); ZEPHIR_INIT_VAR(&processors); array_init(&processors); zephir_is_iterable(&replace1, 0, "phalconplus/Logger/Formatter/LinePlus.zep", 46); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&replace1), _10) { ZEPHIR_INIT_NVAR(&val1); ZVAL_COPY(&val1, _10); ZEPHIR_OBS_NVAR(&val2); zephir_read_property(&_11$$4, this_ptr, SL("processors"), PH_NOISY_CC | PH_READONLY); if (zephir_array_isset_fetch(&val2, &_11$$4, &val1, 0 TSRMLS_CC)) { ZEPHIR_CALL_FUNCTION(&_12$$5, "strval", &_13, 27, &val2); zephir_check_call_status(); zephir_array_update_zval(&processors, &val1, &_12$$5, PH_COPY | PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(&_14$$6); ZVAL_STRING(&_14$$6, "undefined"); zephir_array_update_zval(&processors, &val1, &_14$$6, PH_COPY | PH_SEPARATE); } } ZEND_HASH_FOREACH_END();
/** * Handles routing information received from the rewrite engine * *<code> * //Read the info from the rewrite engine * $router->handle(); * * //Manually passing an URL * $router->handle('/posts/edit/1'); *</code> * * @param string uri */ PHP_METHOD(Test_Router, handle) { zend_function *_8 = NULL, *_9 = NULL, *_11 = NULL, *_12 = NULL, *_14 = NULL; HashTable *_3, *_16; HashPosition _2, _15; zval *uri = NULL, *realUri = NULL, *request = NULL, *currentHostName = NULL, *routeFound = NULL, *parts = NULL, *params, *matches, *notFoundPaths, *vnamespace, *module, *controller, *action, *paramsStr, *strParams, *paramsMerge = NULL, *route = NULL, *methods = NULL, *dependencyInjector = NULL, *hostname = NULL, *regexHostName = NULL, *matched = NULL, *pattern = NULL, *handledUri = NULL, *beforeMatch = NULL, *paths = NULL, *converters = NULL, *part = NULL, *position = NULL, *matchPosition = NULL, *_0, *_1, **_4, *_5, *_6 = NULL, *_7 = NULL, *_10 = NULL, *_13 = NULL, **_17, *_18, *_19, *_20, *_21, *_22; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &uri); if (!uri) { uri = ZEPHIR_GLOBAL(global_null); } if (!(zephir_is_true(uri))) { ZEPHIR_INIT_VAR(realUri); zephir_call_method(realUri, this_ptr, "getrewriteuri"); } else { ZEPHIR_CPY_WRT(realUri, uri); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_removeExtraSlashes"), PH_NOISY_CC); if (zephir_is_true(_0)) { ZEPHIR_INIT_VAR(handledUri); zephir_call_method_p1(handledUri, this_ptr, "doremoveextraslashes", realUri); } else { ZEPHIR_CPY_WRT(handledUri, realUri); } ZEPHIR_INIT_VAR(request); ZVAL_NULL(request); ZEPHIR_INIT_VAR(currentHostName); ZVAL_NULL(currentHostName); ZEPHIR_INIT_VAR(routeFound); ZVAL_BOOL(routeFound, 0); ZEPHIR_INIT_VAR(parts); array_init(parts); ZEPHIR_INIT_VAR(params); array_init(params); ZEPHIR_INIT_VAR(matches); ZVAL_NULL(matches); zephir_update_property_this(this_ptr, SL("_wasMatched"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_matchedRoute"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_routes"), PH_NOISY_CC); zephir_is_iterable(_1, &_3, &_2, 0, 1); for ( ; zend_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zend_hash_move_backwards_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(route, _4); ZEPHIR_INIT_NVAR(methods); zephir_call_method(methods, route, "gethttpmethods"); if ((Z_TYPE_P(methods) != IS_NULL)) { if ((Z_TYPE_P(request) == IS_NULL)) { _5 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _5); if ((Z_TYPE_P(dependencyInjector) != IS_OBJECT)) { ZEPHIR_INIT_LNVAR(_6); object_init_ex(_6, test_router_exception_ce); ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "A dependency injection container is required to access the 'request' service", 1); zephir_call_method_p1_cache_noret(_6, "__construct", &_8, _7); zephir_throw_exception(_6 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "request", 1); ZEPHIR_INIT_NVAR(request); zephir_call_method_p1_cache(request, dependencyInjector, "getshared", &_9, _7); } ZEPHIR_INIT_NVAR(_7); zephir_call_method_p1(_7, request, "ismethod", methods); if (ZEPHIR_IS_FALSE(_7)) { continue; } } ZEPHIR_INIT_NVAR(hostname); zephir_call_method(hostname, route, "gethostname"); if ((Z_TYPE_P(hostname) != IS_NULL)) { if ((Z_TYPE_P(request) == IS_NULL)) { ZEPHIR_OBS_NVAR(dependencyInjector); zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); if ((Z_TYPE_P(dependencyInjector) != IS_OBJECT)) { ZEPHIR_INIT_LNVAR(_6); object_init_ex(_6, test_router_exception_ce); ZEPHIR_INIT_NVAR(_10); ZVAL_STRING(_10, "A dependency injection container is required to access the 'request' service", 1); zephir_call_method_p1_cache_noret(_6, "__construct", &_11, _10); zephir_throw_exception(_6 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "request", 1); ZEPHIR_INIT_NVAR(request); zephir_call_method_p1_cache(request, dependencyInjector, "getshared", &_12, _7); } if ((Z_TYPE_P(currentHostName) != IS_OBJECT)) { ZEPHIR_INIT_NVAR(currentHostName); zephir_call_method(currentHostName, request, "gethttphost"); } if ((Z_TYPE_P(currentHostName) != IS_NULL)) { continue; } ZEPHIR_INIT_NVAR(matched); if (zephir_memnstr_str(hostname, SL("("), "test/router.zep", 381)) { if (zephir_memnstr_str(hostname, SL("#"), "test/router.zep", 382)) { ZEPHIR_INIT_NVAR(regexHostName); ZEPHIR_CONCAT_SVS(regexHostName, "#^", hostname, "$#"); } else { ZEPHIR_CPY_WRT(regexHostName, hostname); } ZEPHIR_INIT_NVAR(_13); zephir_preg_match(matched, &(matched), regexHostName, currentHostName, _13, 0, 0 , 0 TSRMLS_CC); } else { ZVAL_BOOL(matched, ZEPHIR_IS_EQUAL(currentHostName, hostname)); } if (!(zephir_is_true(matched))) { continue; } } ZEPHIR_INIT_NVAR(pattern); zephir_call_method(pattern, route, "getcompiledpattern"); ZEPHIR_INIT_NVAR(routeFound); if (zephir_memnstr_str(pattern, SL("^"), "test/router.zep", 400)) { zephir_preg_match(routeFound, &(routeFound), pattern, handledUri, matches, 0, 0 , 0 TSRMLS_CC); } else { ZVAL_BOOL(routeFound, ZEPHIR_IS_EQUAL(pattern, handledUri)); } if (zephir_is_true(routeFound)) { ZEPHIR_INIT_NVAR(beforeMatch); zephir_call_method(beforeMatch, route, "getbeforematch"); if ((Z_TYPE_P(beforeMatch) != IS_NULL)) { if (zephir_is_callable(beforeMatch TSRMLS_CC)) { ZEPHIR_INIT_LNVAR(_6); object_init_ex(_6, test_router_exception_ce); ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "Before-Match callback is not callable in matched route", 1); zephir_call_method_p1_cache_noret(_6, "__construct", &_14, _7); zephir_throw_exception(_6 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } } if (zephir_is_true(routeFound)) { ZEPHIR_INIT_NVAR(paths); zephir_call_method(paths, route, "getpaths"); ZEPHIR_CPY_WRT(parts, paths); if ((Z_TYPE_P(matches) == IS_ARRAY)) { ZEPHIR_INIT_NVAR(converters); zephir_call_method(converters, route, "getconverters"); zephir_is_iterable(paths, &_16, &_15, 0, 0); for ( ; zend_hash_get_current_data_ex(_16, (void**) &_17, &_15) == SUCCESS ; zephir_hash_move_forward_ex(_16, &_15) ) { ZEPHIR_GET_HMKEY(part, _16, _15); ZEPHIR_GET_HVALUE(position, _17); ZEPHIR_OBS_NVAR(matchPosition); if (zephir_array_isset_fetch(&matchPosition, matches, position, 0 TSRMLS_CC)) { if ((Z_TYPE_P(converters) == IS_ARRAY)) { if (zephir_array_isset(converters, part)) { continue; } } zephir_array_update_zval(&parts, part, &matchPosition, PH_COPY | PH_SEPARATE); } else { if ((Z_TYPE_P(converters) == IS_ARRAY)) { if (zephir_array_isset(converters, part)) { } } } } zephir_update_property_this(this_ptr, SL("_matches"), matches TSRMLS_CC); } zephir_update_property_this(this_ptr, SL("_matchedRoute"), route TSRMLS_CC); break; } } if (zephir_is_true(routeFound)) { zephir_update_property_this(this_ptr, SL("_wasMatched"), (1) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_wasMatched"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC); } if (!(zephir_is_true(routeFound))) { ZEPHIR_OBS_VAR(notFoundPaths); zephir_read_property_this(¬FoundPaths, this_ptr, SL("_notFoundPaths"), PH_NOISY_CC); if ((Z_TYPE_P(notFoundPaths) != IS_NULL)) { ZEPHIR_CPY_WRT(parts, notFoundPaths); ZEPHIR_INIT_BNVAR(routeFound); ZVAL_BOOL(routeFound, 1); } } if (zephir_is_true(routeFound)) { ZEPHIR_OBS_VAR(vnamespace); if (zephir_array_isset_string_fetch(&vnamespace, parts, SS("namespace"), 0 TSRMLS_CC)) { if (!(zephir_is_numeric(vnamespace))) { zephir_update_property_this(this_ptr, SL("_namespace"), vnamespace TSRMLS_CC); } zephir_array_fetch_string(&_18, parts, SL("namespace"), PH_NOISY | PH_READONLY TSRMLS_CC); zephir_array_unset(&parts, _18, PH_SEPARATE); } else { _5 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultNamespace"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_namespace"), _5 TSRMLS_CC); } ZEPHIR_OBS_VAR(module); if (zephir_array_isset_string_fetch(&module, parts, SS("module"), 0 TSRMLS_CC)) { if (!(zephir_is_numeric(module))) { zephir_update_property_this(this_ptr, SL("_module"), module TSRMLS_CC); } zephir_array_fetch_string(&_18, parts, SL("module"), PH_NOISY | PH_READONLY TSRMLS_CC); zephir_array_unset(&parts, _18, PH_SEPARATE); } else { _5 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultModule"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_module"), _5 TSRMLS_CC); } ZEPHIR_OBS_VAR(controller); if (zephir_array_isset_string_fetch(&controller, parts, SS("controller"), 0 TSRMLS_CC)) { if (!(zephir_is_numeric(controller))) { zephir_update_property_this(this_ptr, SL("_controller"), controller TSRMLS_CC); } zephir_array_fetch_string(&_18, parts, SL("controller"), PH_NOISY | PH_READONLY TSRMLS_CC); zephir_array_unset(&parts, _18, PH_SEPARATE); } else { _5 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultController"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_controller"), _5 TSRMLS_CC); } ZEPHIR_OBS_VAR(action); if (zephir_array_isset_string_fetch(&action, parts, SS("action"), 0 TSRMLS_CC)) { if (!(zephir_is_numeric(action))) { zephir_update_property_this(this_ptr, SL("_action"), action TSRMLS_CC); } zephir_array_fetch_string(&_18, parts, SL("action"), PH_NOISY | PH_READONLY TSRMLS_CC); zephir_array_unset(&parts, _18, PH_SEPARATE); } else { _5 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAction"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_action"), _5 TSRMLS_CC); } ZEPHIR_OBS_VAR(paramsStr); if (zephir_array_isset_string_fetch(¶msStr, parts, SS("params"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(strParams); zephir_substr(strParams, paramsStr, 1 , 0 ); if (zephir_is_true(strParams)) { ZEPHIR_INIT_BNVAR(params); zephir_fast_explode_str(params, SL("/"), strParams, LONG_MAX TSRMLS_CC); } zephir_array_fetch_string(&_18, parts, SL("params"), PH_NOISY | PH_READONLY TSRMLS_CC); zephir_array_unset(&parts, _18, PH_SEPARATE); } if (zephir_fast_count_int(params TSRMLS_CC)) { ZEPHIR_INIT_VAR(paramsMerge); zephir_fast_array_merge(paramsMerge, &(params), &(parts) TSRMLS_CC); } else { ZEPHIR_CPY_WRT(paramsMerge, parts); } zephir_update_property_this(this_ptr, SL("_params"), paramsMerge TSRMLS_CC); } else { _5 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultNamespace"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_namespace"), _5 TSRMLS_CC); _19 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultModule"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_module"), _19 TSRMLS_CC); _20 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultController"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_controller"), _20 TSRMLS_CC); _21 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultAction"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_action"), _21 TSRMLS_CC); _22 = zephir_fetch_nproperty_this(this_ptr, SL("_defaultParams"), PH_NOISY_CC); zephir_update_property_this(this_ptr, SL("_params"), _22 TSRMLS_CC); } ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Auryn_AbstractCachingReflector, getParamTypeHint) { int ZEPHIR_LAST_CALL_STATUS; zval *function, *param, *lowParam, *lowClass, *lowMethod, *lowFunc, *paramCacheKey = NULL, *classCacheKey, *typeHint = NULL, *reflectionClass = NULL, *_0, *_1 = NULL, *_2, *_3, *_4; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &function, ¶m); if (!(zephir_is_instance_of(function, SL("ReflectionFunctionAbstract") TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'function' must be an instance of 'ReflectionFunctionAbstract'", "", 0); return; } if (!(zephir_is_instance_of(param, SL("ReflectionParameter") TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'param' must be an instance of 'ReflectionParameter'", "", 0); return; } ZEPHIR_INIT_VAR(lowParam); ZEPHIR_OBS_VAR(_0); zephir_read_property(&_0, param, SL("name"), PH_NOISY_CC); zephir_fast_strtolower(lowParam, _0); if (zephir_is_instance_of(function, SL("ReflectionMethod") TSRMLS_CC)) { ZEPHIR_INIT_VAR(lowClass); ZEPHIR_OBS_VAR(_1); zephir_read_property(&_1, function, SL("class"), PH_NOISY_CC); zephir_fast_strtolower(lowClass, _1); ZEPHIR_INIT_VAR(lowMethod); ZEPHIR_OBS_VAR(_2); zephir_read_property(&_2, function, SL("name"), PH_NOISY_CC); zephir_fast_strtolower(lowMethod, _2); ZEPHIR_INIT_VAR(paramCacheKey); ZEPHIR_CONCAT_SVSVSVSV(paramCacheKey, "auryn.refls.classes.", lowClass, ".", lowMethod, ".", param, "-", lowParam); } else { ZEPHIR_INIT_VAR(lowFunc); ZEPHIR_OBS_NVAR(_1); zephir_read_property(&_1, function, SL("name"), PH_NOISY_CC); zephir_fast_strtolower(lowFunc, _1); ZEPHIR_INIT_NVAR(paramCacheKey); if (!ZEPHIR_IS_STRING(lowFunc, "{closure}")) { ZEPHIR_CONCAT_SSVSVSV(paramCacheKey, "auryn.refls.funcs.", ".", lowFunc, ".", param, "-", lowParam); } else { ZVAL_NULL(paramCacheKey); } } if (Z_TYPE_P(paramCacheKey) == IS_NULL) { ZEPHIR_INIT_VAR(typeHint); ZVAL_BOOL(typeHint, 0); } else { _3 = zephir_fetch_nproperty_this(this_ptr, SL("cache"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&typeHint, _3, "fetch", NULL, paramCacheKey); zephir_check_call_status(); } if (!ZEPHIR_IS_FALSE(typeHint)) { RETURN_CCTOR(typeHint); } ZEPHIR_CALL_METHOD(&reflectionClass, param, "getclass", NULL); zephir_check_call_status(); if (zephir_is_true(reflectionClass)) { ZEPHIR_CALL_METHOD(&typeHint, reflectionClass, "getname", NULL); zephir_check_call_status(); ZEPHIR_INIT_VAR(_4); zephir_fast_strtolower(_4, typeHint); ZEPHIR_INIT_VAR(classCacheKey); ZEPHIR_CONCAT_SV(classCacheKey, "auryn.refls.classes.", _4); _3 = zephir_fetch_nproperty_this(this_ptr, SL("cache"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, _3, "store", NULL, classCacheKey, reflectionClass); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(typeHint); ZVAL_NULL(typeHint); } _3 = zephir_fetch_nproperty_this(this_ptr, SL("cache"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(NULL, _3, "store", NULL, paramCacheKey, typeHint); zephir_check_call_status(); RETURN_CCTOR(typeHint); }