当前位置: 首页>>代码示例>>C++>>正文


C++ zephir_array_update_zval函数代码示例

本文整理汇总了C++中zephir_array_update_zval函数的典型用法代码示例。如果您正苦于以下问题:C++ zephir_array_update_zval函数的具体用法?C++ zephir_array_update_zval怎么用?C++ zephir_array_update_zval使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了zephir_array_update_zval函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PHP_METHOD

/**
 * Converts recursively the object to an array
 *
 *<code>
 *	print_r($config->toArray());
 *</code>
 */
PHP_METHOD(Phalcon_Config, toArray) {

	HashTable *_2;
	HashPosition _1;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *key = NULL, *value = NULL, *arrayConfig, *_0 = NULL, **_3, *_4 = NULL;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(arrayConfig);
	array_init(arrayConfig);
	ZEPHIR_CALL_FUNCTION(&_0, "get_object_vars", NULL, 23, this_ptr);
	zephir_check_call_status();
	zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/config.zep", 180);
	for (
	  ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
	  ; zephir_hash_move_forward_ex(_2, &_1)
	) {
		ZEPHIR_GET_HMKEY(key, _2, _1);
		ZEPHIR_GET_HVALUE(value, _3);
		if (Z_TYPE_P(value) == IS_OBJECT) {
			if ((zephir_method_exists_ex(value, SS("toarray") TSRMLS_CC) == SUCCESS)) {
				ZEPHIR_CALL_METHOD(&_4, value, "toarray", NULL, 0);
				zephir_check_call_status();
				zephir_array_update_zval(&arrayConfig, key, &_4, PH_COPY | PH_SEPARATE);
			} else {
				zephir_array_update_zval(&arrayConfig, key, &value, PH_COPY | PH_SEPARATE);
			}
		} else {
			zephir_array_update_zval(&arrayConfig, key, &value, PH_COPY | PH_SEPARATE);
		}
	}
	RETURN_CCTOR(arrayConfig);

}
开发者ID:spuy767,项目名称:cphalcon,代码行数:42,代码来源:config.zep.c

示例2: PHP_METHOD

/**
 * Sets a session variable in an application context
 *
 *<code>
 *	$session->set('auth', 'yes');
 *</code>
 */
PHP_METHOD(Phalcon_Session_Adapter, set) {

	int _2, _1$$3;
	zval *index_param = NULL, *value, *_SESSION, *uniqueId = NULL, *_0$$3;
	zval *index = NULL;

	ZEPHIR_MM_GROW();
	zephir_get_global(&_SESSION, SS("_SESSION") TSRMLS_CC);
	zephir_fetch_params(1, 2, 0, &index_param, &value);

	zephir_get_strval(index, index_param);


	uniqueId = zephir_fetch_nproperty_this(this_ptr, SL("_uniqueId"), PH_NOISY_CC);
	if (!(ZEPHIR_IS_EMPTY(uniqueId))) {
		ZEPHIR_INIT_VAR(_0$$3);
		ZEPHIR_CONCAT_VSV(_0$$3, uniqueId, "#", index);
		_1$$3 = zephir_maybe_separate_zval(&_SESSION);
		zephir_array_update_zval(&_SESSION, _0$$3, &value, PH_COPY | PH_SEPARATE);
		if (_1$$3) {
			ZEND_SET_SYMBOL(&EG(symbol_table), "_SESSION", _SESSION);
		}
		RETURN_MM_NULL();
	}
	_2 = zephir_maybe_separate_zval(&_SESSION);
	zephir_array_update_zval(&_SESSION, index, &value, PH_COPY | PH_SEPARATE);
	if (_2) {
		ZEND_SET_SYMBOL(&EG(symbol_table), "_SESSION", _SESSION);
	}
	ZEPHIR_MM_RESTORE();

}
开发者ID:AmazingDreams,项目名称:cphalcon,代码行数:39,代码来源:adapter.zep.c

示例3: PHP_METHOD

/**
 * Build multidimensional array from string
 *
 * <code>
 * $this->_parseIniString('path.hello.world', 'value for last key');
 *
 * // result
 * [
 *      'path' => [
 *          'hello' => [
 *              'world' => 'value for last key',
 *          ],
 *      ],
 * ];
 * </code>
 */
PHP_METHOD(Phalcon_Config_Adapter_Ini, _parseIniString) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *path_param = NULL, *value = NULL, *pos = NULL, *key = NULL, *_0 = NULL, _1, _2, _3, *_4;
	zval *path = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &path_param, &value);

	if (unlikely(Z_TYPE_P(path_param) != IS_STRING && Z_TYPE_P(path_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'path' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(path_param) == IS_STRING)) {
		zephir_get_strval(path, path_param);
	} else {
		ZEPHIR_INIT_VAR(path);
		ZVAL_EMPTY_STRING(path);
	}
	ZEPHIR_SEPARATE_PARAM(value);


	ZEPHIR_CALL_METHOD(&_0, this_ptr, "_cast", NULL, 135, value);
	zephir_check_call_status();
	ZEPHIR_CPY_WRT(value, _0);
	ZEPHIR_SINIT_VAR(_1);
	ZVAL_STRING(&_1, ".", 0);
	ZEPHIR_INIT_VAR(pos);
	zephir_fast_strpos(pos, path, &_1, 0 );
	if (ZEPHIR_IS_FALSE_IDENTICAL(pos)) {
		zephir_create_array(return_value, 1, 0 TSRMLS_CC);
		zephir_array_update_zval(&return_value, path, &value, PH_COPY);
		RETURN_MM();
	}
	ZEPHIR_SINIT_VAR(_2);
	ZVAL_LONG(&_2, 0);
	ZEPHIR_INIT_VAR(key);
	zephir_substr(key, path, 0 , zephir_get_intval(pos), 0);
	ZEPHIR_SINIT_VAR(_3);
	ZVAL_LONG(&_3, (zephir_get_numberval(pos) + 1));
	ZEPHIR_INIT_VAR(_4);
	zephir_substr(_4, path, zephir_get_intval(&_3), 0, ZEPHIR_SUBSTR_NO_LENGTH);
	zephir_get_strval(path, _4);
	zephir_create_array(return_value, 1, 0 TSRMLS_CC);
	ZEPHIR_CALL_METHOD(&_0, this_ptr, "_parseinistring", NULL, 136, path, value);
	zephir_check_call_status();
	zephir_array_update_zval(&return_value, key, &_0, PH_COPY);
	RETURN_MM();

}
开发者ID:AmazingDreams,项目名称:cphalcon,代码行数:66,代码来源:ini.zep.c

示例4: PHP_METHOD

PHP_METHOD(Cake_Core_Configure, write) {

	int ZEPHIR_LAST_CALL_STATUS, debug;
	zephir_fcall_cache_entry *_4 = NULL;
	HashTable *_1;
	HashPosition _0;
	zval *config = NULL, *value = NULL, *name = NULL, **_2, *_3 = NULL, *_5, *_6, *_7, _8, _9;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &config, &value);

	ZEPHIR_SEPARATE_PARAM(config);
	if (!value) {
		ZEPHIR_CPY_WRT(value, ZEPHIR_GLOBAL(global_null));
	} else {
		ZEPHIR_SEPARATE_PARAM(value);
	}


	if (!(Z_TYPE_P(config) == IS_ARRAY)) {
		ZEPHIR_INIT_NVAR(config);
		zephir_create_array(config, 1, 0 TSRMLS_CC);
		zephir_array_update_zval(&config, config, &value, PH_COPY);
	}
	zephir_is_iterable(config, &_1, &_0, 0, 0, "cake/Core/Configure.zep", 28);
	for (
	  ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
	  ; zephir_hash_move_forward_ex(_1, &_0)
	) {
		ZEPHIR_GET_HMKEY(name, _1, _0);
		ZEPHIR_GET_HVALUE(value, _2);
		_5 = zephir_fetch_static_property_ce(cake_core_configure_ce, SL("_values") TSRMLS_CC);
		ZEPHIR_CALL_CE_STATIC(&_3, cake_utility_hash_ce, "insert", &_4, 0, _5, name, value);
		zephir_check_call_status();
		zephir_update_static_property_ce(cake_core_configure_ce, SL("_values"), &_3 TSRMLS_CC);
	}
	if (zephir_array_isset_string(config, SS("debug"))) {
		_5 = zephir_fetch_static_property_ce(cake_core_configure_ce, SL("_hasIniSet") TSRMLS_CC);
		if (Z_TYPE_P(_5) == IS_NULL) {
			zephir_update_static_property_ce(cake_core_configure_ce, SL("_hasIniSet"), ((zephir_function_exists_ex(SS("ini_set") TSRMLS_CC) == SUCCESS)) ? &(ZEPHIR_GLOBAL(global_true)) : &(ZEPHIR_GLOBAL(global_false)) TSRMLS_CC);
		}
		_6 = zephir_fetch_static_property_ce(cake_core_configure_ce, SL("_hasIniSet") TSRMLS_CC);
		if (zephir_is_true(_6)) {
			zephir_array_fetch_string(&_7, config, SL("debug"), PH_NOISY | PH_READONLY, "cake/Core/Configure.zep", 36 TSRMLS_CC);
			if (zephir_is_true(_7)) {
				debug = 1;
			} else {
				debug = 0;
			}
			ZEPHIR_SINIT_VAR(_8);
			ZVAL_STRING(&_8, "display_errors", 0);
			ZEPHIR_SINIT_VAR(_9);
			ZVAL_LONG(&_9, debug);
			ZEPHIR_CALL_FUNCTION(NULL, "ini_set", NULL, 4, &_8, &_9);
			zephir_check_call_status();
		}
	}
	RETURN_MM_BOOL(1);

}
开发者ID:ivyhjk,项目名称:zephir-cake,代码行数:60,代码来源:configure.zep.c

示例5: PHP_METHOD

/**
 * Adds a message to the session flasher
 */
PHP_METHOD(Phalcon_Flash_Session, message) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *type_param = NULL, *message_param = NULL, *messages = NULL, *_0, *_1$$4;
	zval *type = NULL, *message = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &type_param, &message_param);

	zephir_get_strval(type, type_param);
	zephir_get_strval(message, message_param);


	ZEPHIR_INIT_VAR(_0);
	ZVAL_BOOL(_0, 0);
	ZEPHIR_CALL_METHOD(&messages, this_ptr, "_getsessionmessages", NULL, 0, _0);
	zephir_check_call_status();
	if (Z_TYPE_P(messages) != IS_ARRAY) {
		ZEPHIR_INIT_NVAR(messages);
		array_init(messages);
	}
	if (!(zephir_array_isset(messages, type))) {
		ZEPHIR_INIT_VAR(_1$$4);
		array_init(_1$$4);
		zephir_array_update_zval(&messages, type, &_1$$4, PH_COPY | PH_SEPARATE);
	}
	zephir_array_update_multi(&messages, &message TSRMLS_CC, SL("za"), 2, type);
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "_setsessionmessages", NULL, 0, messages);
	zephir_check_call_status();
	ZEPHIR_MM_RESTORE();

}
开发者ID:AlexKomrakov,项目名称:cphalcon,代码行数:35,代码来源:session.zep.c

示例6: PHP_METHOD

/**
 * Returns the paths using positions as keys and names as values
 *
 * @return array
 */
PHP_METHOD(Test_Router_Route, getReversedPaths) {

	zend_string *_3;
	zend_ulong _2;
	zval reversed, path, position, _0, *_1;
	ZEPHIR_INIT_THIS();

	ZVAL_UNDEF(&reversed);
	ZVAL_UNDEF(&path);
	ZVAL_UNDEF(&position);
	ZVAL_UNDEF(&_0);

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(&reversed);
	array_init(&reversed);
	zephir_read_property(&_0, this_ptr, SL("_paths"), PH_NOISY_CC | PH_READONLY);
	zephir_is_iterable(&_0, 0, "test/router/route.zep", 478);
	ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(&_0), _2, _3, _1)
	{
		ZEPHIR_INIT_NVAR(&path);
		if (_3 != NULL) { 
			ZVAL_STR_COPY(&path, _3);
		} else {
			ZVAL_LONG(&path, _2);
		}
		ZEPHIR_INIT_NVAR(&position);
		ZVAL_COPY(&position, _1);
		zephir_array_update_zval(&reversed, &position, &path, PH_COPY | PH_SEPARATE);
	} ZEND_HASH_FOREACH_END();
开发者ID:crocodile2u,项目名称:zephir,代码行数:35,代码来源:route.zep.c

示例7: PHP_METHOD

/**
 * Allow setting of a session variable.
 * Throw an exception if the name is not string.
 *
 * @param  string $name
 * @param  mixed  $value
 * @throws Yaf_Exception
 * @return void
 */
PHP_METHOD(Yaf_Session, __set) {

    int _0;
    zval *name_param = NULL, *value, *_SESSION;
    zval *name = NULL;

    ZEPHIR_MM_GROW();
    zephir_fetch_params(1, 2, 0, &name_param, &value);

    zephir_get_strval(name, name_param);


    if (Z_TYPE_P(name) == IS_STRING) {
        zephir_update_property_array(this_ptr, SL("session"), name, value TSRMLS_CC);
        zephir_get_global(&_SESSION, SS("_SESSION") TSRMLS_CC);
        _0 = zephir_maybe_separate_zval(&_SESSION);
        zephir_array_update_zval(&_SESSION, name, &value, PH_COPY | PH_SEPARATE);
        if (_0) {
            ZEND_SET_SYMBOL(&EG(symbol_table), "_SESSION", _SESSION);
        }
    } else {
        ZEPHIR_THROW_EXCEPTION_DEBUG_STR(yaf_exception_ce, "Expect a string key name", "yaf/session.zep", 219);
        return;
    }
    ZEPHIR_MM_RESTORE();

}
开发者ID:swordkee,项目名称:yaftoz,代码行数:36,代码来源:session.zep.c

示例8: PHP_METHOD

PHP_METHOD(Test_Flow, testFor17) {

	zend_bool _1;
	int _0, _2, _3;
	zval *a = NULL, *b = NULL, *c;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(c);
	array_init(c);
	_3 = 10;
	_2 = _3;
	_0 = 0;
	_1 = 0;
	if ((_2 >= 1)) {
		while (1) {
			if (_1) {
				_0++;
				_2--;
				if (!((_2 >= 1))) {
					break;
				}
			} else {
				_1 = 1;
			}
			ZEPHIR_INIT_NVAR(a);
			ZVAL_LONG(a, _0);
			ZEPHIR_INIT_NVAR(b);
			ZVAL_LONG(b, _2);
			zephir_array_update_zval(&c, a, &b, PH_COPY | PH_SEPARATE);
		}
	}
	RETURN_CCTOR(c);

}
开发者ID:azrulharis,项目名称:zephir,代码行数:35,代码来源:flow.c

示例9: zephir_array_update_zval_string

/**
 * @brief Updates value in @a arr at position @a index with boolean @a value
 * @param[in,out] arr Array
 * @param index Index
 * @param value Value
 * @param value_length Length of value (usually <tt>strlen(value)</tt>)
 * @param flags Flags
 * @return Whether the operation succeeded
 * @retval @c FAILURE Failure, @a arr is not an array or @a index is of not supported type
 * @retval @c SUCCESS Success
 * @throw @c E_WARNING if @a arr is not an array
 * @see zephir_array_update_zval()
 *
 * Equivalent to <tt>$arr[$index] = $value</tt> in PHP, where @c $value is a string.
 * Flags may be a bitwise OR of the following values:
 * @arg @c PH_CTOR: create a copy of @a value and work with that copy
 * @arg @c PH_SEPARATE: separate @a arr if its reference count is greater than 1; @c *arr will contain the separated version
 * @arg @c PH_COPY: increment the reference count on the internally constructed value
 *
 * Only @c PH_SEPARATE is meaningful with this function
 */
int zephir_array_update_zval_string(zval **arr, zval *index, char *value, uint value_length, int flags) {

    zval *zvalue;

    ALLOC_INIT_ZVAL(zvalue);
    ZVAL_STRINGL(zvalue, value, value_length, 1);

    return zephir_array_update_zval(arr, index, &zvalue, flags);
}
开发者ID:golovanov,项目名称:php-ext-zendxml,代码行数:30,代码来源:array.c

示例10: zephir_array_update_zval_bool

/**
 * @brief Updates value in @a arr at position @a index with boolean @a value
 * @param[in,out] arr Array
 * @param index Index
 * @param value Value
 * @param flags Flags
 * @return Whether the operation succeeded
 * @retval @c FAILURE Failure, @a arr is not an array or @a index is of not supported type
 * @retval @c SUCCESS Success
 * @throw @c E_WARNING if @a arr is not an array
 * @see zephir_array_update_zval()
 *
 * Equivalent to <tt>$arr[$index] = $value</tt> in PHP, where @c $value is a boolean.
 * Flags may be a bitwise OR of the following values:
 * @arg @c PH_CTOR: create a copy of @a value and work with that copy
 * @arg @c PH_SEPARATE: separate @a arr if its reference count is greater than 1; @c *arr will contain the separated version
 * @arg @c PH_COPY: increment the reference count on the internally constructed value
 *
 * Only @c PH_SEPARATE is meaningful with this function
 */
int zephir_array_update_zval_bool(zval **arr, zval *index, int value, int flags) {

    zval *zvalue;

    ALLOC_INIT_ZVAL(zvalue);
    ZVAL_BOOL(zvalue, value);

    return zephir_array_update_zval(arr, index, &zvalue, flags);
}
开发者ID:golovanov,项目名称:php-ext-zendxml,代码行数:29,代码来源:array.c

示例11: zephir_array_update_zval_long

/**
 * @brief Updates value in @a arr at position @a index with long integer @a value
 * @param[in,out] arr Array
 * @param index Index
 * @param value Value
 * @param flags Flags
 * @return Whether the operation succeeded
 * @retval @c FAILURE Failure, @a arr is not an array or @a index is of not supported type
 * @retval @c SUCCESS Success
 * @throw @c E_WARNING if @a arr is not an array
 * @see zephir_array_update_zval()
 *
 * Equivalent to <tt>$arr[$index] = $value</tt> in PHP, where @c $value is an integer.
 * Flags may be a bitwise OR of the following values:
 * @arg @c PH_CTOR: create a copy of @a value and work with that copy
 * @arg @c PH_SEPARATE: separate @a arr if its reference count is greater than 1; @c *arr will contain the separated version
 * @arg @c PH_COPY: increment the reference count on the internally constructed value
 *
 * Only @c PH_SEPARATE is meaningful with this function.
 */
int zephir_array_update_zval_long(zval **arr, zval *index, long value, int flags) {

    zval *zvalue;

    ALLOC_INIT_ZVAL(zvalue);
    ZVAL_LONG(zvalue, value);

    return zephir_array_update_zval(arr, index, &zvalue, flags);
}
开发者ID:golovanov,项目名称:php-ext-zendxml,代码行数:29,代码来源:array.c

示例12: PHP_METHOD

/**
 * Appends a NOT BETWEEN condition to the current conditions
 *
 *<code>
 *	$criteria->notBetweenWhere('price', 100.25, 200.50);
 *</code>
 */
PHP_METHOD(Phalcon_Mvc_Model_Criteria, notBetweenWhere) {

	zval *_1;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *expr_param = NULL, *minimum, *maximum, *hiddenParam = NULL, *nextHiddenParam = NULL, *minimumKey = NULL, *maximumKey = NULL, *_0;
	zval *expr = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 3, 0, &expr_param, &minimum, &maximum);

	if (unlikely(Z_TYPE_P(expr_param) != IS_STRING && Z_TYPE_P(expr_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'expr' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(expr_param) == IS_STRING)) {
		zephir_get_strval(expr, expr_param);
	} else {
		ZEPHIR_INIT_VAR(expr);
		ZVAL_EMPTY_STRING(expr);
	}


	ZEPHIR_OBS_VAR(hiddenParam);
	zephir_read_property_this(&hiddenParam, this_ptr, SL("_hiddenParamNumber"), PH_NOISY_CC);
	ZEPHIR_INIT_VAR(nextHiddenParam);
	ZVAL_LONG(nextHiddenParam, (zephir_get_numberval(hiddenParam) + 1));
	ZEPHIR_INIT_VAR(minimumKey);
	ZEPHIR_CONCAT_SV(minimumKey, "ACP", hiddenParam);
	ZEPHIR_INIT_VAR(maximumKey);
	ZEPHIR_CONCAT_SV(maximumKey, "ACP", nextHiddenParam);
	ZEPHIR_INIT_VAR(_0);
	ZEPHIR_CONCAT_VSVSVS(_0, expr, " NOT BETWEEN :", minimumKey, ": AND :", maximumKey, ":");
	ZEPHIR_INIT_VAR(_1);
	zephir_create_array(_1, 2, 0 TSRMLS_CC);
	zephir_array_update_zval(&_1, minimumKey, &minimum, PH_COPY);
	zephir_array_update_zval(&_1, maximumKey, &maximum, PH_COPY);
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "andwhere", NULL, 0, _0, _1);
	zephir_check_call_status();
	ZEPHIR_SEPARATE(nextHiddenParam);
	zephir_increment(nextHiddenParam);
	zephir_update_property_this(this_ptr, SL("_hiddenParamNumber"), nextHiddenParam TSRMLS_CC);
	RETURN_THIS();

}
开发者ID:8V017UW2RQ70,项目名称:cphalcon,代码行数:51,代码来源:criteria.zep.c

示例13: PHP_METHOD

PHP_METHOD(Yb_Std, uniqueValues) {

	HashTable *_1;
	HashPosition _0;
	zephir_fcall_cache_entry *_5 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *uniqueKey = NULL;
	zval *data_param = NULL, *uniqueKey_param = NULL, *k = NULL, *v = NULL, *arr = NULL, *uniqueValue = NULL, **_2, *_3$$4 = NULL, *_4$$4 = NULL, *_6$$5 = NULL, *_7$$5 = NULL;
	zval *data = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &data_param, &uniqueKey_param);

	zephir_get_arrval(data, data_param);
	zephir_get_strval(uniqueKey, uniqueKey_param);


	ZEPHIR_INIT_VAR(arr);
	array_init(arr);
	zephir_is_iterable(data, &_1, &_0, 0, 0, "yb/std.zep", 377);
	for (
	  ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
	  ; zephir_hash_move_forward_ex(_1, &_0)
	) {
		ZEPHIR_GET_HMKEY(k, _1, _0);
		ZEPHIR_GET_HVALUE(v, _2);
		if (unlikely(Z_TYPE_P(v) != IS_ARRAY)) {
			ZEPHIR_INIT_NVAR(_3$$4);
			object_init_ex(_3$$4, yb_exception_ce);
			ZEPHIR_INIT_LNVAR(_4$$4);
			ZEPHIR_CONCAT_SV(_4$$4, "Invalid item type, array required at: ", k);
			ZEPHIR_CALL_METHOD(NULL, _3$$4, "__construct", &_5, 2, _4$$4);
			zephir_check_call_status();
			zephir_throw_exception_debug(_3$$4, "yb/std.zep", 368 TSRMLS_CC);
			ZEPHIR_MM_RESTORE();
			return;
		}
		ZEPHIR_OBS_NVAR(uniqueValue);
		if (unlikely(!(zephir_array_isset_fetch(&uniqueValue, v, uniqueKey, 0 TSRMLS_CC)))) {
			ZEPHIR_INIT_NVAR(_6$$5);
			object_init_ex(_6$$5, yb_exception_ce);
			ZEPHIR_INIT_LNVAR(_7$$5);
			ZEPHIR_CONCAT_SV(_7$$5, "Cannot find value of unique at: ", k);
			ZEPHIR_CALL_METHOD(NULL, _6$$5, "__construct", &_5, 2, _7$$5);
			zephir_check_call_status();
			zephir_throw_exception_debug(_6$$5, "yb/std.zep", 371 TSRMLS_CC);
			ZEPHIR_MM_RESTORE();
			return;
		}
		zephir_array_update_zval(&arr, uniqueValue, &ZEPHIR_GLOBAL(global_null), PH_COPY | PH_SEPARATE);
	}
	zephir_array_keys(return_value, arr TSRMLS_CC);
	RETURN_MM();

}
开发者ID:VergilTang,项目名称:yb,代码行数:55,代码来源:std.zep.c

示例14: PHP_METHOD

/**
 * Sets a single attribute.
 *
 * @param string name
 * @param mixed value
 * @param boolean overwrite [Optional] Default = true
 * @return \Xpl\HtmlElement
 */
PHP_METHOD(Xpl_HtmlElement, setAttribute) {

	zend_bool overwrite, _0;
	zval *name_param = NULL, *value, *overwrite_param = NULL, *attrs = NULL, *arrVal = NULL, *_1$$6, *_2$$6;
	zval *name = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 1, &name_param, &value, &overwrite_param);

	zephir_get_strval(name, name_param);
	if (!overwrite_param) {
		overwrite = 1;
	} else {
		overwrite = zephir_get_boolval(overwrite_param);
	}


	ZEPHIR_OBS_VAR(attrs);
	zephir_read_property_this(&attrs, this_ptr, SL("_attributes"), PH_NOISY_CC);
	if (Z_TYPE_P(value) == IS_ARRAY) {
		ZEPHIR_CPY_WRT(arrVal, value);
	} else {
		ZEPHIR_INIT_NVAR(arrVal);
		zephir_create_array(arrVal, 1, 0 TSRMLS_CC);
		zephir_array_fast_append(arrVal, value);
	}
	_0 = !(zephir_array_isset(attrs, name));
	if (!(_0)) {
		_0 = overwrite;
	}
	if (_0) {
		zephir_array_update_zval(&attrs, name, &arrVal, PH_COPY | PH_SEPARATE);
	} else {
		ZEPHIR_INIT_VAR(_1$$6);
		zephir_array_fetch(&_2$$6, attrs, name, PH_NOISY | PH_READONLY, "xpl/htmlelement.zep", 84 TSRMLS_CC);
		zephir_fast_array_merge(_1$$6, &(_2$$6), &(arrVal) TSRMLS_CC);
		zephir_array_update_zval(&attrs, name, &_1$$6, PH_COPY | PH_SEPARATE);
	}
	zephir_update_property_this(this_ptr, SL("_attributes"), attrs TSRMLS_CC);
	RETURN_THIS();

}
开发者ID:wells5609,项目名称:xpl,代码行数:50,代码来源:htmlelement.zep.c

示例15: PHP_METHOD

/**
 * {@inheritDoc}
 */
PHP_METHOD(Lynx_Stdlib_Hydrator_ClassMethods, extract) {

	HashTable *_2;
	HashPosition _1;
	int ZEPHIR_LAST_CALL_STATUS;
	zephir_nts_static zephir_fcall_cache_entry *_0 = NULL, *_6 = NULL, *_9 = NULL, *_11 = NULL;
	zval *currentObject, *methods = NULL, *method = NULL, *attribute = NULL, *attributes, **_3, *_4 = NULL, *_5 = NULL, _7 = zval_used_for_init, *_8 = NULL, *_10 = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &currentObject);

	if (unlikely(Z_TYPE_P(currentObject) != IS_OBJECT)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'currentObject' must be an object") TSRMLS_CC);
		RETURN_MM_NULL();
	}



	ZEPHIR_CALL_FUNCTION(&methods, "get_class_methods", &_0, currentObject);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(attributes);
	array_init(attributes);
	zephir_is_iterable(methods, &_2, &_1, 0, 0, "lynx/Stdlib/Hydrator/ClassMethods.zep", 48);
	for (
	  ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
	  ; zephir_hash_move_forward_ex(_2, &_1)
	) {
		ZEPHIR_GET_HVALUE(method, _3);
		ZEPHIR_INIT_NVAR(_4);
		ZVAL_STRING(_4, "/^get/", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_FUNCTION(&_5, "preg_match", &_6, _4, method);
		zephir_check_temp_parameter(_4);
		zephir_check_call_status();
		if (zephir_is_true(_5)) {
			ZEPHIR_SINIT_NVAR(_7);
			ZVAL_LONG(&_7, 3);
			ZEPHIR_INIT_NVAR(attribute);
			zephir_substr(attribute, method, 3 , 0, ZEPHIR_SUBSTR_NO_LENGTH);
			ZEPHIR_CALL_FUNCTION(&_8, "property_exists", &_9, currentObject, attribute);
			zephir_check_call_status();
			if (!zephir_is_true(_8)) {
				ZEPHIR_CALL_FUNCTION(&_10, "lcfirst", &_11, attribute);
				zephir_check_call_status();
				ZEPHIR_CPY_WRT(attribute, _10);
				ZEPHIR_CALL_METHOD(&_10, currentObject, "attributes", NULL);
				zephir_check_call_status();
				zephir_array_update_zval(&attributes, attribute, &_10, PH_COPY | PH_SEPARATE);
			}
		}
	}
	RETURN_CCTOR(attributes);

}
开发者ID:Green-Cat,项目名称:lynx,代码行数:56,代码来源:classmethods.zep.c


注:本文中的zephir_array_update_zval函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。