示例#1
0
PHP_METHOD(Test_BuiltIn_StringMethods, getUpper) {

	zval *str_param = NULL, _0;
	zval str;
		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(&str);
	ZVAL_UNDEF(&_0);

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

	zephir_get_strval(&str, str_param);


	ZEPHIR_INIT_VAR(&_0);
	zephir_fast_strtoupper(&_0, &str);
	RETURN_CCTOR(_0);

}
示例#2
0
文件: std.zep.c 项目: VergilTang/yb
PHP_METHOD(Yb_Std, sizeToBytes) {

	unsigned char _6$$3;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *size_param = NULL, *match = NULL, *_0, *_1 = NULL, *_2, _3, *_4$$3, *_7$$4, *_8$$5, *_9$$6, *_10$$7;
	zval *size = NULL, *unit = NULL, *_5$$3 = NULL;

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

	zephir_get_strval(size, size_param);


	ZEPHIR_INIT_VAR(match);
	ZVAL_NULL(match);
	ZEPHIR_INIT_VAR(_0);
	ZEPHIR_INIT_VAR(_2);
	zephir_fast_strtoupper(_2, size);
	ZEPHIR_SINIT_VAR(_3);
	ZVAL_STRING(&_3, "/^([\\d\\.]+)([KMGT])B?$/", 0);
	zephir_preg_match(_0, &_3, _2, match, 0, 0 , 0  TSRMLS_CC);
	if (zephir_is_true(_0)) {
		ZEPHIR_OBS_VAR(_4$$3);
		zephir_array_fetch_long(&_4$$3, match, 2, PH_NOISY, "yb/std.zep", 17 TSRMLS_CC);
		zephir_get_strval(_5$$3, _4$$3);
		ZEPHIR_CPY_WRT(unit, _5$$3);
		_6$$3 = ZEPHIR_STRING_OFFSET(unit, 0);
		do {
			if (_6$$3 == 'T') {
				ZEPHIR_OBS_VAR(_7$$4);
				zephir_array_fetch_long(&_7$$4, match, 1, PH_NOISY, "yb/std.zep", 20 TSRMLS_CC);
				RETURN_MM_DOUBLE((1099511627776.0 * zephir_get_doubleval(_7$$4)));
			}
			if (_6$$3 == 'G') {
				ZEPHIR_OBS_VAR(_8$$5);
				zephir_array_fetch_long(&_8$$5, match, 1, PH_NOISY, "yb/std.zep", 22 TSRMLS_CC);
				RETURN_MM_DOUBLE((1073741824.0 * zephir_get_doubleval(_8$$5)));
			}
			if (_6$$3 == 'M') {
				ZEPHIR_OBS_VAR(_9$$6);
				zephir_array_fetch_long(&_9$$6, match, 1, PH_NOISY, "yb/std.zep", 24 TSRMLS_CC);
				RETURN_MM_DOUBLE((1048576.0 * zephir_get_doubleval(_9$$6)));
			}
			if (_6$$3 == 'K') {
				ZEPHIR_OBS_VAR(_10$$7);
				zephir_array_fetch_long(&_10$$7, match, 1, PH_NOISY, "yb/std.zep", 26 TSRMLS_CC);
				RETURN_MM_DOUBLE((1024.0 * zephir_get_doubleval(_10$$7)));
			}
		} while(0);

	}
	ZEPHIR_RETURN_CALL_FUNCTION("floatval", NULL, 75, size);
	zephir_check_call_status();
	RETURN_MM();

}
示例#3
0
PHP_METHOD(Test_BuiltIn_StringMethods, getUpper) {

	zval *str_param = NULL, *_0;
	zval *str = NULL;

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

	zephir_get_strval(str, str_param);


	ZEPHIR_INIT_VAR(_0);
	zephir_fast_strtoupper(_0, str);
	RETURN_CCTOR(_0);

}
示例#4
0
/**
 * Uppercases a string, this function makes use of the mbstring extension if available
 *
 * <code>
 *    echo Phalcon\Text::upper("hello"); // HELLO
 * </code>
 */
PHP_METHOD(Phalcon_Text, upper) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *str_param = NULL, *encoding_param = NULL;
	zval *str = NULL, *encoding = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &str_param, &encoding_param);

	if (unlikely(Z_TYPE_P(str_param) != IS_STRING && Z_TYPE_P(str_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'str' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}

	if (likely(Z_TYPE_P(str_param) == IS_STRING)) {
		zephir_get_strval(str, str_param);
	} else {
		ZEPHIR_INIT_VAR(str);
		ZVAL_EMPTY_STRING(str);
	}
	if (!encoding_param) {
		ZEPHIR_INIT_VAR(encoding);
		ZVAL_STRING(encoding, "UTF-8", 1);
	} else {
	if (unlikely(Z_TYPE_P(encoding_param) != IS_STRING && Z_TYPE_P(encoding_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'encoding' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}

	if (likely(Z_TYPE_P(encoding_param) == IS_STRING)) {
		zephir_get_strval(encoding, encoding_param);
	} else {
		ZEPHIR_INIT_VAR(encoding);
		ZVAL_EMPTY_STRING(encoding);
	}
	}


	if ((zephir_function_exists_ex(SS("mb_strtoupper") TSRMLS_CC) == SUCCESS)) {
		ZEPHIR_RETURN_CALL_FUNCTION("mb_strtoupper", NULL, 194, str, encoding);
		zephir_check_call_status();
		RETURN_MM();
	}
	zephir_fast_strtoupper(return_value, str);
	RETURN_MM();

}
示例#5
0
/**
 * @var mixed input The text to sanitize
 */
PHP_METHOD(Phalcon_Filter_Sanitize_Upper, __invoke) {

	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval *input_param = NULL, _0$$3, _1$$3, _2;
	zval input;
	zval *this_ptr = getThis();

	ZVAL_UNDEF(&input);
	ZVAL_UNDEF(&_0$$3);
	ZVAL_UNDEF(&_1$$3);
	ZVAL_UNDEF(&_2);

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

	if (UNEXPECTED(Z_TYPE_P(input_param) != IS_STRING && Z_TYPE_P(input_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'input' must be of the type string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (EXPECTED(Z_TYPE_P(input_param) == IS_STRING)) {
		zephir_get_strval(&input, input_param);
	} else {
		ZEPHIR_INIT_VAR(&input);
		ZVAL_EMPTY_STRING(&input);
	}


	if (1 == (zephir_function_exists_ex(SL("mb_convert_case") TSRMLS_CC) == SUCCESS)) {
		ZVAL_LONG(&_0$$3, 0);
		ZEPHIR_INIT_VAR(&_1$$3);
		ZVAL_STRING(&_1$$3, "UTF-8");
		ZEPHIR_RETURN_CALL_FUNCTION("mb_convert_case", NULL, 190, &input, &_0$$3, &_1$$3);
		zephir_check_call_status();
		RETURN_MM();
	}
	ZEPHIR_CALL_FUNCTION(&_2, "utf8_decode", NULL, 191, &input);
	zephir_check_call_status();
	zephir_fast_strtoupper(return_value, &_2);
	RETURN_MM();

}
示例#6
0
/**
 * Hash
 *
 * @param string data 
 * @return string
 */
PHP_METHOD(OAuth_V1_Signature, hash) {

	zval *data_param = NULL, *algorithm = NULL, *hash, *signingKey, *_0, _1, *_2;
	zval *data = NULL;

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

		zephir_get_strval(data, data_param);


	ZEPHIR_INIT_VAR(algorithm);
	zephir_call_method(algorithm, this_ptr, "gethashingalgorithm");
	ZEPHIR_INIT_VAR(_0);
	zephir_fast_strtoupper(_0, algorithm);
	ZEPHIR_CPY_WRT(algorithm, _0);
	do {
		if (ZEPHIR_IS_STRING(algorithm, "HMAC-SHA1")) {
			ZEPHIR_INIT_VAR(signingKey);
			zephir_call_method(signingKey, this_ptr, "getsigningkey");
			ZEPHIR_SINIT_VAR(_1);
			ZVAL_STRING(&_1, "sha1", 0);
			ZEPHIR_INIT_VAR(hash);
			zephir_call_func_p4(hash, "hash_hmac", &_1, data, signingKey, ZEPHIR_GLOBAL(global_true));
			break;
		}
		ZEPHIR_INIT_BNVAR(_0);
		object_init_ex(_0, oauth_v1_unsupportedhashalgorithmexception_ce);
		ZEPHIR_INIT_VAR(_2);
		ZEPHIR_CONCAT_SVS(_2, "Unsupported hashing algorithm (", algorithm, ") used.");
		zephir_call_method_p2_noret(_0, "__construct", algorithm, _2);
		zephir_throw_exception(_0 TSRMLS_CC);
		ZEPHIR_MM_RESTORE();
		return;
	} while(0);

	RETURN_CCTOR(hash);

}
示例#7
0
/**
 * Internal sanitize wrapper to filter_var
 */
PHP_METHOD(Phalcon_Filter, _sanitize) {

	zephir_fcall_cache_entry *_8 = NULL;
	zephir_nts_static zephir_fcall_cache_entry *_7 = NULL, *_9 = NULL, *_11 = NULL, *_12 = NULL, *_14 = NULL;
	zval *_1 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *filter = NULL, *_13;
	zval *value, *filter_param = NULL, *filterObject, *_0, *_2 = NULL, _3 = zval_used_for_init, _4, _5, *_6 = NULL, *_10;

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

	if (unlikely(Z_TYPE_P(filter_param) != IS_STRING && Z_TYPE_P(filter_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'filter' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}

	if (likely(Z_TYPE_P(filter_param) == IS_STRING)) {
		zephir_get_strval(filter, filter_param);
	} else {
		ZEPHIR_INIT_VAR(filter);
		ZVAL_EMPTY_STRING(filter);
	}


	ZEPHIR_OBS_VAR(filterObject);
	_0 = zephir_fetch_nproperty_this(this_ptr, SL("_filters"), PH_NOISY_CC);
	if (zephir_array_isset_fetch(&filterObject, _0, filter, 0 TSRMLS_CC)) {
		if (zephir_instance_of_ev(filterObject, zend_ce_closure TSRMLS_CC)) {
			ZEPHIR_INIT_VAR(_1);
			zephir_create_array(_1, 1, 0 TSRMLS_CC);
			zephir_array_fast_append(_1, value);
			ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, filterObject, _1);
			zephir_check_call_status();
			RETURN_MM();
		}
		ZEPHIR_RETURN_CALL_METHOD(filterObject, "filter", NULL, value);
		zephir_check_call_status();
		RETURN_MM();
	}
	do {
		if (ZEPHIR_IS_STRING(filter, "email")) {
			ZEPHIR_INIT_VAR(_2);
			ZEPHIR_SINIT_VAR(_3);
			ZVAL_STRING(&_3, "'", 0);
			ZEPHIR_SINIT_VAR(_4);
			ZVAL_STRING(&_4, "", 0);
			zephir_fast_str_replace(&_2, &_3, &_4, value TSRMLS_CC);
			ZEPHIR_SINIT_VAR(_5);
			ZVAL_STRING(&_5, "FILTER_SANITIZE_EMAIL", 0);
			ZEPHIR_CALL_FUNCTION(&_6, "constant", &_7, &_5);
			zephir_check_call_status();
			ZEPHIR_RETURN_CALL_FUNCTION("filter_var", &_8, _2, _6);
			zephir_check_call_status();
			RETURN_MM();
		}
		if (ZEPHIR_IS_STRING(filter, "int")) {
			ZEPHIR_SINIT_NVAR(_3);
			ZVAL_LONG(&_3, 519);
			ZEPHIR_RETURN_CALL_FUNCTION("filter_var", &_8, value, &_3);
			zephir_check_call_status();
			RETURN_MM();
		}
		if (ZEPHIR_IS_STRING(filter, "int!")) {
			RETURN_MM_LONG(zephir_get_intval(value));
		}
		if (ZEPHIR_IS_STRING(filter, "absint")) {
			ZEPHIR_SINIT_NVAR(_3);
			ZVAL_LONG(&_3, zephir_get_intval(value));
			ZEPHIR_RETURN_CALL_FUNCTION("abs", &_9, &_3);
			zephir_check_call_status();
			RETURN_MM();
		}
		if (ZEPHIR_IS_STRING(filter, "string")) {
			ZEPHIR_SINIT_NVAR(_3);
			ZVAL_LONG(&_3, 513);
			ZEPHIR_RETURN_CALL_FUNCTION("filter_var", &_8, value, &_3);
			zephir_check_call_status();
			RETURN_MM();
		}
		if (ZEPHIR_IS_STRING(filter, "float")) {
			ZEPHIR_INIT_NVAR(_1);
			zephir_create_array(_1, 1, 0 TSRMLS_CC);
			add_assoc_long_ex(_1, SS("flags"), 4096);
			ZEPHIR_SINIT_NVAR(_3);
			ZVAL_LONG(&_3, 520);
			ZEPHIR_RETURN_CALL_FUNCTION("filter_var", &_8, value, &_3, _1);
			zephir_check_call_status();
			RETURN_MM();
		}
		if (ZEPHIR_IS_STRING(filter, "float!")) {
			RETURN_MM_DOUBLE(zephir_get_doubleval(value));
		}
		if (ZEPHIR_IS_STRING(filter, "alphanum")) {
			ZEPHIR_INIT_NVAR(_2);
			ZVAL_STRING(_2, "/[^A-Za-z0-9]/", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_INIT_VAR(_10);
			ZVAL_STRING(_10, "", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", &_11, _2, _10, value);
			zephir_check_temp_parameter(_2);
			zephir_check_temp_parameter(_10);
			zephir_check_call_status();
			RETURN_MM();
		}
		if (ZEPHIR_IS_STRING(filter, "trim")) {
			zephir_fast_trim(return_value, value, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
			RETURN_MM();
		}
		if (ZEPHIR_IS_STRING(filter, "striptags")) {
			ZEPHIR_RETURN_CALL_FUNCTION("strip_tags", &_12, value);
			zephir_check_call_status();
			RETURN_MM();
		}
		if (ZEPHIR_IS_STRING(filter, "lower")) {
			if ((zephir_function_exists_ex(SS("mb_strtolower") TSRMLS_CC) == SUCCESS)) {
				ZEPHIR_RETURN_CALL_FUNCTION("mb_strtolower", NULL, value);
				zephir_check_call_status();
				RETURN_MM();
			}
			zephir_fast_strtolower(return_value, value);
			RETURN_MM();
		}
		if (ZEPHIR_IS_STRING(filter, "upper")) {
			if ((zephir_function_exists_ex(SS("mb_strtoupper") TSRMLS_CC) == SUCCESS)) {
				ZEPHIR_RETURN_CALL_FUNCTION("mb_strtoupper", NULL, value);
				zephir_check_call_status();
				RETURN_MM();
			}
			zephir_fast_strtoupper(return_value, value);
			RETURN_MM();
		}
		ZEPHIR_INIT_NVAR(_2);
		object_init_ex(_2, phalcon_filter_exception_ce);
		ZEPHIR_INIT_VAR(_13);
		ZEPHIR_CONCAT_SVS(_13, "Sanitize filter '", filter, "' is not supported");
		ZEPHIR_CALL_METHOD(NULL, _2, "__construct", &_14, _13);
		zephir_check_call_status();
		zephir_throw_exception_debug(_2, "phalcon/filter.zep", 214 TSRMLS_CC);
		ZEPHIR_MM_RESTORE();
		return;
	} while(0);

	ZEPHIR_MM_RESTORE();

}
PHP_METHOD(Xs_FieldMeta, fromConfig) {

	zend_bool _8, _11, _12, _13;
	int ZEPHIR_LAST_CALL_STATUS;
	zephir_fcall_cache_entry *_3 = NULL, *_5 = NULL;
	zval *predef = NULL;
	zval *config_param = NULL, *c = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4 = NULL, *_6, *_7, *_9, *_10;
	zval *config = NULL;

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

	zephir_get_arrval(config, config_param);


	ZEPHIR_OBS_VAR(c);
	if (zephir_array_isset_string_fetch(&c, config, SS("type"), 0 TSRMLS_CC)) {
		ZEPHIR_INIT_VAR(_0);
		zephir_fast_strtoupper(_0, c);
		ZEPHIR_INIT_VAR(_1);
		ZEPHIR_CONCAT_SSV(_1, "Xs\\FieldMeta", "::TYPE_", _0);
		zephir_get_strval(predef, _1);
		ZEPHIR_CALL_FUNCTION(&_2, "defined", &_3, 11, predef);
		zephir_check_call_status();
		if (zephir_is_true(_2)) {
			ZEPHIR_CALL_FUNCTION(&_4, "constant", &_5, 12, predef);
			zephir_check_call_status();
			zephir_update_property_this(this_ptr, SL("type"), _4 TSRMLS_CC);
			_6 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
			do {
				if (ZEPHIR_IS_LONG(_6, 10)) {
					ZEPHIR_INIT_ZVAL_NREF(_7);
					ZVAL_LONG(_7, 0x01);
					zephir_update_property_this(this_ptr, SL("flag"), _7 TSRMLS_CC);
					ZEPHIR_INIT_ZVAL_NREF(_7);
					ZVAL_STRING(_7, "full", 1);
					zephir_update_property_this(this_ptr, SL("tokenizer"), _7 TSRMLS_CC);
					break;
				}
				if (ZEPHIR_IS_LONG(_6, 11)) {
					ZEPHIR_INIT_ZVAL_NREF(_7);
					ZVAL_LONG(_7, (0x03 | 0x10));
					zephir_update_property_this(this_ptr, SL("flag"), _7 TSRMLS_CC);
					ZEPHIR_INIT_ZVAL_NREF(_7);
					ZVAL_LONG(_7, 5);
					zephir_update_property_this(this_ptr, SL("weight"), _7 TSRMLS_CC);
					break;
				}
				if (ZEPHIR_IS_LONG(_6, 12)) {
					ZEPHIR_INIT_ZVAL_NREF(_7);
					ZVAL_LONG(_7, 255);
					zephir_update_property_this(this_ptr, SL("vno"), _7 TSRMLS_CC);
					ZEPHIR_INIT_ZVAL_NREF(_7);
					ZVAL_LONG(_7, (0x01 | 0x10));
					zephir_update_property_this(this_ptr, SL("flag"), _7 TSRMLS_CC);
					ZEPHIR_INIT_ZVAL_NREF(_7);
					ZVAL_LONG(_7, 300);
					zephir_update_property_this(this_ptr, SL("cutlen"), _7 TSRMLS_CC);
					break;
				}
			} while(0);

		}
	}
	ZEPHIR_OBS_NVAR(c);
	_8 = zephir_array_isset_string_fetch(&c, config, SS("index"), 0 TSRMLS_CC);
	if (_8) {
		_6 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
		_8 = !ZEPHIR_IS_LONG(_6, 12);
	}
	if (_8) {
		ZEPHIR_INIT_NVAR(_0);
		zephir_fast_strtoupper(_0, c);
		ZEPHIR_INIT_LNVAR(_1);
		ZEPHIR_CONCAT_SSV(_1, "Xs\\FieldMeta", "::FLAG_INDEX_", _0);
		zephir_get_strval(predef, _1);
		ZEPHIR_CALL_FUNCTION(&_2, "defined", &_3, 11, predef);
		zephir_check_call_status();
		if (zephir_is_true(_2)) {
			_7 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
			ZEPHIR_CALL_FUNCTION(&_4, "constant", &_5, 12, predef);
			zephir_check_call_status();
			ZEPHIR_INIT_ZVAL_NREF(_9);
			ZVAL_LONG(_9, ((((int) (zephir_get_numberval(_7)) & ~(0x03))) | zephir_get_intval(_4)));
			zephir_update_property_this(this_ptr, SL("flag"), _9 TSRMLS_CC);
		}
		_6 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
		if (ZEPHIR_IS_LONG(_6, 10)) {
			_9 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
			ZEPHIR_INIT_ZVAL_NREF(_10);
			ZVAL_LONG(_10, ((int) (zephir_get_numberval(_9)) | 0x01));
			zephir_update_property_this(this_ptr, SL("flag"), _10 TSRMLS_CC);
		}
	}
	ZEPHIR_OBS_NVAR(c);
	if (zephir_array_isset_string_fetch(&c, config, SS("cutlen"), 0 TSRMLS_CC)) {
		ZEPHIR_INIT_ZVAL_NREF(_6);
		ZVAL_LONG(_6, zephir_get_intval(c));
		zephir_update_property_this(this_ptr, SL("cutlen"), _6 TSRMLS_CC);
	}
	ZEPHIR_OBS_NVAR(c);
	_11 = zephir_array_isset_string_fetch(&c, config, SS("weight"), 0 TSRMLS_CC);
	if (_11) {
		_6 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
		_11 = !ZEPHIR_IS_LONG(_6, 12);
	}
	if (_11) {
		ZEPHIR_INIT_ZVAL_NREF(_9);
		ZVAL_LONG(_9, (zephir_get_intval(c) & 0x3f));
		zephir_update_property_this(this_ptr, SL("weight"), _9 TSRMLS_CC);
	}
	ZEPHIR_OBS_NVAR(c);
	if (zephir_array_isset_string_fetch(&c, config, SS("phrase"), 0 TSRMLS_CC)) {
		ZEPHIR_INIT_NVAR(_0);
		zephir_fast_strtolower(_0, c);
		do {
			if (ZEPHIR_IS_STRING(_0, "yes")) {
				_9 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
				ZEPHIR_INIT_ZVAL_NREF(_10);
				ZVAL_LONG(_10, ((int) (zephir_get_numberval(_9)) | 0x10));
				zephir_update_property_this(this_ptr, SL("flag"), _10 TSRMLS_CC);
				break;
			}
			if (ZEPHIR_IS_STRING(_0, "no")) {
				_6 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
				ZEPHIR_INIT_ZVAL_NREF(_9);
				ZVAL_LONG(_9, ((int) (zephir_get_numberval(_6)) & ~(0x10)));
				zephir_update_property_this(this_ptr, SL("flag"), _9 TSRMLS_CC);
				break;
			}
		} while(0);

	}
	ZEPHIR_OBS_NVAR(c);
	if (zephir_array_isset_string_fetch(&c, config, SS("non_bool"), 0 TSRMLS_CC)) {
		ZEPHIR_INIT_NVAR(_0);
		zephir_fast_strtolower(_0, c);
		do {
			if (ZEPHIR_IS_STRING(_0, "yes")) {
				_6 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
				ZEPHIR_INIT_ZVAL_NREF(_9);
				ZVAL_LONG(_9, ((int) (zephir_get_numberval(_6)) | 0x80));
				zephir_update_property_this(this_ptr, SL("flag"), _9 TSRMLS_CC);
				break;
			}
			if (ZEPHIR_IS_STRING(_0, "no")) {
				_6 = zephir_fetch_nproperty_this(this_ptr, SL("flag"), PH_NOISY_CC);
				ZEPHIR_INIT_ZVAL_NREF(_9);
				ZVAL_LONG(_9, ((int) (zephir_get_numberval(_6)) & ~(0x80)));
				zephir_update_property_this(this_ptr, SL("flag"), _9 TSRMLS_CC);
				break;
			}
		} while(0);

	}
	ZEPHIR_OBS_NVAR(c);
	_12 = zephir_array_isset_string_fetch(&c, config, SS("tokenizer"), 0 TSRMLS_CC);
	if (_12) {
		_6 = zephir_fetch_nproperty_this(this_ptr, SL("type"), PH_NOISY_CC);
		_12 = !ZEPHIR_IS_LONG(_6, 10);
	}
	_13 = _12;
	if (_13) {
		_13 = !ZEPHIR_IS_STRING(c, "default");
	}
	if (_13) {
		zephir_update_property_this(this_ptr, SL("tokenizer"), c TSRMLS_CC);
	}
	ZEPHIR_MM_RESTORE();

}
示例#9
0
/**
 * Generates SQL to create a table
 */
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) {

	HashTable *_1, *_18$$14, *_31$$18;
	HashPosition _0, _17$$14, _30$$18;
	zend_bool hasPrimary = 0, _7$$7, _9$$7, _20$$15, _21$$15;
	zephir_fcall_cache_entry *_5 = NULL, *_14 = NULL, *_25 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *definition = NULL;
	zval *tableName_param = NULL, *schemaName_param = NULL, *definition_param = NULL, *columns = NULL, *table = NULL, *temporary = NULL, *options = NULL, *createLines = NULL, *columnLine = NULL, *column = NULL, *indexes = NULL, *index = NULL, *indexName = NULL, *indexType = NULL, *references = NULL, *reference = NULL, *defaultValue = NULL, *referenceSql = NULL, *onDelete = NULL, *onUpdate = NULL, *sql = NULL, **_2, *_41, *_42, *_3$$7 = NULL, *_4$$7 = NULL, *_6$$7 = NULL, *_8$$7 = NULL, *_10$$7 = NULL, *_16$$7 = NULL, *_11$$10 = NULL, _12$$12 = zval_used_for_init, *_13$$12 = NULL, *_15$$12 = NULL, **_19$$14, *_22$$15 = NULL, *_23$$16 = NULL, *_24$$16 = NULL, *_26$$16 = NULL, *_27$$17 = NULL, *_28$$17 = NULL, *_29$$17 = NULL, **_32$$18, *_33$$19 = NULL, *_34$$19 = NULL, *_35$$19 = NULL, *_36$$19 = NULL, *_37$$19 = NULL, *_38$$19 = NULL, *_39$$20 = NULL, *_40$$21 = NULL;
	zval *tableName = NULL, *schemaName = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &definition_param);

	if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
		zephir_get_strval(tableName, tableName_param);
	} else {
		ZEPHIR_INIT_VAR(tableName);
		ZVAL_EMPTY_STRING(tableName);
	}
	if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
		zephir_get_strval(schemaName, schemaName_param);
	} else {
		ZEPHIR_INIT_VAR(schemaName);
		ZVAL_EMPTY_STRING(schemaName);
	}
	definition = definition_param;


	ZEPHIR_CALL_METHOD(&table, this_ptr, "preparetable", NULL, 0, tableName, schemaName);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(temporary);
	ZVAL_BOOL(temporary, 0);
	ZEPHIR_OBS_VAR(options);
	if (zephir_array_isset_string_fetch(&options, definition, SS("options"), 0 TSRMLS_CC)) {
		ZEPHIR_OBS_NVAR(temporary);
		zephir_array_isset_string_fetch(&temporary, options, SS("temporary"), 0 TSRMLS_CC);
	}
	ZEPHIR_OBS_VAR(columns);
	if (!(zephir_array_isset_string_fetch(&columns, definition, SS("columns"), 0 TSRMLS_CC))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'columns' is required in the definition array", "phalcon/db/dialect/sqlite.zep", 322);
		return;
	}
	ZEPHIR_INIT_VAR(sql);
	if (zephir_is_true(temporary)) {
		ZEPHIR_CONCAT_SVS(sql, "CREATE TEMPORARY TABLE ", table, " (\n\t");
	} else {
		ZEPHIR_CONCAT_SVS(sql, "CREATE TABLE ", table, " (\n\t");
	}
	hasPrimary = 0;
	ZEPHIR_INIT_VAR(createLines);
	array_init(createLines);
	zephir_is_iterable(columns, &_1, &_0, 0, 0, "phalcon/db/dialect/sqlite.zep", 380);
	for (
	  ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
	  ; zephir_hash_move_forward_ex(_1, &_0)
	) {
		ZEPHIR_GET_HVALUE(column, _2);
		ZEPHIR_CALL_METHOD(&_3$$7, column, "getname", NULL, 0);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(&_4$$7, this_ptr, "getcolumndefinition", &_5, 0, column);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(columnLine);
		ZEPHIR_CONCAT_SVSV(columnLine, "`", _3$$7, "` ", _4$$7);
		ZEPHIR_CALL_METHOD(&_6$$7, column, "isprimary", NULL, 0);
		zephir_check_call_status();
		_7$$7 = zephir_is_true(_6$$7);
		if (_7$$7) {
			_7$$7 = !hasPrimary;
		}
		if (_7$$7) {
			zephir_concat_self_str(&columnLine, SL(" PRIMARY KEY") TSRMLS_CC);
			hasPrimary = 1;
		}
		ZEPHIR_CALL_METHOD(&_8$$7, column, "isautoincrement", NULL, 0);
		zephir_check_call_status();
		_9$$7 = zephir_is_true(_8$$7);
		if (_9$$7) {
			_9$$7 = hasPrimary;
		}
		if (_9$$7) {
			zephir_concat_self_str(&columnLine, SL(" AUTOINCREMENT") TSRMLS_CC);
		}
		ZEPHIR_CALL_METHOD(&_10$$7, column, "hasdefault", NULL, 0);
		zephir_check_call_status();
		if (zephir_is_true(_10$$7)) {
			ZEPHIR_CALL_METHOD(&defaultValue, column, "getdefault", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(_11$$10);
			zephir_fast_strtoupper(_11$$10, defaultValue);
			if (zephir_memnstr_str(_11$$10, SL("CURRENT_TIMESTAMP"), "phalcon/db/dialect/sqlite.zep", 360)) {
				zephir_concat_self_str(&columnLine, SL(" DEFAULT CURRENT_TIMESTAMP") TSRMLS_CC);
			} else {
				ZEPHIR_SINIT_NVAR(_12$$12);
				ZVAL_STRING(&_12$$12, "\"", 0);
				ZEPHIR_CALL_FUNCTION(&_13$$12, "addcslashes", &_14, 153, defaultValue, &_12$$12);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_15$$12);
				ZEPHIR_CONCAT_SVS(_15$$12, " DEFAULT \"", _13$$12, "\"");
				zephir_concat_self(&columnLine, _15$$12 TSRMLS_CC);
			}
		}
		ZEPHIR_CALL_METHOD(&_16$$7, column, "isnotnull", NULL, 0);
		zephir_check_call_status();
		if (zephir_is_true(_16$$7)) {
			zephir_concat_self_str(&columnLine, SL(" NOT NULL") TSRMLS_CC);
		}
		zephir_array_append(&createLines, columnLine, PH_SEPARATE, "phalcon/db/dialect/sqlite.zep", 374);
	}
	ZEPHIR_OBS_VAR(indexes);
	if (zephir_array_isset_string_fetch(&indexes, definition, SS("indexes"), 0 TSRMLS_CC)) {
		zephir_is_iterable(indexes, &_18$$14, &_17$$14, 0, 0, "phalcon/db/dialect/sqlite.zep", 396);
		for (
		  ; zephir_hash_get_current_data_ex(_18$$14, (void**) &_19$$14, &_17$$14) == SUCCESS
		  ; zephir_hash_move_forward_ex(_18$$14, &_17$$14)
		) {
			ZEPHIR_GET_HVALUE(index, _19$$14);
			ZEPHIR_CALL_METHOD(&indexName, index, "getname", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&indexType, index, "gettype", NULL, 0);
			zephir_check_call_status();
			_20$$15 = ZEPHIR_IS_STRING(indexName, "PRIMARY");
			if (_20$$15) {
				_20$$15 = !hasPrimary;
			}
			_21$$15 = !(ZEPHIR_IS_EMPTY(indexType));
			if (_21$$15) {
				ZEPHIR_INIT_NVAR(_22$$15);
				zephir_fast_strtoupper(_22$$15, indexType);
				_21$$15 = zephir_memnstr_str(_22$$15, SL("UNIQUE"), "phalcon/db/dialect/sqlite.zep", 392);
			}
			if (_20$$15) {
				ZEPHIR_CALL_METHOD(&_24$$16, index, "getcolumns", NULL, 0);
				zephir_check_call_status();
				ZEPHIR_CALL_METHOD(&_23$$16, this_ptr, "getcolumnlist", &_25, 54, _24$$16);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_26$$16);
				ZEPHIR_CONCAT_SVS(_26$$16, "PRIMARY KEY (", _23$$16, ")");
				zephir_array_append(&createLines, _26$$16, PH_SEPARATE, "phalcon/db/dialect/sqlite.zep", 391);
			} else if (_21$$15) {
				ZEPHIR_CALL_METHOD(&_28$$17, index, "getcolumns", NULL, 0);
				zephir_check_call_status();
				ZEPHIR_CALL_METHOD(&_27$$17, this_ptr, "getcolumnlist", &_25, 54, _28$$17);
				zephir_check_call_status();
				ZEPHIR_INIT_LNVAR(_29$$17);
				ZEPHIR_CONCAT_SVS(_29$$17, "UNIQUE (", _27$$17, ")");
				zephir_array_append(&createLines, _29$$17, PH_SEPARATE, "phalcon/db/dialect/sqlite.zep", 393);
			}
		}
	}
	ZEPHIR_OBS_VAR(references);
	if (zephir_array_isset_string_fetch(&references, definition, SS("references"), 0 TSRMLS_CC)) {
		zephir_is_iterable(references, &_31$$18, &_30$$18, 0, 0, "phalcon/db/dialect/sqlite.zep", 418);
		for (
		  ; zephir_hash_get_current_data_ex(_31$$18, (void**) &_32$$18, &_30$$18) == SUCCESS
		  ; zephir_hash_move_forward_ex(_31$$18, &_30$$18)
		) {
			ZEPHIR_GET_HVALUE(reference, _32$$18);
			ZEPHIR_CALL_METHOD(&_33$$19, reference, "getname", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_35$$19, reference, "getcolumns", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_34$$19, this_ptr, "getcolumnlist", &_25, 54, _35$$19);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_36$$19, reference, "getreferencedtable", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_38$$19, reference, "getreferencedcolumns", NULL, 0);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(&_37$$19, this_ptr, "getcolumnlist", &_25, 54, _38$$19);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(referenceSql);
			ZEPHIR_CONCAT_SVSVSSVSVS(referenceSql, "CONSTRAINT `", _33$$19, "` FOREIGN KEY (", _34$$19, ")", " REFERENCES `", _36$$19, "`(", _37$$19, ")");
			ZEPHIR_CALL_METHOD(&onDelete, reference, "getondelete", NULL, 0);
			zephir_check_call_status();
			if (!(ZEPHIR_IS_EMPTY(onDelete))) {
				ZEPHIR_INIT_LNVAR(_39$$20);
				ZEPHIR_CONCAT_SV(_39$$20, " ON DELETE ", onDelete);
				zephir_concat_self(&referenceSql, _39$$20 TSRMLS_CC);
			}
			ZEPHIR_CALL_METHOD(&onUpdate, reference, "getonupdate", NULL, 0);
			zephir_check_call_status();
			if (!(ZEPHIR_IS_EMPTY(onUpdate))) {
				ZEPHIR_INIT_LNVAR(_40$$21);
				ZEPHIR_CONCAT_SV(_40$$21, " ON UPDATE ", onUpdate);
				zephir_concat_self(&referenceSql, _40$$21 TSRMLS_CC);
			}
			zephir_array_append(&createLines, referenceSql, PH_SEPARATE, "phalcon/db/dialect/sqlite.zep", 416);
		}
	}
	ZEPHIR_INIT_VAR(_41);
	zephir_fast_join_str(_41, SL(",\n\t"), createLines TSRMLS_CC);
	ZEPHIR_INIT_VAR(_42);
	ZEPHIR_CONCAT_VS(_42, _41, "\n)");
	zephir_concat_self(&sql, _42 TSRMLS_CC);
	RETURN_CCTOR(sql);

}
示例#10
0
/**
 * Generates SQL to add a column to a table
 */
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addColumn) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *tableName_param = NULL, *schemaName_param = NULL, *column, *sql = NULL, *defaultValue = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *_3, *_4 = NULL, *_9 = NULL, *_10 = NULL, *_5$$3, _6$$5, *_7$$5 = NULL, *_8$$5;
	zval *tableName = NULL, *schemaName = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &column);

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


	ZEPHIR_CALL_METHOD(&_0, this_ptr, "preparetable", NULL, 0, tableName, schemaName);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(sql);
	ZEPHIR_CONCAT_SVS(sql, "ALTER TABLE ", _0, " ADD COLUMN ");
	ZEPHIR_CALL_METHOD(&_1, column, "getname", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&_2, this_ptr, "getcolumndefinition", NULL, 0, column);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_3);
	ZEPHIR_CONCAT_SVSV(_3, "\"", _1, "\" ", _2);
	zephir_concat_self(&sql, _3 TSRMLS_CC);
	ZEPHIR_CALL_METHOD(&_4, column, "hasdefault", NULL, 0);
	zephir_check_call_status();
	if (zephir_is_true(_4)) {
		ZEPHIR_CALL_METHOD(&defaultValue, column, "getdefault", NULL, 0);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_5$$3);
		zephir_fast_strtoupper(_5$$3, defaultValue);
		if (zephir_memnstr_str(_5$$3, SL("CURRENT_TIMESTAMP"), "phalcon/db/dialect/sqlite.zep", 203)) {
			zephir_concat_self_str(&sql, SL(" DEFAULT CURRENT_TIMESTAMP") TSRMLS_CC);
		} else {
			ZEPHIR_SINIT_VAR(_6$$5);
			ZVAL_STRING(&_6$$5, "\"", 0);
			ZEPHIR_CALL_FUNCTION(&_7$$5, "addcslashes", NULL, 153, defaultValue, &_6$$5);
			zephir_check_call_status();
			ZEPHIR_INIT_VAR(_8$$5);
			ZEPHIR_CONCAT_SVS(_8$$5, " DEFAULT \"", _7$$5, "\"");
			zephir_concat_self(&sql, _8$$5 TSRMLS_CC);
		}
	}
	ZEPHIR_CALL_METHOD(&_9, column, "isnotnull", NULL, 0);
	zephir_check_call_status();
	if (zephir_is_true(_9)) {
		zephir_concat_self_str(&sql, SL(" NOT NULL") TSRMLS_CC);
	}
	ZEPHIR_CALL_METHOD(&_10, column, "isautoincrement", NULL, 0);
	zephir_check_call_status();
	if (zephir_is_true(_10)) {
		zephir_concat_self_str(&sql, SL(" PRIMARY KEY AUTOINCREMENT") TSRMLS_CC);
	}
	RETURN_CCTOR(sql);

}
示例#11
0
/**
 * 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, &params, &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);

}