/** * Mounts a group of routes in the router * * @param Test\Router\Group route * @return Test\Router */ PHP_METHOD(Test_Router, mount) { HashTable *_1, *_4; HashPosition _0, _3; zval *group, *groupRoutes, *beforeMatch, *hostname, *routes, *route = NULL, **_2, **_5, *_6; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &group); if ((Z_TYPE_P(group) != IS_OBJECT)) { ZEPHIR_THROW_EXCEPTION_STR(test_router_exception_ce, "The group of routes is not valid"); return; } ZEPHIR_INIT_VAR(groupRoutes); zephir_call_method(groupRoutes, group, "getroutes"); if (!(zephir_fast_count_int(groupRoutes TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_STR(test_router_exception_ce, "The group of routes does not contain any routes"); return; } ZEPHIR_INIT_VAR(beforeMatch); zephir_call_method(beforeMatch, group, "getbeforematch"); if ((Z_TYPE_P(beforeMatch) != IS_NULL)) { zephir_is_iterable(groupRoutes, &_1, &_0, 0, 0); for ( ; zend_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS ; zend_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HVALUE(route, _2); zephir_call_method_p1_noret(route, "beforematch", beforeMatch); } } ZEPHIR_INIT_VAR(hostname); zephir_call_method(hostname, group, "gethostname"); if ((Z_TYPE_P(hostname) != IS_NULL)) { zephir_is_iterable(groupRoutes, &_4, &_3, 0, 0); for ( ; zend_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS ; zend_hash_move_forward_ex(_4, &_3) ) { ZEPHIR_GET_HVALUE(route, _5); zephir_call_method_p1_noret(route, "sethostname", hostname); } } routes = zephir_fetch_nproperty_this(this_ptr, SL("_routes"), PH_NOISY_CC); if ((Z_TYPE_P(routes) == IS_ARRAY)) { ZEPHIR_INIT_VAR(_6); zephir_fast_array_merge(_6, &(routes), &(groupRoutes) TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_routes"), _6 TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_routes"), groupRoutes TSRMLS_CC); } RETURN_THIS(); }
/** * CacheExecute: cached Execute * * @param int timeout count of seconds for cache expiry * @param string statement String query to execute * @param array vars Array of variables to bind [optional] * @return ResultSet|null object or false if fail */ PHP_METHOD(ADOdb_Connection, cacheExecute) { zval *vars = NULL; zval *statement = NULL; zval *timeout_param = NULL, *statement_param = NULL, *vars_param = NULL, *_0, *_1; int timeout; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &timeout_param, &statement_param, &vars_param); timeout = zephir_get_intval(timeout_param); zephir_get_strval(statement, statement_param); if (!vars_param) { ZEPHIR_INIT_VAR(vars); array_init(vars); } else { zephir_get_arrval(vars, vars_param); } object_init_ex(return_value, adodb_resultset_ce); ZEPHIR_INIT_VAR(_0); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, timeout); zephir_call_method_p3(_0, this_ptr, "cachequery", _1, statement, vars); zephir_call_method_p1_noret(return_value, "__construct", _0); RETURN_MM(); }
/** * 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(); }
/** * Set a group of paths to be returned when none of the defined routes are matched * * @param array paths * @return Test\Router */ PHP_METHOD(Test_Router, notFound) { zval *paths, *_0, *_1; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &paths); if ((Z_TYPE_P(paths) != IS_ARRAY)) { if ((Z_TYPE_P(paths) != IS_STRING)) { ZEPHIR_INIT_VAR(_0); object_init_ex(_0, test_router_exception_ce); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "The not-found paths must be an array or string", 1); zephir_call_method_p1_noret(_0, "__construct", _1); zephir_throw_exception(_0 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } zephir_update_property_this(this_ptr, SL("_notFoundPaths"), paths TSRMLS_CC); RETURN_THIS(); }
/** * @param int timeout * @param string statement query statement * @param array vars [optional] * @return Statement object * @throws ConnectionException */ PHP_METHOD(ADOdb_Connection, cacheQuery) { zval *vars = NULL; zval *statement = NULL; zval *timeout_param = NULL, *statement_param = NULL, *vars_param = NULL, *_0, *queryId, *st = NULL, *_1, *_2, *_3 = NULL, *_4, *_5, _6, _7; int timeout; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &timeout_param, &statement_param, &vars_param); timeout = zephir_get_intval(timeout_param); zephir_get_strval(statement, statement_param); if (!vars_param) { ZEPHIR_INIT_VAR(vars); array_init(vars); } else { zephir_get_arrval(vars, vars_param); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("cache"), PH_NOISY_CC); if ((Z_TYPE_P(_0) != IS_NULL)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("cache"), PH_NOISY_CC); ZEPHIR_INIT_VAR(queryId); zephir_call_method_p2(queryId, _1, "getqueryid", statement, vars); _2 = zephir_fetch_nproperty_this(this_ptr, SL("cache"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, timeout); ZEPHIR_INIT_VAR(st); zephir_call_method_p2(st, _2, "read", queryId, _3); if (!zephir_is_true(st)) { ZEPHIR_INIT_NVAR(_3); ZVAL_STRING(_3, "Cache miss!", 1); zephir_call_method_p1_noret(this_ptr, "debug", _3); _4 = zephir_fetch_nproperty_this(this_ptr, SL("connection"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(st); zephir_call_method_p2(st, _4, "query", statement, vars); _5 = zephir_fetch_nproperty_this(this_ptr, SL("cache"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, timeout); zephir_call_method_p3_noret(_5, "write", queryId, st, _3); } RETURN_CCTOR(st); } else { ZEPHIR_SINIT_VAR(_6); ZVAL_STRING(&_6, "No cache engine found!", 0); ZEPHIR_SINIT_VAR(_7); ZVAL_LONG(&_7, 512); zephir_call_func_p2_noret("user_error", &_6, &_7); zephir_call_method_p2(return_value, this_ptr, "query", statement, vars); RETURN_MM(); } ZEPHIR_MM_RESTORE(); }
PHP_METHOD(ADOdb_Connection, __set) { zval *name_param = NULL, *value, *_0; zval *name = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &name_param, &value); zephir_get_strval(name, name_param); do { if (ZEPHIR_IS_STRING(name, "host")) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_method_p1_noret(_0, "sethostname", value); break; } if (ZEPHIR_IS_STRING(name, "database")) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_method_p1_noret(_0, "setdatabase", value); break; } if (ZEPHIR_IS_STRING(name, "user")) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_method_p1_noret(_0, "setusername", value); break; } if (ZEPHIR_IS_STRING(name, "password")) { _0 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_method_p1_noret(_0, "setpassword", value); break; } if (ZEPHIR_IS_STRING(name, "debug")) { zephir_call_method_p1_noret(this_ptr, "setdebug", value); break; } } while(0); ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Test_Exceptions, getException) { zval *_0; ZEPHIR_MM_GROW(); object_init_ex(return_value, test_exception_ce); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "hello4", 1); zephir_call_method_p1_noret(return_value, "__construct", _0); RETURN_MM(); }
PHP_METHOD(OAuth_V1_Service, getAuthorizationUri) { zend_function *_6 = NULL; HashTable *_4; HashPosition _3; zend_class_entry *_1; zval *params = NULL, *uri, *endpoint, *key = NULL, *value = NULL, *_0, *_2, **_5; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, ¶ms); if (!params) { params = ZEPHIR_GLOBAL(global_null); } if (((Z_TYPE_P(params) != IS_ARRAY) && (Z_TYPE_P(params) != IS_NULL))) { ZEPHIR_INIT_VAR(_0); _1 = zend_fetch_class(SL("InvalidArgumentException"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(_0, _1); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "The params must be an Array", 1); zephir_call_method_p1_noret(_0, "__construct", _2); zephir_throw_exception(_0 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(endpoint); object_init_ex(endpoint, oauth_uri_ce); zephir_call_method_noret(endpoint, "__construct"); ZEPHIR_INIT_VAR(uri); if (zephir_clone(uri, endpoint TSRMLS_CC) == FAILURE) { RETURN_MM(); } if ((Z_TYPE_P(params) != IS_ARRAY)) { zephir_is_iterable(params, &_4, &_3, 0, 0); for ( ; zend_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS ; zend_hash_move_forward_ex(_4, &_3) ) { ZEPHIR_GET_HMKEY(key, _4, _3); ZEPHIR_GET_HVALUE(value, _5); zephir_call_method_p2_cache_noret(uri, "addtoquery", &_6, key, value); } } RETURN_CCTOR(uri); }
PHP_METHOD(Test_Exceptions, testException2) { zval *msg, *_0; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(msg); ZVAL_STRING(msg, "hello2", 1); ZEPHIR_INIT_VAR(_0); object_init_ex(_0, test_exception_ce); zephir_call_method_p1_noret(_0, "__construct", msg); zephir_throw_exception(_0 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; }
PHP_METHOD(Test_Exceptions, testException3) { zval *ex, *msg; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(msg); ZVAL_STRING(msg, "hello3", 1); ZEPHIR_INIT_VAR(ex); object_init_ex(ex, test_exception_ce); zephir_call_method_p1_noret(ex, "__construct", msg); zephir_throw_exception(ex TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; }
/** * Build signature string from array. * * @param array signatureData * @return string */ PHP_METHOD(OAuth_V1_Signature, buildSignatureString) { HashTable *_4; HashPosition _3; zend_class_entry *_1; zval *signatureData, *signatureString = NULL, *delimiter = NULL, *key = NULL, *value = NULL, *_0, *_2, **_5; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &signatureData); if ((Z_TYPE_P(signatureData) != IS_ARRAY)) { ZEPHIR_INIT_VAR(_0); _1 = zend_fetch_class(SL("InvalidArgumentException"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(_0, _1); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "The signatureData must be an Array", 1); zephir_call_method_p1_noret(_0, "__construct", _2); zephir_throw_exception(_0 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(signatureString); ZVAL_STRING(signatureString, "", 1); ZEPHIR_INIT_VAR(delimiter); ZVAL_STRING(delimiter, "", 1); zephir_is_iterable(signatureData, &_4, &_3, 0, 0); for ( ; zend_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS ; zend_hash_move_forward_ex(_4, &_3) ) { ZEPHIR_GET_HMKEY(key, _4, _3); ZEPHIR_GET_HVALUE(value, _5); ZEPHIR_INIT_NVAR(signatureString); ZEPHIR_CONCAT_VVSV(signatureString, delimiter, key, "=", value); ZEPHIR_INIT_NVAR(delimiter); ZVAL_STRING(delimiter, "&", 1); } RETURN_CCTOR(signatureString); }
PHP_METHOD(ADOdb_Connection, __construct) { zval *dsn_param = NULL, *_0; zval *dsn = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &dsn_param); if (!dsn_param) { ZEPHIR_INIT_VAR(dsn); ZVAL_STRING(dsn, "", 1); } else { zephir_get_strval(dsn, dsn_param); } ZEPHIR_INIT_VAR(_0); object_init_ex(_0, adodb_datasource_ce); zephir_call_method_p1_noret(_0, "__construct", dsn); zephir_update_property_this(this_ptr, SL("dso"), _0 TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Sets an array of default paths. If a route is missing a path the router will use the defined here * This method must not be used to set a 404 route * *<code> * $router->setDefaults(array( * 'module' => 'common', * 'action' => 'index' * )); *</code> * * @param array defaults * @return Test\Router */ PHP_METHOD(Test_Router, setDefaults) { zval *defaults, *namespaceName, *module, *controller, *action, *params, *_0, *_1; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &defaults); if ((Z_TYPE_P(defaults) == IS_ARRAY)) { ZEPHIR_INIT_VAR(_0); object_init_ex(_0, test_router_exception_ce); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "Defaults must be an array", 1); zephir_call_method_p1_noret(_0, "__construct", _1); zephir_throw_exception(_0 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (zephir_array_isset_string_fetch(&namespaceName, defaults, SS("namespace"), 1 TSRMLS_CC)) { zephir_update_property_this(this_ptr, SL("_defaultNamespace"), namespaceName TSRMLS_CC); } if (zephir_array_isset_string_fetch(&module, defaults, SS("module"), 1 TSRMLS_CC)) { zephir_update_property_this(this_ptr, SL("_defaultModule"), module TSRMLS_CC); } if (zephir_array_isset_string_fetch(&controller, defaults, SS("controller"), 1 TSRMLS_CC)) { zephir_update_property_this(this_ptr, SL("_defaultController"), controller TSRMLS_CC); } if (zephir_array_isset_string_fetch(&action, defaults, SS("action"), 1 TSRMLS_CC)) { zephir_update_property_this(this_ptr, SL("_defaultAction"), action TSRMLS_CC); } if (zephir_array_isset_string_fetch(¶ms, defaults, SS("params"), 1 TSRMLS_CC)) { zephir_update_property_this(this_ptr, SL("_defaultParams"), params TSRMLS_CC); } RETURN_THIS(); }
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(); }
/** * Gets the signature * * @param OAuth\UriInterface uri * @param array params * @param string method * * @return string */ PHP_METHOD(OAuth_V1_Signature, getSignature) { HashTable *_4; HashPosition _3; zend_class_entry *_1; zval *method = NULL; zval *uri, *params, *method_param = NULL, *signature, *signatureData, *signatureString, *signatureStringEncoded, *query, *queryStringData = NULL, *queryStringKey = NULL, *queryStringValue = NULL, *queryStringKeyEncoded = NULL, *queryStringValueEncoded = NULL, *scheme, *authority, *path, *hasExplicitTrailingHostSlash, *baseUri, *baseUriEncoded, *dataString, *dataHash, *_0 = NULL, *_2, **_5; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &uri, ¶ms, &method_param); if (!method_param) { ZEPHIR_INIT_VAR(method); ZVAL_STRING(method, "POST", 1); } else { zephir_get_strval(method, method_param); } ZEPHIR_INIT_VAR(query); zephir_call_method(query, uri, "getquery"); ZEPHIR_INIT_VAR(queryStringData); array_init(queryStringData); ZEPHIR_INIT_VAR(signatureData); array_init(signatureData); if ((Z_TYPE_P(params) != IS_ARRAY)) { ZEPHIR_INIT_VAR(_0); _1 = zend_fetch_class(SL("InvalidArgumentException"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(_0, _1); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "The params must be an Array", 1); zephir_call_method_p1_noret(_0, "__construct", _2); zephir_throw_exception(_0 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_NVAR(_0); zephir_fast_array_merge(_0, &(queryStringData), &(params) TSRMLS_CC); ZEPHIR_CPY_WRT(queryStringData, _0); Z_SET_ISREF_P(queryStringData); zephir_call_func_p2_noret("parse_str", query, queryStringData); Z_UNSET_ISREF_P(queryStringData); zephir_is_iterable(queryStringData, &_4, &_3, 0, 0); for ( ; zend_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS ; zend_hash_move_forward_ex(_4, &_3) ) { ZEPHIR_GET_HMKEY(queryStringKey, _4, _3); ZEPHIR_GET_HVALUE(queryStringValue, _5); ZEPHIR_INIT_NVAR(queryStringKeyEncoded); zephir_call_func_p1(queryStringKeyEncoded, "rawurlencode", queryStringKey); ZEPHIR_INIT_NVAR(queryStringValueEncoded); zephir_call_func_p1(queryStringValueEncoded, "rawurlencode", queryStringValue); zephir_array_update_zval(&signatureData, queryStringKeyEncoded, &queryStringValueEncoded, PH_COPY | PH_SEPARATE); } Z_SET_ISREF_P(signatureData); zephir_call_func_p1_noret("ksort", signatureData); Z_UNSET_ISREF_P(signatureData); ZEPHIR_INIT_VAR(scheme); zephir_call_method(scheme, uri, "getscheme"); ZEPHIR_INIT_VAR(authority); zephir_call_method(authority, uri, "getrawauthority"); ZEPHIR_INIT_VAR(path); zephir_call_method(path, uri, "getpath"); ZEPHIR_INIT_VAR(hasExplicitTrailingHostSlash); zephir_call_method(hasExplicitTrailingHostSlash, uri, "hasexplicittrailinghostslash"); ZEPHIR_INIT_VAR(baseUri); ZEPHIR_CONCAT_VSV(baseUri, scheme, "://", authority); if (ZEPHIR_IS_STRING(path, "/")) { if (zephir_is_true(hasExplicitTrailingHostSlash)) { zephir_concat_self_str(&baseUri, SL("/") TSRMLS_CC); } } else { zephir_concat_self(&baseUri, path TSRMLS_CC); } ZEPHIR_INIT_VAR(baseUriEncoded); zephir_call_func_p1(baseUriEncoded, "rawurlencode", baseUri); ZEPHIR_INIT_VAR(signatureString); zephir_call_method_p1(signatureString, this_ptr, "buildsignaturestring", signatureData); ZEPHIR_INIT_VAR(signatureStringEncoded); zephir_call_func_p1(signatureStringEncoded, "rawurlencode", signatureString); ZEPHIR_INIT_VAR(dataString); zephir_fast_strtoupper(dataString, method); ZEPHIR_INIT_BNVAR(dataString); ZEPHIR_CONCAT_VSVSV(dataString, dataString, "&", baseUriEncoded, "&", signatureStringEncoded); ZEPHIR_INIT_VAR(dataHash); zephir_call_method_p1(dataHash, this_ptr, "hash", dataString); ZEPHIR_INIT_VAR(signature); zephir_call_func_p1(signature, "base64_encode", dataHash); RETURN_CCTOR(signature); }
PHP_METHOD(Test_SpectralNorm, process) { zend_function *_5 = NULL, *_6 = NULL, *_7 = NULL, *_11 = NULL, *_12 = NULL, *_16 = NULL, *_18 = NULL, *_20 = NULL, *_21 = NULL; zend_bool _1, _8, _13; zval *n_param = NULL, *u, *v, *w, *_0 = NULL, *_4 = NULL, *_17 = NULL, *_19 = NULL, *_22 = NULL, _23; int n, i, vv = 0, vBv = 0, _2, _3, _9, _10, _14, _15; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &n_param); n = zephir_get_intval(n_param); ZEPHIR_INIT_VAR(u); object_init_ex(u, spl_ce_SplFixedArray); ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, n); zephir_call_method_p1_noret(u, "__construct", _0); ZEPHIR_INIT_VAR(v); object_init_ex(v, spl_ce_SplFixedArray); ZEPHIR_INIT_BNVAR(_0); ZVAL_LONG(_0, n); zephir_call_method_p1_noret(v, "__construct", _0); ZEPHIR_INIT_VAR(w); object_init_ex(w, spl_ce_SplFixedArray); ZEPHIR_INIT_BNVAR(_0); ZVAL_LONG(_0, n); zephir_call_method_p1_noret(w, "__construct", _0); _3 = (n - 1); _2 = 0; _1 = 0; if ((_2 <= _3)) { while (1) { if (_1) { _2++; if (!((_2 <= _3))) { break; } } else { _1 = 1; } i = _2; ZEPHIR_INIT_NVAR(_0); ZVAL_LONG(_0, i); ZEPHIR_INIT_NVAR(_4); ZVAL_LONG(_4, 1); zephir_call_method_p2_cache_noret(u, "offsetset", &_5, _0, _4); ZEPHIR_INIT_NVAR(_0); ZVAL_LONG(_0, i); ZEPHIR_INIT_NVAR(_4); ZVAL_LONG(_4, 1); zephir_call_method_p2_cache_noret(v, "offsetset", &_6, _0, _4); ZEPHIR_INIT_NVAR(_0); ZVAL_LONG(_0, i); ZEPHIR_INIT_NVAR(_4); ZVAL_LONG(_4, 1); zephir_call_method_p2_cache_noret(w, "offsetset", &_7, _0, _4); } } _10 = 9; _9 = 0; _8 = 0; if ((_9 <= _10)) { while (1) { if (_8) { _9++; if (!((_9 <= _10))) { break; } } else { _8 = 1; } i = _9; ZEPHIR_INIT_NVAR(_0); ZVAL_LONG(_0, n); zephir_call_method_p4_cache_noret(this_ptr, "atau", &_11, _0, u, v, w); ZEPHIR_INIT_NVAR(_0); ZVAL_LONG(_0, n); zephir_call_method_p4_cache_noret(this_ptr, "atau", &_12, _0, v, u, w); } } _15 = (n - 1); _14 = 0; _13 = 0; if ((_14 <= _15)) { while (1) { if (_13) { _14++; if (!((_14 <= _15))) { break; } } else { _13 = 1; } i = _14; ZEPHIR_INIT_NVAR(_0); ZEPHIR_INIT_NVAR(_4); ZVAL_LONG(_4, i); zephir_call_method_p1_cache(_0, u, "offsetget", &_16, _4); ZEPHIR_INIT_NVAR(_4); ZEPHIR_INIT_NVAR(_17); ZVAL_LONG(_17, i); zephir_call_method_p1_cache(_4, v, "offsetget", &_18, _17); ZEPHIR_INIT_LNVAR(_19); mul_function(_19, _0, _4 TSRMLS_CC); vBv += zephir_get_numberval(_19); ZEPHIR_INIT_NVAR(_0); ZEPHIR_INIT_NVAR(_4); ZVAL_LONG(_4, i); zephir_call_method_p1_cache(_0, v, "offsetget", &_20, _4); ZEPHIR_INIT_NVAR(_4); ZEPHIR_INIT_NVAR(_17); ZVAL_LONG(_17, i); zephir_call_method_p1_cache(_4, v, "offsetget", &_21, _17); ZEPHIR_INIT_LNVAR(_22); mul_function(_22, _0, _4 TSRMLS_CC); vv += zephir_get_numberval(_22); } } ZEPHIR_SINIT_VAR(_23); ZVAL_LONG(&_23, (vBv / vv)); zephir_call_func_p1(return_value, "sqrt", &_23); RETURN_MM(); }
/** * Connect: Establish connection to a database * @param string hostname Hostname[:port] overriding datasource specs [optional] * @param string username Username overriding datasource specs [optional] * @param string passname Password overriding datasource specs [optional] * @param string database Database name overriding datasource specsString [optional] * @return boolean */ PHP_METHOD(ADOdb_Connection, connect) { zend_function *_6 = NULL; HashTable *_4; HashPosition _3; zval *hostname_param = NULL, *username_param = NULL, *password_param = NULL, *database_param = NULL, *options = NULL, *_0, *_1, *_2, *option = NULL, *value = NULL, **_5; zval *hostname = NULL, *username = NULL, *password = NULL, *database = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 5, &hostname_param, &username_param, &password_param, &database_param, &options); if (!hostname_param) { ZEPHIR_INIT_VAR(hostname); ZVAL_EMPTY_STRING(hostname); } else { zephir_get_strval(hostname, hostname_param); } if (!username_param) { ZEPHIR_INIT_VAR(username); ZVAL_EMPTY_STRING(username); } else { zephir_get_strval(username, username_param); } if (!password_param) { ZEPHIR_INIT_VAR(password); ZVAL_EMPTY_STRING(password); } else { zephir_get_strval(password, password_param); } if (!database_param) { ZEPHIR_INIT_VAR(database); ZVAL_EMPTY_STRING(database); } else { zephir_get_strval(database, database_param); } if (!options) { ZEPHIR_INIT_VAR(options); array_init(options); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("connection"), PH_NOISY_CC); if (zephir_is_true(_0)) { RETURN_MM_BOOL(0); } if (hostname && Z_STRLEN_P(hostname)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_method_p1_noret(_1, "sethostname", hostname); } if (username && Z_STRLEN_P(username)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_method_p1_noret(_1, "setusername", username); } if (password && Z_STRLEN_P(password)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_method_p1_noret(_1, "setpassword", password); } if (database && Z_STRLEN_P(database)) { _1 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_method_p1_noret(_1, "setdatabase", database); } ZEPHIR_INIT_VAR(_2); _1 = zephir_fetch_nproperty_this(this_ptr, SL("dso"), PH_NOISY_CC); zephir_call_static_p1(_2, "ADOdb\\Driver\\DriverManager", "create", _1); zephir_update_property_this(this_ptr, SL("connection"), _2 TSRMLS_CC); zephir_is_iterable(options, &_4, &_3, 0, 0); for ( ; zend_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS ; zephir_hash_move_forward_ex(_4, &_3) ) { ZEPHIR_GET_HMKEY(option, _4, _3); ZEPHIR_GET_HVALUE(value, _5); zephir_call_method_p2_cache_noret(this_ptr, "setattribute", &_6, option, value); } RETURN_MM_BOOL(1); }
/** * Mounts a group of routes in the router * * @param Test\Router\Group route * @return Test\Router */ PHP_METHOD(Test_Router, mount) { HashTable *_3, *_6; HashPosition _2, _5; zval *group, *groupRoutes, *beforeMatch, *hostname, *routes, *route = NULL, *_0 = NULL, *_1 = NULL, **_4, **_7; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &group); if ((Z_TYPE_P(group) != IS_OBJECT)) { ZEPHIR_INIT_VAR(_0); object_init_ex(_0, test_router_exception_ce); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "The group of routes is not valid", 1); zephir_call_method_p1_noret(_0, "__construct", _1); zephir_throw_exception(_0 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(groupRoutes); zephir_call_method(groupRoutes, group, "getroutes"); if (!(zephir_fast_count_int(groupRoutes TSRMLS_CC))) { ZEPHIR_INIT_LNVAR(_0); object_init_ex(_0, test_router_exception_ce); ZEPHIR_INIT_NVAR(_1); ZVAL_STRING(_1, "The group of routes does not contain any routes", 1); zephir_call_method_p1_noret(_0, "__construct", _1); zephir_throw_exception(_0 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(beforeMatch); zephir_call_method(beforeMatch, group, "getbeforematch"); if ((Z_TYPE_P(beforeMatch) != IS_NULL)) { zephir_is_iterable(groupRoutes, &_3, &_2, 0, 0); for ( ; zend_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(route, _4); zephir_call_method_p1_noret(route, "beforematch", beforeMatch); } } ZEPHIR_INIT_VAR(hostname); zephir_call_method(hostname, group, "gethostname"); if ((Z_TYPE_P(hostname) != IS_NULL)) { zephir_is_iterable(groupRoutes, &_6, &_5, 0, 0); for ( ; zend_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS ; zephir_hash_move_forward_ex(_6, &_5) ) { ZEPHIR_GET_HVALUE(route, _7); zephir_call_method_p1_noret(route, "sethostname", hostname); } } ZEPHIR_OBS_VAR(routes); zephir_read_property_this(&routes, this_ptr, SL("_routes"), PH_NOISY_CC); if ((Z_TYPE_P(routes) == IS_ARRAY)) { ZEPHIR_INIT_NVAR(_1); zephir_fast_array_merge(_1, &(routes), &(groupRoutes) TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_routes"), _1 TSRMLS_CC); } else { zephir_update_property_this(this_ptr, SL("_routes"), groupRoutes TSRMLS_CC); } RETURN_THIS(); }
PHP_METHOD(Test_SpectralNorm, process) { zend_function *_8 = NULL, *_9 = NULL, *_10 = NULL, *_14 = NULL, *_15 = NULL, *_19 = NULL, *_21 = NULL, *_23 = NULL, *_24 = NULL; zend_bool _4, _11, _16; zend_class_entry *_0, *_2, *_3; zval *n_param = NULL, *u, *v, *w, *_1 = NULL, *_7 = NULL, *_20 = NULL, *_22 = NULL, *_25 = NULL, _26; int n, i, vv = 0, vBv = 0, _5, _6, _12, _13, _17, _18; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &n_param); n = zephir_get_intval(n_param); ZEPHIR_INIT_VAR(u); _0 = zend_fetch_class(SL("SplFixedArray"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(u, _0); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, n); zephir_call_method_p1_noret(u, "__construct", _1); ZEPHIR_INIT_VAR(v); _2 = zend_fetch_class(SL("SplFixedArray"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(v, _2); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, n); zephir_call_method_p1_noret(v, "__construct", _1); ZEPHIR_INIT_VAR(w); _3 = zend_fetch_class(SL("SplFixedArray"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(w, _3); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, n); zephir_call_method_p1_noret(w, "__construct", _1); _6 = (n - 1); _5 = 0; _4 = 0; if ((_5 <= _6)) { while (1) { if (_4) { _5++; if (!((_5 <= _6))) { break; } } else { _4 = 1; } i = _5; ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, i); ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 1); zephir_call_method_p2_cache_noret(u, "offsetset", &_8, _1, _7); ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, i); ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 1); zephir_call_method_p2_cache_noret(v, "offsetset", &_9, _1, _7); ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, i); ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 1); zephir_call_method_p2_cache_noret(w, "offsetset", &_10, _1, _7); } } _13 = 9; _12 = 0; _11 = 0; if ((_12 <= _13)) { while (1) { if (_11) { _12++; if (!((_12 <= _13))) { break; } } else { _11 = 1; } i = _12; ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, n); zephir_call_method_p4_cache_noret(this_ptr, "atau", &_14, _1, u, v, w); ZEPHIR_INIT_NVAR(_1); ZVAL_LONG(_1, n); zephir_call_method_p4_cache_noret(this_ptr, "atau", &_15, _1, v, u, w); } } _18 = (n - 1); _17 = 0; _16 = 0; if ((_17 <= _18)) { while (1) { if (_16) { _17++; if (!((_17 <= _18))) { break; } } else { _16 = 1; } i = _17; ZEPHIR_INIT_NVAR(_1); ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, i); zephir_call_method_p1_cache(_1, u, "offsetget", &_19, _7); ZEPHIR_INIT_NVAR(_7); ZEPHIR_INIT_NVAR(_20); ZVAL_LONG(_20, i); zephir_call_method_p1_cache(_7, v, "offsetget", &_21, _20); ZEPHIR_INIT_LNVAR(_22); mul_function(_22, _1, _7 TSRMLS_CC); vBv += zephir_get_numberval(_22); ZEPHIR_INIT_NVAR(_1); ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, i); zephir_call_method_p1_cache(_1, v, "offsetget", &_23, _7); ZEPHIR_INIT_NVAR(_7); ZEPHIR_INIT_NVAR(_20); ZVAL_LONG(_20, i); zephir_call_method_p1_cache(_7, v, "offsetget", &_24, _20); ZEPHIR_INIT_LNVAR(_25); mul_function(_25, _1, _7 TSRMLS_CC); vv += zephir_get_numberval(_25); } } ZEPHIR_SINIT_VAR(_26); ZVAL_LONG(&_26, (vBv / vv)); zephir_call_func_p1(return_value, "sqrt", &_26); RETURN_MM(); }