本文整理汇总了C++中zephir_fast_array_merge函数的典型用法代码示例。如果您正苦于以下问题:C++ zephir_fast_array_merge函数的具体用法?C++ zephir_fast_array_merge怎么用?C++ zephir_fast_array_merge使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zephir_fast_array_merge函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Sets the conditions parameter in the criteria
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, where) {
zval *conditions_param = NULL, *bindParams = NULL, *bindTypes = NULL, *currentBindParams = NULL, *mergedParams = NULL, *mergedParamsTypes = NULL, *currentBindTypes = NULL, *_0, *_1$$3, *_2$$3, *_3$$6, *_4$$6;
zval *conditions = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 2, &conditions_param, &bindParams, &bindTypes);
if (unlikely(Z_TYPE_P(conditions_param) != IS_STRING && Z_TYPE_P(conditions_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'conditions' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(conditions_param) == IS_STRING)) {
zephir_get_strval(conditions, conditions_param);
} else {
ZEPHIR_INIT_VAR(conditions);
ZVAL_EMPTY_STRING(conditions);
}
if (!bindParams) {
bindParams = ZEPHIR_GLOBAL(global_null);
}
if (!bindTypes) {
bindTypes = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_INIT_VAR(_0);
ZVAL_STRING(_0, "conditions", 1);
zephir_update_property_array(this_ptr, SL("_params"), _0, conditions TSRMLS_CC);
if (Z_TYPE_P(bindParams) == IS_ARRAY) {
ZEPHIR_OBS_VAR(currentBindParams);
_1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_params"), PH_NOISY_CC);
if (zephir_array_isset_string_fetch(¤tBindParams, _1$$3, SS("bind"), 0 TSRMLS_CC)) {
ZEPHIR_INIT_VAR(mergedParams);
zephir_fast_array_merge(mergedParams, &(currentBindParams), &(bindParams) TSRMLS_CC);
} else {
ZEPHIR_CPY_WRT(mergedParams, bindParams);
}
ZEPHIR_INIT_VAR(_2$$3);
ZVAL_STRING(_2$$3, "bind", 1);
zephir_update_property_array(this_ptr, SL("_params"), _2$$3, mergedParams TSRMLS_CC);
}
if (Z_TYPE_P(bindTypes) == IS_ARRAY) {
ZEPHIR_OBS_VAR(currentBindTypes);
_3$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_params"), PH_NOISY_CC);
if (zephir_array_isset_string_fetch(¤tBindTypes, _3$$6, SS("bindTypes"), 0 TSRMLS_CC)) {
ZEPHIR_INIT_VAR(mergedParamsTypes);
zephir_fast_array_merge(mergedParamsTypes, &(currentBindTypes), &(bindTypes) TSRMLS_CC);
} else {
ZEPHIR_CPY_WRT(mergedParamsTypes, bindTypes);
}
ZEPHIR_INIT_VAR(_4$$6);
ZVAL_STRING(_4$$6, "bindTypes", 1);
zephir_update_property_array(this_ptr, SL("_params"), _4$$6, mergedParamsTypes TSRMLS_CC);
}
RETURN_THIS();
}
示例2: PHP_METHOD
/**
* Set all the render params
*
*<code>
* $this->view->setVars(array('products' => $products));
*</code>
*/
PHP_METHOD(Phalcon_Mvc_View_Simple, setVars) {
zend_bool merge;
zval *params_param = NULL, *merge_param = NULL, *viewParams, *mergedParams = NULL;
zval *params = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, ¶ms_param, &merge_param);
params = params_param;
if (!merge_param) {
merge = 1;
} else {
merge = zephir_get_boolval(merge_param);
}
if (merge) {
ZEPHIR_OBS_VAR(viewParams);
zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC);
if (Z_TYPE_P(viewParams) == IS_ARRAY) {
ZEPHIR_INIT_VAR(mergedParams);
zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC);
} else {
ZEPHIR_CPY_WRT(mergedParams, params);
}
zephir_update_property_this(this_ptr, SL("_viewParams"), mergedParams TSRMLS_CC);
} else {
zephir_update_property_this(this_ptr, SL("_viewParams"), params TSRMLS_CC);
}
RETURN_THIS();
}
示例3: PHP_METHOD
/**
* Returns the pool configuration settings for a given namespace.
*
* @param string namespaceName [Optional]
*
* @return array
*/
PHP_METHOD(Xpl_Cache_Cache, getConfig) {
zend_bool _0;
zval *defaults;
zval *name_param = NULL, *_1, *_2, *_3;
zval *name = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &name_param);
zephir_get_strval(name, name_param);
ZEPHIR_INIT_VAR(defaults);
array_init(defaults);
_0 = ZEPHIR_IS_EMPTY(name);
if (!(_0)) {
_1 = zephir_fetch_nproperty_this(this_ptr, SL("config"), PH_NOISY_CC);
_0 = !(zephir_array_isset(_1, name));
}
if (_0) {
RETURN_CTOR(defaults);
}
_2 = zephir_fetch_nproperty_this(this_ptr, SL("config"), PH_NOISY_CC);
zephir_array_fetch(&_3, _2, name, PH_NOISY | PH_READONLY, "xpl/cache/cache.zep", 108 TSRMLS_CC);
zephir_fast_array_merge(return_value, &(defaults), &(_3) TSRMLS_CC);
RETURN_MM();
}
示例4: PHP_METHOD
/**
* Set all the render params
*
*<code>
* $this->view->setVars(
* [
* "products" => $products,
* ]
* );
*</code>
*/
PHP_METHOD(Phalcon_Mvc_View_Simple, setVars) {
zend_bool merge, _0;
zval *params_param = NULL, *merge_param = NULL, *_1, *_2$$3, *_3$$3;
zval *params = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, ¶ms_param, &merge_param);
params = params_param;
if (!merge_param) {
merge = 1;
} else {
merge = zephir_get_boolval(merge_param);
}
_0 = merge;
if (_0) {
ZEPHIR_OBS_VAR(_1);
zephir_read_property_this(&_1, this_ptr, SL("_viewParams"), PH_NOISY_CC);
_0 = Z_TYPE_P(_1) == IS_ARRAY;
}
if (_0) {
ZEPHIR_INIT_VAR(_2$$3);
_3$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_viewParams"), PH_NOISY_CC);
zephir_fast_array_merge(_2$$3, &(_3$$3), &(params) TSRMLS_CC);
zephir_update_property_this(getThis(), SL("_viewParams"), _2$$3 TSRMLS_CC);
} else {
zephir_update_property_this(getThis(), SL("_viewParams"), params TSRMLS_CC);
}
RETURN_THIS();
}
示例5: PHP_METHOD
/**
* 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;
int ZEPHIR_LAST_CALL_STATUS;
zval *group, *groupRoutes = NULL, *beforeMatch = NULL, *hostname = NULL, *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_CALL_METHOD(&groupRoutes, group, "getroutes", NULL);
zephir_check_call_status();
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_CALL_METHOD(&beforeMatch, group, "getbeforematch", NULL);
zephir_check_call_status();
if (Z_TYPE_P(beforeMatch) != IS_NULL) {
zephir_is_iterable(groupRoutes, &_1, &_0, 0, 0);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
) {
ZEPHIR_GET_HVALUE(route, _2);
ZEPHIR_CALL_METHOD(NULL, route, "beforematch", NULL, beforeMatch);
zephir_check_call_status();
}
}
ZEPHIR_CALL_METHOD(&hostname, group, "gethostname", NULL);
zephir_check_call_status();
if (Z_TYPE_P(hostname) != IS_NULL) {
zephir_is_iterable(groupRoutes, &_4, &_3, 0, 0);
for (
; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS
; zephir_hash_move_forward_ex(_4, &_3)
) {
ZEPHIR_GET_HVALUE(route, _5);
ZEPHIR_CALL_METHOD(NULL, route, "sethostname", NULL, hostname);
zephir_check_call_status();
}
}
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_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();
}
示例6: PHP_METHOD
/**
* Adds a group of validators
*
* @param \Phalcon\Validation\ValidatorInterface[]
* @return \Phalcon\Forms\ElementInterface
*/
PHP_METHOD(Phalcon_Forms_Element, addValidators) {
zend_bool merge;
zval *validators_param = NULL, *merge_param = NULL, *currentValidators = NULL, *mergedValidators = NULL;
zval *validators = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &validators_param, &merge_param);
validators = validators_param;
if (!merge_param) {
merge = 1;
} else {
merge = zephir_get_boolval(merge_param);
}
if (merge) {
ZEPHIR_OBS_VAR(currentValidators);
zephir_read_property_this(¤tValidators, this_ptr, SL("_validators"), PH_NOISY_CC);
if (Z_TYPE_P(currentValidators) == IS_ARRAY) {
ZEPHIR_INIT_VAR(mergedValidators);
zephir_fast_array_merge(mergedValidators, &(currentValidators), &(validators) TSRMLS_CC);
} else {
ZEPHIR_CPY_WRT(mergedValidators, validators);
}
zephir_update_property_this(this_ptr, SL("_validators"), mergedValidators TSRMLS_CC);
}
RETURN_THIS();
}
示例7: PHP_METHOD
PHP_METHOD(Test_Optimizers_ArrayMerge, mergeTwoRequiredArrays) {
zval *arr1_param = NULL, *arr2_param = NULL;
zval arr1, arr2;
zval this_zv;
zval *this_ptr = getThis();
if (EXPECTED(this_ptr)) {
ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
this_ptr = &this_zv;
} else this_ptr = NULL;
ZVAL_UNDEF(&arr1);
ZVAL_UNDEF(&arr2);
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &arr1_param, &arr2_param);
zephir_get_arrval(&arr1, arr1_param);
zephir_get_arrval(&arr2, arr2_param);
zephir_fast_array_merge(return_value, &arr1, &arr2 TSRMLS_CC);
RETURN_MM();
}
示例8: PHP_METHOD
/**
* @inheritdoc
*/
PHP_METHOD(Owl_Log_AbstractWriter, commit) {
int ZEPHIR_LAST_CALL_STATUS;
zval *records_param = NULL, *_0, *_1, *_2 = NULL, *_3, *_4;
zval *records = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &records_param);
zephir_get_arrval(records, records_param);
ZEPHIR_INIT_VAR(_0);
_1 = zephir_fetch_nproperty_this(this_ptr, SL("records"), PH_NOISY_CC);
ZEPHIR_CALL_METHOD(&_2, this_ptr, "filterrecords", NULL, 0, records);
zephir_check_call_status();
zephir_fast_array_merge(_0, &(_1), &(_2) TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("records"), _0 TSRMLS_CC);
_3 = zephir_fetch_nproperty_this(this_ptr, SL("records"), PH_NOISY_CC);
_4 = zephir_fetch_nproperty_this(this_ptr, SL("recordsInterval"), PH_NOISY_CC);
if (ZEPHIR_LE_LONG(_4, zephir_fast_count_int(_3 TSRMLS_CC))) {
ZEPHIR_CALL_METHOD(NULL, this_ptr, "push", NULL, 0);
zephir_check_call_status();
}
ZEPHIR_MM_RESTORE();
}
示例9: PHP_METHOD
/**
* Adds a route applying the common attributes
*/
PHP_METHOD(Phalcon_Mvc_Router_Group, _addRoute) {
int ZEPHIR_LAST_CALL_STATUS;
zephir_fcall_cache_entry *_0 = NULL;
zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *mergedPaths = NULL, *route, *defaultPaths, *processedPaths = NULL, *_1, *_2;
zval *pattern = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 2, &pattern_param, &paths, &httpMethods);
if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) {
zephir_get_strval(pattern, pattern_param);
} else {
ZEPHIR_INIT_VAR(pattern);
ZVAL_EMPTY_STRING(pattern);
}
if (!paths) {
paths = ZEPHIR_GLOBAL(global_null);
}
if (!httpMethods) {
httpMethods = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_OBS_VAR(defaultPaths);
zephir_read_property_this(&defaultPaths, this_ptr, SL("_paths"), PH_NOISY_CC);
if (Z_TYPE_P(defaultPaths) == IS_ARRAY) {
if (Z_TYPE_P(paths) == IS_STRING) {
ZEPHIR_CALL_CE_STATIC(&processedPaths, phalcon_mvc_router_route_ce, "getroutepaths", &_0, 77, paths);
zephir_check_call_status();
} else {
ZEPHIR_CPY_WRT(processedPaths, paths);
}
if (Z_TYPE_P(processedPaths) == IS_ARRAY) {
ZEPHIR_INIT_VAR(mergedPaths);
zephir_fast_array_merge(mergedPaths, &(defaultPaths), &(processedPaths) TSRMLS_CC);
} else {
ZEPHIR_CPY_WRT(mergedPaths, defaultPaths);
}
} else {
ZEPHIR_CPY_WRT(mergedPaths, paths);
}
ZEPHIR_INIT_VAR(route);
object_init_ex(route, phalcon_mvc_router_route_ce);
_1 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC);
ZEPHIR_INIT_VAR(_2);
ZEPHIR_CONCAT_VV(_2, _1, pattern);
ZEPHIR_CALL_METHOD(NULL, route, "__construct", NULL, 76, _2, mergedPaths, httpMethods);
zephir_check_call_status();
zephir_update_property_array_append(this_ptr, SL("_routes"), route TSRMLS_CC);
ZEPHIR_CALL_METHOD(NULL, route, "setgroup", NULL, 361, this_ptr);
zephir_check_call_status();
RETURN_CCTOR(route);
}
示例10: PHP_METHOD
/**
* Register classes and their locations
*/
PHP_METHOD(Phalcon_Loader, registerClasses) {
zend_bool merge;
zval *classes_param = NULL, *merge_param = NULL, *mergedClasses = NULL, *currentClasses;
zval *classes = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &classes_param, &merge_param);
classes = classes_param;
if (!merge_param) {
merge = 0;
} else {
merge = zephir_get_boolval(merge_param);
}
if (merge) {
ZEPHIR_OBS_VAR(currentClasses);
zephir_read_property_this(¤tClasses, this_ptr, SL("_classes"), PH_NOISY_CC);
if (Z_TYPE_P(currentClasses) == IS_ARRAY) {
ZEPHIR_INIT_VAR(mergedClasses);
zephir_fast_array_merge(mergedClasses, &(currentClasses), &(classes) TSRMLS_CC);
} else {
ZEPHIR_CPY_WRT(mergedClasses, classes);
}
zephir_update_property_this(this_ptr, SL("_classes"), mergedClasses TSRMLS_CC);
} else {
zephir_update_property_this(this_ptr, SL("_classes"), classes TSRMLS_CC);
}
RETURN_THIS();
}
示例11: PHP_METHOD
PHP_METHOD(OAuth2_ResponseType_AuthorizationCode, __construct) {
zval *config = NULL, *_1;
zval *storage, *config_param = NULL, *_0;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &storage, &config_param);
if (!config_param) {
ZEPHIR_INIT_VAR(config);
array_init(config);
} else {
zephir_get_arrval(config, config_param);
}
if (!(zephir_instance_of_ev(storage, oauth2_storage_authorizationcodeinterface_ce TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'storage' must be an instance of 'OAuth2\\Storage\\AuthorizationCodeInterface'", "", 0);
return;
}
zephir_update_property_this(this_ptr, SL("storage"), storage TSRMLS_CC);
ZEPHIR_INIT_VAR(_0);
ZEPHIR_INIT_VAR(_1);
array_init_size(_1, 3);
zephir_array_update_string(&_1, SL("enforce_redirect"), &ZEPHIR_GLOBAL(global_false), PH_COPY | PH_SEPARATE);
add_assoc_long_ex(_1, SS("auth_code_lifetime"), 30);
zephir_fast_array_merge(_0, &(_1), &(config) TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("config"), _0 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
}
示例12: PHP_METHOD
/**
* Adds a route to the router without any HTTP constraint
*
*<code>
* use Phalcon\Mvc\Router;
*
* $router->add('/about', 'About::index');
* $router->add('/about', 'About::index', ['GET', 'POST']);
* $router->add('/about', 'About::index', ['GET', 'POST'], Router::POSITION_FIRST);
*</code>
*/
PHP_METHOD(Phalcon_Mvc_Router, add) {
zval *_1$$4;
int ZEPHIR_LAST_CALL_STATUS;
zval *pattern_param = NULL, *paths = NULL, *httpMethods = NULL, *position = NULL, *route = NULL, *_0$$4, *_2$$4;
zval *pattern = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 3, &pattern_param, &paths, &httpMethods, &position);
if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) {
zephir_get_strval(pattern, pattern_param);
} else {
ZEPHIR_INIT_VAR(pattern);
ZVAL_EMPTY_STRING(pattern);
}
if (!paths) {
paths = ZEPHIR_GLOBAL(global_null);
}
if (!httpMethods) {
httpMethods = ZEPHIR_GLOBAL(global_null);
}
if (!position) {
ZEPHIR_INIT_VAR(position);
ZVAL_LONG(position, 1);
}
ZEPHIR_INIT_VAR(route);
object_init_ex(route, phalcon_mvc_router_route_ce);
ZEPHIR_CALL_METHOD(NULL, route, "__construct", NULL, 78, pattern, paths, httpMethods);
zephir_check_call_status();
do {
if (ZEPHIR_IS_LONG(position, 1)) {
zephir_update_property_array_append(this_ptr, SL("_routes"), route TSRMLS_CC);
break;
}
if (ZEPHIR_IS_LONG(position, 0)) {
ZEPHIR_INIT_VAR(_0$$4);
ZEPHIR_INIT_VAR(_1$$4);
zephir_create_array(_1$$4, 1, 0 TSRMLS_CC);
zephir_array_fast_append(_1$$4, route);
_2$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_routes"), PH_NOISY_CC);
zephir_fast_array_merge(_0$$4, &(_1$$4), &(_2$$4) TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_routes"), _0$$4 TSRMLS_CC);
break;
}
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_router_exception_ce, "Invalid route position", "phalcon/mvc/router.zep", 683);
return;
} while(0);
RETURN_CCTOR(route);
}
示例13: PHP_METHOD
/**
* Renders a partial view
*
* <code>
* //Show a partial inside another view
* $this->partial('shared/footer');
* </code>
*
* <code>
* //Show a partial inside another view with parameters
* $this->partial('shared/footer', array('content' => $html));
* </code>
*
* @param string partialPath
* @param array params
*/
PHP_METHOD(Phalcon_Mvc_View_Simple, partial) {
int ZEPHIR_LAST_CALL_STATUS;
zephir_nts_static zephir_fcall_cache_entry *_0 = NULL, *_2 = NULL, *_3 = NULL;
zval *partialPath_param = NULL, *params = NULL, *viewParams, *mergedParams = NULL, *_1, *_4;
zval *partialPath = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &partialPath_param, ¶ms);
if (unlikely(Z_TYPE_P(partialPath_param) != IS_STRING && Z_TYPE_P(partialPath_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'partialPath' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(partialPath_param) == IS_STRING)) {
zephir_get_strval(partialPath, partialPath_param);
} else {
ZEPHIR_INIT_VAR(partialPath);
ZVAL_EMPTY_STRING(partialPath);
}
if (!params) {
params = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_CALL_FUNCTION(NULL, "ob_start", &_0);
zephir_check_call_status();
if (Z_TYPE_P(params) == IS_ARRAY) {
ZEPHIR_OBS_VAR(viewParams);
zephir_read_property_this(&viewParams, this_ptr, SL("_viewParams"), PH_NOISY_CC);
if (Z_TYPE_P(viewParams) == IS_ARRAY) {
ZEPHIR_INIT_VAR(mergedParams);
zephir_fast_array_merge(mergedParams, &(viewParams), &(params) TSRMLS_CC);
} else {
ZEPHIR_CPY_WRT(mergedParams, params);
}
ZEPHIR_INIT_VAR(_1);
zephir_create_symbol_table(TSRMLS_C);
} else {
ZEPHIR_CPY_WRT(mergedParams, params);
}
ZEPHIR_CALL_METHOD(NULL, this_ptr, "_internalrender", &_2, partialPath, mergedParams);
zephir_check_call_status();
if (Z_TYPE_P(params) == IS_ARRAY) {
zephir_update_property_this(this_ptr, SL("_viewParams"), viewParams TSRMLS_CC);
}
ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", &_3);
zephir_check_call_status();
_4 = zephir_fetch_nproperty_this(this_ptr, SL("_content"), PH_NOISY_CC);
zend_print_zval(_4, 0);
ZEPHIR_MM_RESTORE();
}
示例14: PHP_METHOD
/**
* Adds default messages to validators
*/
PHP_METHOD(Phalcon_Validation, setDefaultMessages) {
zval *messages_param = NULL, *defaultMessages = NULL, *_0$$3;
zval *messages = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 0, 1, &messages_param);
if (!messages_param) {
ZEPHIR_INIT_VAR(messages);
array_init(messages);
} else {
zephir_get_arrval(messages, messages_param);
}
ZEPHIR_INIT_VAR(defaultMessages);
zephir_create_array(defaultMessages, 25, 0 TSRMLS_CC);
add_assoc_stringl_ex(defaultMessages, SS("Alnum"), SL("Field :field must contain only letters and numbers"), 1);
add_assoc_stringl_ex(defaultMessages, SS("Alpha"), SL("Field :field must contain only letters"), 1);
add_assoc_stringl_ex(defaultMessages, SS("Between"), SL("Field :field must be within the range of :min to :max"), 1);
add_assoc_stringl_ex(defaultMessages, SS("Confirmation"), SL("Field :field must be the same as :with"), 1);
add_assoc_stringl_ex(defaultMessages, SS("Digit"), SL("Field :field must be numeric"), 1);
add_assoc_stringl_ex(defaultMessages, SS("Email"), SL("Field :field must be an email address"), 1);
add_assoc_stringl_ex(defaultMessages, SS("ExclusionIn"), SL("Field :field must not be a part of list: :domain"), 1);
add_assoc_stringl_ex(defaultMessages, SS("FileEmpty"), SL("Field :field must not be empty"), 1);
add_assoc_stringl_ex(defaultMessages, SS("FileIniSize"), SL("File :field exceeds the maximum file size"), 1);
add_assoc_stringl_ex(defaultMessages, SS("FileMaxResolution"), SL("File :field must not exceed :max resolution"), 1);
add_assoc_stringl_ex(defaultMessages, SS("FileMinResolution"), SL("File :field must be at least :min resolution"), 1);
add_assoc_stringl_ex(defaultMessages, SS("FileSize"), SL("File :field exceeds the size of :max"), 1);
add_assoc_stringl_ex(defaultMessages, SS("FileType"), SL("File :field must be of type: :types"), 1);
add_assoc_stringl_ex(defaultMessages, SS("FileValid"), SL("Field :field is not valid"), 1);
add_assoc_stringl_ex(defaultMessages, SS("Identical"), SL("Field :field does not have the expected value"), 1);
add_assoc_stringl_ex(defaultMessages, SS("InclusionIn"), SL("Field :field must be a part of list: :domain"), 1);
add_assoc_stringl_ex(defaultMessages, SS("Numericality"), SL("Field :field does not have a valid numeric format"), 1);
add_assoc_stringl_ex(defaultMessages, SS("PresenceOf"), SL("Field :field is required"), 1);
add_assoc_stringl_ex(defaultMessages, SS("Regex"), SL("Field :field does not match the required format"), 1);
add_assoc_stringl_ex(defaultMessages, SS("TooLong"), SL("Field :field must not exceed :max characters long"), 1);
add_assoc_stringl_ex(defaultMessages, SS("TooShort"), SL("Field :field must be at least :min characters long"), 1);
add_assoc_stringl_ex(defaultMessages, SS("Uniqueness"), SL("Field :field must be unique"), 1);
add_assoc_stringl_ex(defaultMessages, SS("Url"), SL("Field :field must be a url"), 1);
add_assoc_stringl_ex(defaultMessages, SS("CreditCard"), SL("Field :field is not valid for a credit card number"), 1);
add_assoc_stringl_ex(defaultMessages, SS("Date"), SL("Field :field is not a valid date"), 1);
if (zephir_fast_count_int(messages TSRMLS_CC)) {
ZEPHIR_INIT_VAR(_0$$3);
zephir_fast_array_merge(_0$$3, &(defaultMessages), &(messages) TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_defaultMessages"), _0$$3 TSRMLS_CC);
RETURN_MM_MEMBER(this_ptr, "_defaultMessages");
}
zephir_update_property_this(this_ptr, SL("_defaultMessages"), defaultMessages TSRMLS_CC);
RETURN_CCTOR(defaultMessages);
}
示例15: PHP_METHOD
/**
* Reconfigure the route adding a new pattern and a set of paths
*/
PHP_METHOD(Phalcon_Mvc_Router_Route, reConfigure) {
int ZEPHIR_LAST_CALL_STATUS;
zval *pattern_param = NULL, *paths = NULL, *routePaths = NULL, *pcrePattern = NULL, *compiledPattern = NULL, *extracted = NULL, *_0, *_1;
zval *pattern = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &pattern_param, &paths);
if (unlikely(Z_TYPE_P(pattern_param) != IS_STRING && Z_TYPE_P(pattern_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'pattern' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(pattern_param) == IS_STRING)) {
zephir_get_strval(pattern, pattern_param);
} else {
ZEPHIR_INIT_VAR(pattern);
ZVAL_EMPTY_STRING(pattern);
}
if (!paths) {
paths = ZEPHIR_GLOBAL(global_null);
}
ZEPHIR_CALL_SELF(&routePaths, "getroutepaths", NULL, 0, paths);
zephir_check_call_status();
if (!(zephir_start_with_str(pattern, SL("#")))) {
if (zephir_memnstr_str(pattern, SL("{"), "phalcon/mvc/router/route.zep", 295)) {
ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, pattern);
zephir_check_call_status();
ZEPHIR_OBS_VAR(pcrePattern);
zephir_array_fetch_long(&pcrePattern, extracted, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 300 TSRMLS_CC);
ZEPHIR_INIT_VAR(_0);
zephir_array_fetch_long(&_1, extracted, 1, PH_NOISY | PH_READONLY, "phalcon/mvc/router/route.zep", 301 TSRMLS_CC);
zephir_fast_array_merge(_0, &(routePaths), &(_1) TSRMLS_CC);
ZEPHIR_CPY_WRT(routePaths, _0);
} else {
ZEPHIR_CPY_WRT(pcrePattern, pattern);
}
ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, 0, pcrePattern);
zephir_check_call_status();
} else {
ZEPHIR_CPY_WRT(compiledPattern, pattern);
}
zephir_update_property_this(this_ptr, SL("_pattern"), pattern TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_compiledPattern"), compiledPattern TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_paths"), routePaths TSRMLS_CC);
ZEPHIR_MM_RESTORE();
}