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


C++ zephir_is_true函数代码示例

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


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

示例1: PHP_METHOD

/**
 * Handle the whole command-line tasks
 */
PHP_METHOD(Phalcon_Cli_Console, handle) {

	zend_bool _5;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *arguments_param = NULL, *dependencyInjector = NULL, *router = NULL, *eventsManager = NULL, *moduleName = NULL, *modules = NULL, *module = NULL, *path = NULL, *className = NULL, *moduleObject = NULL, *dispatcher = NULL, *task = NULL, *_0, *_3 = NULL, *_4 = NULL, *_15 = NULL, *_16 = NULL, *_17, *_1$$4 = NULL, *_2$$4, *_6$$6, *_7$$10 = NULL, *_8$$10, *_9$$12, *_10$$12, *_11$$15, *_12$$15, *_13$$17 = NULL, *_14$$17, *_18$$19 = NULL, *_19$$19, *_20$$21;
	zval *arguments = NULL;

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

	if (!arguments_param) {
		ZEPHIR_INIT_VAR(arguments);
		array_init(arguments);
	} else {
		zephir_get_arrval(arguments, arguments_param);
	}


	ZEPHIR_OBS_VAR(dependencyInjector);
	zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
	if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_console_exception_ce, "A dependency injection object is required to access internal services", "phalcon/cli/console.zep", 69);
		return;
	}
	_0 = zephir_fetch_nproperty_this(this_ptr, SL("_eventsManager"), PH_NOISY_CC);
	ZEPHIR_CPY_WRT(eventsManager, _0);
	if (Z_TYPE_P(eventsManager) == IS_OBJECT) {
		ZEPHIR_INIT_VAR(_2$$4);
		ZVAL_STRING(_2$$4, "console:boot", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&_1$$4, eventsManager, "fire", NULL, 0, _2$$4, this_ptr);
		zephir_check_temp_parameter(_2$$4);
		zephir_check_call_status();
		if (ZEPHIR_IS_FALSE_IDENTICAL(_1$$4)) {
			RETURN_MM_BOOL(0);
		}
	}
	ZEPHIR_INIT_VAR(_4);
	ZVAL_STRING(_4, "router", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(&_3, dependencyInjector, "getshared", NULL, 0, _4);
	zephir_check_temp_parameter(_4);
	zephir_check_call_status();
	ZEPHIR_CPY_WRT(router, _3);
	_5 = !(zephir_fast_count_int(arguments TSRMLS_CC));
	if (_5) {
		_0 = zephir_fetch_nproperty_this(this_ptr, SL("_arguments"), PH_NOISY_CC);
		_5 = zephir_is_true(_0);
	}
	if (_5) {
		_6$$6 = zephir_fetch_nproperty_this(this_ptr, SL("_arguments"), PH_NOISY_CC);
		ZEPHIR_CALL_METHOD(NULL, router, "handle", NULL, 0, _6$$6);
		zephir_check_call_status();
	} else {
		ZEPHIR_CALL_METHOD(NULL, router, "handle", NULL, 0, arguments);
		zephir_check_call_status();
	}
	ZEPHIR_CALL_METHOD(&moduleName, router, "getmodulename", NULL, 0);
	zephir_check_call_status();
	if (!(zephir_is_true(moduleName))) {
		ZEPHIR_OBS_NVAR(moduleName);
		zephir_read_property_this(&moduleName, this_ptr, SL("_defaultModule"), PH_NOISY_CC);
	}
	if (zephir_is_true(moduleName)) {
		if (Z_TYPE_P(eventsManager) == IS_OBJECT) {
			ZEPHIR_INIT_VAR(_8$$10);
			ZVAL_STRING(_8$$10, "console:beforeStartModule", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&_7$$10, eventsManager, "fire", NULL, 0, _8$$10, this_ptr, moduleName);
			zephir_check_temp_parameter(_8$$10);
			zephir_check_call_status();
			if (ZEPHIR_IS_FALSE_IDENTICAL(_7$$10)) {
				RETURN_MM_BOOL(0);
			}
		}
		ZEPHIR_OBS_VAR(modules);
		zephir_read_property_this(&modules, this_ptr, SL("_modules"), PH_NOISY_CC);
		if (!(zephir_array_isset(modules, moduleName))) {
			ZEPHIR_INIT_VAR(_9$$12);
			object_init_ex(_9$$12, phalcon_cli_console_exception_ce);
			ZEPHIR_INIT_VAR(_10$$12);
			ZEPHIR_CONCAT_SVS(_10$$12, "Module '", moduleName, "' isn't registered in the console container");
			ZEPHIR_CALL_METHOD(NULL, _9$$12, "__construct", NULL, 9, _10$$12);
			zephir_check_call_status();
			zephir_throw_exception_debug(_9$$12, "phalcon/cli/console.zep", 109 TSRMLS_CC);
			ZEPHIR_MM_RESTORE();
			return;
		}
		ZEPHIR_OBS_VAR(module);
		zephir_array_fetch(&module, modules, moduleName, PH_NOISY, "phalcon/cli/console.zep", 112 TSRMLS_CC);
		if (Z_TYPE_P(module) != IS_ARRAY) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cli_console_exception_ce, "Invalid module definition path", "phalcon/cli/console.zep", 114);
			return;
		}
		ZEPHIR_OBS_VAR(path);
		if (zephir_array_isset_string_fetch(&path, module, SS("path"), 0 TSRMLS_CC)) {
			if (!((zephir_file_exists(path TSRMLS_CC) == SUCCESS))) {
				ZEPHIR_INIT_VAR(_11$$15);
				object_init_ex(_11$$15, phalcon_cli_console_exception_ce);
				ZEPHIR_INIT_VAR(_12$$15);
//.........这里部分代码省略.........
开发者ID:SDpower,项目名称:cphalcon,代码行数:101,代码来源:console.zep.c

示例2: PHP_METHOD

/**
 * 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);

}
开发者ID:dario1985,项目名称:adodb,代码行数:85,代码来源:connection.c

示例3: PHP_METHOD

/**
 * We have to cast values manually because parse_ini_file() has a poor implementation.
 *
 * @param mixed ini The array casted by `parse_ini_file`
 */
PHP_METHOD(Phalcon_Config_Adapter_Ini, _cast) {

	zend_bool _5$$5, _6$$5, _8$$5, _9$$5;
	HashTable *_1$$3;
	HashPosition _0$$3;
	zephir_fcall_cache_entry *_4 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *ini, *key = NULL, *val = NULL, **_2$$3, *_3$$4 = NULL, *_7$$5, *_10$$5, *_11$$9, *_12$$9, _13$$9;

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

	ZEPHIR_SEPARATE_PARAM(ini);


	if (Z_TYPE_P(ini) == IS_ARRAY) {
		zephir_is_iterable(ini, &_1$$3, &_0$$3, 1, 0, "phalcon/config/adapter/ini.zep", 148);
		for (
		  ; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS
		  ; zephir_hash_move_forward_ex(_1$$3, &_0$$3)
		) {
			ZEPHIR_GET_HMKEY(key, _1$$3, _0$$3);
			ZEPHIR_GET_HVALUE(val, _2$$3);
			ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "_cast", &_4, 137, val);
			zephir_check_call_status();
			zephir_array_update_zval(&ini, key, &_3$$4, PH_COPY | PH_SEPARATE);
		}
		zend_hash_destroy(_1$$3);
		FREE_HASHTABLE(_1$$3);
	}
	if (Z_TYPE_P(ini) == IS_STRING) {
		_5$$5 = ZEPHIR_IS_STRING_IDENTICAL(ini, "true");
		if (!(_5$$5)) {
			_5$$5 = ZEPHIR_IS_STRING_IDENTICAL(ini, "yes");
		}
		_6$$5 = _5$$5;
		if (!(_6$$5)) {
			ZEPHIR_INIT_VAR(_7$$5);
			zephir_fast_strtolower(_7$$5, ini);
			_6$$5 = ZEPHIR_IS_STRING_IDENTICAL(_7$$5, "on");
		}
		if (_6$$5) {
			RETURN_MM_BOOL(1);
		}
		_8$$5 = ZEPHIR_IS_STRING_IDENTICAL(ini, "false");
		if (!(_8$$5)) {
			_8$$5 = ZEPHIR_IS_STRING_IDENTICAL(ini, "no");
		}
		_9$$5 = _8$$5;
		if (!(_9$$5)) {
			ZEPHIR_INIT_VAR(_10$$5);
			zephir_fast_strtolower(_10$$5, ini);
			_9$$5 = ZEPHIR_IS_STRING_IDENTICAL(_10$$5, "off");
		}
		if (_9$$5) {
			RETURN_MM_BOOL(0);
		}
		if (ZEPHIR_IS_STRING_IDENTICAL(ini, "null")) {
			RETURN_MM_NULL();
		}
		if (zephir_is_numeric(ini)) {
			ZEPHIR_INIT_VAR(_11$$9);
			ZEPHIR_INIT_VAR(_12$$9);
			ZEPHIR_SINIT_VAR(_13$$9);
			ZVAL_STRING(&_13$$9, "/[.]+/", 0);
			zephir_preg_match(_12$$9, &_13$$9, ini, _11$$9, 0, 0 , 0  TSRMLS_CC);
			if (zephir_is_true(_12$$9)) {
				RETURN_MM_DOUBLE(zephir_get_doubleval(ini));
			} else {
				RETURN_MM_LONG(zephir_get_intval(ini));
			}
		}
	}
	RETVAL_ZVAL(ini, 1, 0);
	RETURN_MM();

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

示例4: PHP_METHOD

/**
 * getOctet allow to gets the value of a configuration option in octet
 *
 * @return int the value of a configuration option in octet
 */
PHP_METHOD(Phady_Util_Tools, getOctets) {

	int size, ZEPHIR_LAST_CALL_STATUS;
	zval *option, *_0, *_1, _2, *_3, *_4, _5, *_6, *_7, _8, *_9 = NULL, *_10 = NULL, *_11 = NULL;

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



	ZEPHIR_INIT_VAR(_0);
	ZEPHIR_INIT_VAR(_1);
	ZEPHIR_SINIT_VAR(_2);
	ZVAL_STRING(&_2, "/[0-9]+k/i", 0);
	zephir_preg_match(_1, &_2, option, _0, 0, 0 , 0  TSRMLS_CC);
	ZEPHIR_INIT_VAR(_3);
	ZEPHIR_INIT_VAR(_4);
	ZEPHIR_SINIT_VAR(_5);
	ZVAL_STRING(&_5, "/[0-9]+m/i", 0);
	zephir_preg_match(_4, &_5, option, _3, 0, 0 , 0  TSRMLS_CC);
	ZEPHIR_INIT_VAR(_6);
	ZEPHIR_INIT_VAR(_7);
	ZEPHIR_SINIT_VAR(_8);
	ZVAL_STRING(&_8, "/[0-9]+g/i", 0);
	zephir_preg_match(_7, &_8, option, _6, 0, 0 , 0  TSRMLS_CC);
	if (zephir_is_true(_1)) {
		ZEPHIR_INIT_VAR(_9);
		ZVAL_STRING(_9, "/m/i", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_INIT_VAR(_10);
		ZVAL_STRING(_10, "", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_FUNCTION(&_11, "preg_replace", NULL, 142, _9, _10, option);
		zephir_check_temp_parameter(_9);
		zephir_check_temp_parameter(_10);
		zephir_check_call_status();
		size = (zephir_get_intval(_11) * 1024);
	} else if (zephir_is_true(_4)) {
		ZEPHIR_INIT_NVAR(_9);
		ZVAL_STRING(_9, "/m/i", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_INIT_NVAR(_10);
		ZVAL_STRING(_10, "", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_FUNCTION(&_11, "preg_replace", NULL, 142, _9, _10, option);
		zephir_check_temp_parameter(_9);
		zephir_check_temp_parameter(_10);
		zephir_check_call_status();
		size = (1048576 * zephir_get_intval(_11));
	} else if (zephir_is_true(_7)) {
		ZEPHIR_INIT_NVAR(_9);
		ZVAL_STRING(_9, "/g/i", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_INIT_NVAR(_10);
		ZVAL_STRING(_10, "", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_FUNCTION(&_11, "preg_replace", NULL, 142, _9, _10, option);
		zephir_check_temp_parameter(_9);
		zephir_check_temp_parameter(_10);
		zephir_check_call_status();
		size = ((1048576 * 1024) * zephir_get_intval(_11));
	} else {
		size = zephir_get_numberval(option);
	}
	RETURN_MM_LONG(size);

}
开发者ID:alienfernandez,项目名称:phady,代码行数:66,代码来源:tools.zep.c

示例5: PHP_METHOD


//.........这里部分代码省略.........
				break;
			}
			if (zephir_memnstr_str(columnType, SL("bit"), "phalcon/db/adapter/pdo/mysql.zep", 216)) {
				ZEPHIR_INIT_NVAR(_7);
				ZVAL_LONG(_7, 8);
				zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
				ZEPHIR_INIT_NVAR(_8);
				ZVAL_LONG(_8, 5);
				zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE);
				break;
			}
			if (zephir_memnstr_str(columnType, SL("tinyblob"), "phalcon/db/adapter/pdo/mysql.zep", 225)) {
				ZEPHIR_INIT_NVAR(_7);
				ZVAL_LONG(_7, 10);
				zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
				ZEPHIR_INIT_NVAR(_8);
				ZVAL_LONG(_8, 5);
				zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE);
				break;
			}
			if (zephir_memnstr_str(columnType, SL("mediumblob"), "phalcon/db/adapter/pdo/mysql.zep", 234)) {
				ZEPHIR_INIT_NVAR(_7);
				ZVAL_LONG(_7, 12);
				zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
				break;
			}
			if (zephir_memnstr_str(columnType, SL("longblob"), "phalcon/db/adapter/pdo/mysql.zep", 242)) {
				ZEPHIR_INIT_NVAR(_7);
				ZVAL_LONG(_7, 13);
				zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
				break;
			}
			if (zephir_memnstr_str(columnType, SL("blob"), "phalcon/db/adapter/pdo/mysql.zep", 250)) {
				ZEPHIR_INIT_NVAR(_7);
				ZVAL_LONG(_7, 11);
				zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
				break;
			}
			ZEPHIR_INIT_NVAR(_7);
			ZVAL_LONG(_7, 2);
			zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
			break;
		}
		if (zephir_memnstr_str(columnType, SL("("), "phalcon/db/adapter/pdo/mysql.zep", 265)) {
			ZEPHIR_INIT_NVAR(matches);
			ZVAL_NULL(matches);
			ZEPHIR_INIT_NVAR(_8);
			zephir_preg_match(_8, sizePattern, columnType, matches, 0, 0 , 0  TSRMLS_CC);
			if (zephir_is_true(_8)) {
				ZEPHIR_OBS_NVAR(matchOne);
				if (zephir_array_isset_long_fetch(&matchOne, matches, 1, 0 TSRMLS_CC)) {
					ZEPHIR_INIT_NVAR(_9);
					ZVAL_LONG(_9, zephir_get_intval(matchOne));
					zephir_array_update_string(&definition, SL("size"), &_9, PH_COPY | PH_SEPARATE);
				}
				ZEPHIR_OBS_NVAR(matchTwo);
				if (zephir_array_isset_long_fetch(&matchTwo, matches, 2, 0 TSRMLS_CC)) {
					ZEPHIR_INIT_NVAR(_9);
					ZVAL_LONG(_9, zephir_get_intval(matchTwo));
					zephir_array_update_string(&definition, SL("scale"), &_9, PH_COPY | PH_SEPARATE);
				}
			}
		}
		if (zephir_memnstr_str(columnType, SL("unsigned"), "phalcon/db/adapter/pdo/mysql.zep", 280)) {
			zephir_array_update_string(&definition, SL("unsigned"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE);
		}
		if (Z_TYPE_P(oldColumn) == IS_NULL) {
			zephir_array_update_string(&definition, SL("first"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE);
		} else {
			zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE);
		}
		zephir_array_fetch_long(&_10, field, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 296 TSRMLS_CC);
		if (ZEPHIR_IS_STRING(_10, "PRI")) {
			zephir_array_update_string(&definition, SL("primary"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE);
		}
		zephir_array_fetch_long(&_11, field, 2, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 303 TSRMLS_CC);
		if (ZEPHIR_IS_STRING(_11, "NO")) {
			zephir_array_update_string(&definition, SL("notNull"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE);
		}
		zephir_array_fetch_long(&_12, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 310 TSRMLS_CC);
		if (ZEPHIR_IS_STRING(_12, "auto_increment")) {
			zephir_array_update_string(&definition, SL("autoIncrement"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE);
		}
		ZEPHIR_OBS_NVAR(_13);
		zephir_array_fetch_long(&_13, field, 4, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 317 TSRMLS_CC);
		if (Z_TYPE_P(_13) != IS_NULL) {
			zephir_array_fetch_long(&_14, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 318 TSRMLS_CC);
			zephir_array_update_string(&definition, SL("default"), &_14, PH_COPY | PH_SEPARATE);
		}
		zephir_array_fetch_long(&columnName, field, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 324 TSRMLS_CC);
		ZEPHIR_INIT_NVAR(_7);
		object_init_ex(_7, phalcon_db_column_ce);
		ZEPHIR_CALL_METHOD(NULL, _7, "__construct", &_15, 140, columnName, definition);
		zephir_check_call_status();
		zephir_array_append(&columns, _7, PH_SEPARATE, "phalcon/db/adapter/pdo/mysql.zep", 325);
		ZEPHIR_CPY_WRT(oldColumn, columnName);
	}
	RETURN_CCTOR(columns);

}
开发者ID:brainformatik,项目名称:cphalcon,代码行数:101,代码来源:mysql.zep.c

示例6: PHP_METHOD

/**
 * Sets the HTTP response code
 *
 *<code>
 *	$response->setStatusCode(404, "Not Found");
 *</code>
 */
PHP_METHOD(Phalcon_Http_Response, setStatusCode) {

	zval *_10;
	zephir_fcall_cache_entry *_7 = NULL, *_8 = NULL;
	zend_bool _4;
	HashTable *_2;
	HashPosition _1;
	zval *message = NULL, *_13, *_15;
	zval *code_param = NULL, *message_param = NULL, *headers = NULL, *currentHeadersRaw = NULL, *key = NULL, *defaultMessage, *_0 = NULL, **_3, _5 = zval_used_for_init, *_6 = NULL, *_9, *_11, *_12, _14;
	int code, ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &code_param, &message_param);

	code = zephir_get_intval(code_param);
	if (!message_param) {
		ZEPHIR_INIT_VAR(message);
		ZVAL_EMPTY_STRING(message);
	} else {
		zephir_get_strval(message, message_param);
	}


	ZEPHIR_CALL_METHOD(&headers, this_ptr, "getheaders", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&currentHeadersRaw, headers, "toarray", NULL, 0);
	zephir_check_call_status();
	if (Z_TYPE_P(currentHeadersRaw) == IS_ARRAY) {
		ZEPHIR_INIT_VAR(_0);
		zephir_is_iterable(currentHeadersRaw, &_2, &_1, 0, 0, "phalcon/http/response.zep", 130);
		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(_0, _3);
			_4 = Z_TYPE_P(key) == IS_STRING;
			if (_4) {
				ZEPHIR_SINIT_NVAR(_5);
				ZVAL_STRING(&_5, "HTTP/", 0);
				ZEPHIR_CALL_FUNCTION(&_6, "strstr", &_7, 235, key, &_5);
				zephir_check_call_status();
				_4 = zephir_is_true(_6);
			}
			if (_4) {
				ZEPHIR_CALL_METHOD(NULL, headers, "remove", &_8, 0, key);
				zephir_check_call_status();
			}
		}
	}
	if (ZEPHIR_IS_STRING_IDENTICAL(message, "")) {
		ZEPHIR_OBS_VAR(_9);
		zephir_read_property_this(&_9, this_ptr, SL("_statusCodes"), PH_NOISY_CC);
		if (Z_TYPE_P(_9) != IS_ARRAY) {
			ZEPHIR_INIT_VAR(_10);
			zephir_create_array(_10, 59, 0 TSRMLS_CC);
			add_index_stringl(_10, 100, SL("Continue"), 1);
			add_index_stringl(_10, 101, SL("Switching Protocols"), 1);
			add_index_stringl(_10, 102, SL("Processing"), 1);
			add_index_stringl(_10, 200, SL("OK"), 1);
			add_index_stringl(_10, 201, SL("Created"), 1);
			add_index_stringl(_10, 202, SL("Accepted"), 1);
			add_index_stringl(_10, 203, SL("Non-Authoritative Information"), 1);
			add_index_stringl(_10, 204, SL("No Content"), 1);
			add_index_stringl(_10, 205, SL("Reset Content"), 1);
			add_index_stringl(_10, 206, SL("Partial Content"), 1);
			add_index_stringl(_10, 207, SL("Multi-status"), 1);
			add_index_stringl(_10, 208, SL("Already Reported"), 1);
			add_index_stringl(_10, 300, SL("Multiple Choices"), 1);
			add_index_stringl(_10, 301, SL("Moved Permanently"), 1);
			add_index_stringl(_10, 302, SL("Found"), 1);
			add_index_stringl(_10, 303, SL("See Other"), 1);
			add_index_stringl(_10, 304, SL("Not Modified"), 1);
			add_index_stringl(_10, 305, SL("Use Proxy"), 1);
			add_index_stringl(_10, 306, SL("Switch Proxy"), 1);
			add_index_stringl(_10, 307, SL("Temporary Redirect"), 1);
			add_index_stringl(_10, 400, SL("Bad Request"), 1);
			add_index_stringl(_10, 401, SL("Unauthorized"), 1);
			add_index_stringl(_10, 402, SL("Payment Required"), 1);
			add_index_stringl(_10, 403, SL("Forbidden"), 1);
			add_index_stringl(_10, 404, SL("Not Found"), 1);
			add_index_stringl(_10, 405, SL("Method Not Allowed"), 1);
			add_index_stringl(_10, 406, SL("Not Acceptable"), 1);
			add_index_stringl(_10, 407, SL("Proxy Authentication Required"), 1);
			add_index_stringl(_10, 408, SL("Request Time-out"), 1);
			add_index_stringl(_10, 409, SL("Conflict"), 1);
			add_index_stringl(_10, 410, SL("Gone"), 1);
			add_index_stringl(_10, 411, SL("Length Required"), 1);
			add_index_stringl(_10, 412, SL("Precondition Failed"), 1);
			add_index_stringl(_10, 413, SL("Request Entity Too Large"), 1);
			add_index_stringl(_10, 414, SL("Request-URI Too Large"), 1);
			add_index_stringl(_10, 415, SL("Unsupported Media Type"), 1);
			add_index_stringl(_10, 416, SL("Requested range not satisfiable"), 1);
//.........这里部分代码省略.........
开发者ID:AlloVince,项目名称:cphalcon,代码行数:101,代码来源:response.zep.c

示例7: PHP_METHOD


//.........这里部分代码省略.........
		args = &args_sub;
		args = &__$null;
	}
	if (!local_param) {
		local = 0;
	} else {
		local = zephir_get_boolval(local_param);
	}
	if (!baseUri) {
		baseUri = &baseUri_sub;
		ZEPHIR_CPY_WRT(baseUri, &__$null);
	} else {
		ZEPHIR_SEPARATE_PARAM(baseUri);
	}


	if (local == 0) {
		_0$$3 = Z_TYPE_P(uri) == IS_STRING;
		if (_0$$3) {
			_1$$3 = zephir_memnstr_str(uri, SL("//"), "phalcon/mvc/url.zep", 103);
			if (!(_1$$3)) {
				_1$$3 = zephir_memnstr_str(uri, SL(":"), "phalcon/mvc/url.zep", 103);
			}
			_0$$3 = _1$$3;
		}
		if (_0$$3) {
			ZEPHIR_INIT_VAR(&_2$$4);
			ZEPHIR_INIT_VAR(&_3$$4);
			ZVAL_STRING(&_3$$4, "#^((//)|([a-z0-9]+://)|([a-z0-9]+:))#i");
			ZEPHIR_INIT_VAR(&_4$$4);
			ZEPHIR_INIT_VAR(&_5$$4);
			ZVAL_STRING(&_5$$4, "#^((//)|([a-z0-9]+://)|([a-z0-9]+:))#i");
			zephir_preg_match(&_4$$4, &_5$$4, uri, &_2$$4, 0, 0 , 0  TSRMLS_CC);
			if (zephir_is_true(&_4$$4)) {
				local = 0;
			} else {
				local = 1;
			}
		} else {
			local = 1;
		}
	}
	if (Z_TYPE_P(baseUri) != IS_STRING) {
		ZEPHIR_CALL_METHOD(baseUri, this_ptr, "getbaseuri", NULL, 0);
		zephir_check_call_status();
	}
	if (Z_TYPE_P(uri) == IS_ARRAY) {
		ZEPHIR_OBS_VAR(&routeName);
		if (!(zephir_array_isset_string_fetch(&routeName, uri, SL("for"), 0))) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_url_exception_ce, "It's necessary to define the route name with the parameter 'for'", "phalcon/mvc/url.zep", 121);
			return;
		}
		zephir_read_property(&_6$$9, this_ptr, SL("router"), PH_NOISY_CC | PH_READONLY);
		ZEPHIR_CPY_WRT(&router, &_6$$9);
		if (Z_TYPE_P(&router) != IS_OBJECT) {
			zephir_read_property(&_7$$11, this_ptr, SL("container"), PH_NOISY_CC | PH_READONLY);
			ZEPHIR_CPY_WRT(&dependencyInjector, &_7$$11);
			if (Z_TYPE_P(&dependencyInjector) != IS_OBJECT) {
				ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_url_exception_ce, "A dependency injector container is required to obtain the 'router' service", "phalcon/mvc/url.zep", 133);
				return;
			}
			ZEPHIR_INIT_VAR(&_9$$11);
			ZVAL_STRING(&_9$$11, "router");
			ZEPHIR_CALL_METHOD(&_8$$11, &dependencyInjector, "getshared", NULL, 0, &_9$$11);
			zephir_check_call_status();
			ZEPHIR_CPY_WRT(&router, &_8$$11);
开发者ID:joeyhub,项目名称:cphalcon,代码行数:67,代码来源:url.zep.c

示例8: PHP_METHOD

/**
 * Detach the listener from the events manager
 *
 * @param string eventType
 * @param object handler
 */
PHP_METHOD(Phalcon_Events_Manager, detach) {

	zephir_fcall_cache_entry *_3 = NULL, *_4 = NULL, *_8 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *eventType_param = NULL, *handler, *priorityQueue = NULL, *newPriorityQueue = NULL, *key = NULL, *data = NULL, *_0, *_1$$5 = NULL, *_2$$5 = NULL, *_5$$6, *_6$$7, *_7$$7;
	zval *eventType = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &eventType_param, &handler);

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


	if (Z_TYPE_P(handler) != IS_OBJECT) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_events_exception_ce, "Event handler must be an Object", "phalcon/events/manager.zep", 99);
		return;
	}
	ZEPHIR_OBS_VAR(priorityQueue);
	_0 = zephir_fetch_nproperty_this(this_ptr, SL("_events"), PH_NOISY_CC);
	if (zephir_array_isset_fetch(&priorityQueue, _0, eventType, 0 TSRMLS_CC)) {
		if (Z_TYPE_P(priorityQueue) == IS_OBJECT) {
			ZEPHIR_INIT_VAR(newPriorityQueue);
			object_init_ex(newPriorityQueue, spl_ce_SplPriorityQueue);
			if (zephir_has_constructor(newPriorityQueue TSRMLS_CC)) {
				ZEPHIR_CALL_METHOD(NULL, newPriorityQueue, "__construct", NULL, 0);
				zephir_check_call_status();
			}
			ZEPHIR_INIT_VAR(_1$$5);
			ZVAL_LONG(_1$$5, 1);
			ZEPHIR_CALL_METHOD(NULL, newPriorityQueue, "setextractflags", NULL, 190, _1$$5);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(_1$$5);
			ZVAL_LONG(_1$$5, 3);
			ZEPHIR_CALL_METHOD(NULL, priorityQueue, "setextractflags", NULL, 0, _1$$5);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, priorityQueue, "top", NULL, 0);
			zephir_check_call_status();
			while (1) {
				ZEPHIR_CALL_METHOD(&_2$$5, priorityQueue, "valid", NULL, 0);
				zephir_check_call_status();
				if (!(zephir_is_true(_2$$5))) {
					break;
				}
				ZEPHIR_CALL_METHOD(&data, priorityQueue, "current", &_3, 0);
				zephir_check_call_status();
				ZEPHIR_CALL_METHOD(NULL, priorityQueue, "next", &_4, 0);
				zephir_check_call_status();
				zephir_array_fetch_string(&_5$$6, data, SL("data"), PH_NOISY | PH_READONLY, "phalcon/events/manager.zep", 116 TSRMLS_CC);
				if (!ZEPHIR_IS_IDENTICAL(_5$$6, handler)) {
					zephir_array_fetch_string(&_6$$7, data, SL("data"), PH_NOISY | PH_READONLY, "phalcon/events/manager.zep", 117 TSRMLS_CC);
					zephir_array_fetch_string(&_7$$7, data, SL("priority"), PH_NOISY | PH_READONLY, "phalcon/events/manager.zep", 117 TSRMLS_CC);
					ZEPHIR_CALL_METHOD(NULL, newPriorityQueue, "insert", &_8, 191, _6$$7, _7$$7);
					zephir_check_call_status();
				}
			}
			zephir_update_property_array(this_ptr, SL("_events"), eventType, newPriorityQueue TSRMLS_CC);
		} else {
			ZEPHIR_CALL_FUNCTION(&key, "array_search", NULL, 192, handler, priorityQueue, ZEPHIR_GLOBAL(global_true));
			zephir_check_call_status();
			if (!ZEPHIR_IS_FALSE_IDENTICAL(key)) {
				zephir_array_unset(&priorityQueue, key, PH_SEPARATE);
			}
			zephir_update_property_array(this_ptr, SL("_events"), eventType, priorityQueue TSRMLS_CC);
		}
	}
	ZEPHIR_MM_RESTORE();

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

示例9: PHP_METHOD

/**
 * @return array
 */
PHP_METHOD(Lynx_Annotation_RegexDocParser, parseAnnotations) {

	zval *_14 = NULL;
	HashTable *_3, *_8;
	HashPosition _2, _7;
	int ZEPHIR_LAST_CALL_STATUS;
	zephir_nts_static zephir_fcall_cache_entry *_1 = NULL, *_11 = NULL;
	zval *docComment, *hasAnnotations = NULL, *matches, *anno = NULL, *annoName = NULL, *val = NULL, *hasParams = NULL, *params, *param = NULL, *rex, *_0 = NULL, *annotations, **_4, *_5, *regex1, *_6, **_9, *_10 = NULL, *_12, *_13 = NULL;

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

	ZEPHIR_INIT_VAR(matches);
	array_init(matches);
	ZEPHIR_INIT_VAR(params);
	array_init(params);
	ZEPHIR_INIT_VAR(rex);
	ZVAL_STRING(rex, "/@(\\w+)(?:\\s*(?:\\(\\s*)?(.*?)(?:\\s*\\))?)??\\s*(?:\n|\\*\\/)/", 1);
	ZEPHIR_INIT_VAR(annotations);
	array_init(annotations);
	ZEPHIR_INIT_VAR(regex1);
	ZVAL_STRING(regex1, "/(\\w+)\\s*=\\s*(\\[[^\\]]*\\]|\"[^\"]*\"|[^,)]*)\\s*(?:,|$)/", 1);


	ZEPHIR_INIT_VAR(val);
	ZVAL_BOOL(val, 1);
	ZEPHIR_INIT_VAR(_0);
	ZVAL_LONG(_0, 2);
	Z_SET_ISREF_P(matches);
	ZEPHIR_CALL_FUNCTION(&hasAnnotations, "preg_match_all", &_1, rex, docComment, matches, _0);
	Z_UNSET_ISREF_P(matches);
	zephir_check_call_status();
	if (!zephir_is_true(hasAnnotations)) {
		array_init(return_value);
		RETURN_MM();
	}
	zephir_is_iterable(matches, &_3, &_2, 0, 0, "lynx/Annotation/RegexDocParser.zep", 67);
	for (
	  ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
	  ; zephir_hash_move_forward_ex(_3, &_2)
	) {
		ZEPHIR_GET_HVALUE(anno, _4);
		ZEPHIR_INIT_NVAR(annoName);
		zephir_array_fetch_long(&_5, anno, 1, PH_NOISY | PH_READONLY, "lynx/Annotation/RegexDocParser.zep", 33 TSRMLS_CC);
		zephir_fast_strtolower(annoName, _5);
		ZEPHIR_INIT_NVAR(val);
		ZVAL_BOOL(val, 1);
		if (zephir_array_isset_long(anno, 2)) {
			zephir_array_fetch_long(&_6, anno, 2, PH_NOISY | PH_READONLY, "lynx/Annotation/RegexDocParser.zep", 38 TSRMLS_CC);
			ZEPHIR_INIT_NVAR(_0);
			ZVAL_LONG(_0, 2);
			Z_SET_ISREF_P(params);
			ZEPHIR_CALL_FUNCTION(&hasParams, "preg_match_all", &_1, regex1, _6, params, _0);
			Z_UNSET_ISREF_P(params);
			zephir_check_call_status();
			if (zephir_is_true(hasParams)) {
				ZEPHIR_INIT_NVAR(val);
				array_init(val);
				zephir_is_iterable(params, &_8, &_7, 0, 0, "lynx/Annotation/RegexDocParser.zep", 46);
				for (
				  ; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS
				  ; zephir_hash_move_forward_ex(_8, &_7)
				) {
					ZEPHIR_GET_HVALUE(param, _9);
					zephir_array_fetch_long(&_12, param, 2, PH_NOISY | PH_READONLY, "lynx/Annotation/RegexDocParser.zep", 43 TSRMLS_CC);
					ZEPHIR_CALL_SELF(&_10, "parsevalue", &_11, _12);
					zephir_check_call_status();
					ZEPHIR_OBS_NVAR(_13);
					zephir_array_fetch_long(&_13, param, 1, PH_NOISY, "lynx/Annotation/RegexDocParser.zep", 43 TSRMLS_CC);
					zephir_array_update_zval(&val, _13, &_10, PH_COPY | PH_SEPARATE);
				}
			} else {
				ZEPHIR_INIT_NVAR(val);
				zephir_array_fetch_long(&_12, anno, 2, PH_NOISY | PH_READONLY, "lynx/Annotation/RegexDocParser.zep", 47 TSRMLS_CC);
				zephir_fast_trim(val, _12, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
				if (ZEPHIR_IS_STRING(val, "")) {
					ZEPHIR_INIT_NVAR(val);
					ZVAL_BOOL(val, 1);
				} else {
					ZEPHIR_CALL_SELF(&_10, "parsevalue", &_11, val);
					zephir_check_call_status();
					ZEPHIR_CPY_WRT(val, _10);
				}
			}
		}
		if (zephir_array_isset(annotations, annoName)) {
			zephir_array_fetch(&_6, annotations, annoName, PH_NOISY | PH_READONLY, "lynx/Annotation/RegexDocParser.zep", 58 TSRMLS_CC);
			if (!(Z_TYPE_P(_6) == IS_ARRAY)) {
				ZEPHIR_INIT_NVAR(_14);
				array_init_size(_14, 2);
				ZEPHIR_OBS_NVAR(_13);
				zephir_array_fetch(&_13, annotations, annoName, PH_NOISY, "lynx/Annotation/RegexDocParser.zep", 59 TSRMLS_CC);
				zephir_array_fast_append(_14, _13);
				zephir_array_update_zval(&annotations, annoName, &_14, PH_COPY | PH_SEPARATE);
			}
			zephir_array_update_multi(&annotations, &val TSRMLS_CC, SL("za"), 2, annoName);
		} else {
//.........这里部分代码省略.........
开发者ID:Green-Cat,项目名称:lynx,代码行数:101,代码来源:regexdocparser.zep.c

示例10: PHP_METHOD

/**
 * Stores cached content into the file backend and stops the frontend
 *
 * @param int|string keyName
 * @param string content
 * @param long lifetime
 * @param boolean stopBuffer
 */
PHP_METHOD(Phalcon_Cache_Backend_Memcache, save) {

	int ZEPHIR_LAST_CALL_STATUS;
	zend_bool stopBuffer;
	zval *keyName = NULL, *content = NULL, *lifetime = NULL, *stopBuffer_param = NULL, *lastKey = NULL, *frontend, *memcache = NULL, *cachedContent = NULL, *preparedContent = NULL, *tmp, *ttl = NULL, *success = NULL, *options, *specialKey, *keys = NULL, *isBuffering = NULL, *_0, *_1 = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 0, 4, &keyName, &content, &lifetime, &stopBuffer_param);

	if (!keyName) {
		keyName = ZEPHIR_GLOBAL(global_null);
	}
	if (!content) {
		content = ZEPHIR_GLOBAL(global_null);
	}
	if (!lifetime) {
		lifetime = ZEPHIR_GLOBAL(global_null);
	}
	if (!stopBuffer_param) {
		stopBuffer = 1;
	} else {
		stopBuffer = zephir_get_boolval(stopBuffer_param);
	}


	if (!(zephir_is_true(keyName))) {
		ZEPHIR_OBS_VAR(lastKey);
		zephir_read_property_this(&lastKey, this_ptr, SL("_lastKey"), PH_NOISY_CC);
	} else {
		_0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC);
		ZEPHIR_INIT_NVAR(lastKey);
		ZEPHIR_CONCAT_VV(lastKey, _0, keyName);
	}
	if (!(zephir_is_true(lastKey))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cache must be started first", "phalcon/cache/backend/memcache.zep", 172);
		return;
	}
	ZEPHIR_OBS_VAR(frontend);
	zephir_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC);
	ZEPHIR_OBS_VAR(memcache);
	zephir_read_property_this(&memcache, this_ptr, SL("_memcache"), PH_NOISY_CC);
	if (Z_TYPE_P(memcache) != IS_OBJECT) {
		ZEPHIR_CALL_METHOD(NULL, this_ptr, "_connect", NULL, 0);
		zephir_check_call_status();
		ZEPHIR_OBS_NVAR(memcache);
		zephir_read_property_this(&memcache, this_ptr, SL("_memcache"), PH_NOISY_CC);
	}
	if (Z_TYPE_P(content) == IS_NULL) {
		ZEPHIR_CALL_METHOD(&cachedContent, frontend, "getcontent", NULL, 0);
		zephir_check_call_status();
	} else {
		ZEPHIR_CPY_WRT(cachedContent, content);
	}
	ZEPHIR_CALL_METHOD(&preparedContent, frontend, "beforestore", NULL, 0, cachedContent);
	zephir_check_call_status();
	if (Z_TYPE_P(lifetime) == IS_NULL) {
		ZEPHIR_OBS_VAR(tmp);
		zephir_read_property_this(&tmp, this_ptr, SL("_lastLifetime"), PH_NOISY_CC);
		if (!(zephir_is_true(tmp))) {
			ZEPHIR_CALL_METHOD(&ttl, frontend, "getlifetime", NULL, 0);
			zephir_check_call_status();
		} else {
			ZEPHIR_CPY_WRT(ttl, tmp);
		}
	} else {
		ZEPHIR_CPY_WRT(ttl, lifetime);
	}
	if (zephir_is_numeric(cachedContent)) {
		ZEPHIR_INIT_VAR(_1);
		ZVAL_LONG(_1, 0);
		ZEPHIR_CALL_METHOD(&success, memcache, "set", NULL, 0, lastKey, cachedContent, _1, ttl);
		zephir_check_call_status();
	} else {
		ZEPHIR_INIT_NVAR(_1);
		ZVAL_LONG(_1, 0);
		ZEPHIR_CALL_METHOD(&success, memcache, "set", NULL, 0, lastKey, preparedContent, _1, ttl);
		zephir_check_call_status();
	}
	if (!(zephir_is_true(success))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Failed storing data in memcached", "phalcon/cache/backend/memcache.zep", 219);
		return;
	}
	ZEPHIR_OBS_VAR(options);
	zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC);
	ZEPHIR_OBS_VAR(specialKey);
	if (!(zephir_array_isset_string_fetch(&specialKey, options, SS("statsKey"), 0 TSRMLS_CC))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/memcache.zep", 225);
		return;
	}
	if (Z_TYPE_P(specialKey) != IS_NULL) {
		ZEPHIR_CALL_METHOD(&keys, memcache, "get", NULL, 0, specialKey);
		zephir_check_call_status();
//.........这里部分代码省略.........
开发者ID:brainformatik,项目名称:cphalcon,代码行数:101,代码来源:memcache.zep.c

示例11: PHP_METHOD

/**
 * Executes the validation
 */
PHP_METHOD(Phalcon_Validation_Validator_InclusionIn, validate) {

	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval *validation, validation_sub, *field, field_sub, value, domain, message, label, replacePairs, strict, fieldDomain, code, _0, _1, _4, _2$$6, _3$$7, _5$$9, _6$$9, _7$$9;
	zval *this_ptr = getThis();

	ZVAL_UNDEF(&validation_sub);
	ZVAL_UNDEF(&field_sub);
	ZVAL_UNDEF(&value);
	ZVAL_UNDEF(&domain);
	ZVAL_UNDEF(&message);
	ZVAL_UNDEF(&label);
	ZVAL_UNDEF(&replacePairs);
	ZVAL_UNDEF(&strict);
	ZVAL_UNDEF(&fieldDomain);
	ZVAL_UNDEF(&code);
	ZVAL_UNDEF(&_0);
	ZVAL_UNDEF(&_1);
	ZVAL_UNDEF(&_4);
	ZVAL_UNDEF(&_2$$6);
	ZVAL_UNDEF(&_3$$7);
	ZVAL_UNDEF(&_5$$9);
	ZVAL_UNDEF(&_6$$9);
	ZVAL_UNDEF(&_7$$9);

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &validation, &field);



	ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(&_0);
	ZVAL_STRING(&_0, "domain");
	ZEPHIR_CALL_METHOD(&domain, this_ptr, "getoption", NULL, 0, &_0);
	zephir_check_call_status();
	ZEPHIR_OBS_VAR(&fieldDomain);
	if (zephir_array_isset_fetch(&fieldDomain, &domain, field, 0 TSRMLS_CC)) {
		if (Z_TYPE_P(&fieldDomain) == IS_ARRAY) {
			ZEPHIR_CPY_WRT(&domain, &fieldDomain);
		}
	}
	if (Z_TYPE_P(&domain) != IS_ARRAY) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Option 'domain' must be an array", "phalcon/validation/validator/inclusionin.zep", 81);
		return;
	}
	ZEPHIR_INIT_VAR(&strict);
	ZVAL_BOOL(&strict, 0);
	ZEPHIR_INIT_NVAR(&_0);
	ZVAL_STRING(&_0, "strict");
	ZEPHIR_CALL_METHOD(&_1, this_ptr, "hasoption", NULL, 0, &_0);
	zephir_check_call_status();
	if (zephir_is_true(&_1)) {
		ZEPHIR_INIT_VAR(&_2$$6);
		ZVAL_STRING(&_2$$6, "strict");
		ZEPHIR_CALL_METHOD(&strict, this_ptr, "getoption", NULL, 0, &_2$$6);
		zephir_check_call_status();
		if (Z_TYPE_P(&strict) == IS_ARRAY) {
			zephir_array_fetch(&_3$$7, &strict, field, PH_NOISY | PH_READONLY, "phalcon/validation/validator/inclusionin.zep", 89 TSRMLS_CC);
			ZEPHIR_CPY_WRT(&strict, &_3$$7);
		}
		if (((Z_TYPE_P(&strict) == IS_TRUE || Z_TYPE_P(&strict) == IS_FALSE) != 1)) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Option 'strict' must be a bool", "phalcon/validation/validator/inclusionin.zep", 93);
			return;
		}
	}
	ZEPHIR_CALL_FUNCTION(&_4, "in_array", NULL, 455, &value, &domain, &strict);
	zephir_check_call_status();
	if (!(zephir_is_true(&_4))) {
		ZEPHIR_CALL_METHOD(&label, this_ptr, "preparelabel", NULL, 0, validation, field);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(&_5$$9);
		ZVAL_STRING(&_5$$9, "InclusionIn");
		ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, &_5$$9);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(&code, this_ptr, "preparecode", NULL, 0, field);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(&replacePairs);
		zephir_create_array(&replacePairs, 2, 0 TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
		ZEPHIR_INIT_NVAR(&_5$$9);
		zephir_fast_join_str(&_5$$9, SL(", "), &domain TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":domain"), &_5$$9, PH_COPY | PH_SEPARATE);
		ZEPHIR_INIT_NVAR(&_5$$9);
		object_init_ex(&_5$$9, phalcon_messages_message_ce);
		ZEPHIR_CALL_FUNCTION(&_6$$9, "strtr", NULL, 48, &message, &replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(&_7$$9);
		ZVAL_STRING(&_7$$9, "InclusionIn");
		ZEPHIR_CALL_METHOD(NULL, &_5$$9, "__construct", NULL, 300, &_6$$9, field, &_7$$9, &code);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, &_5$$9);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	RETURN_MM_BOOL(1);

//.........这里部分代码省略.........
开发者ID:niden,项目名称:cphalcon,代码行数:101,代码来源:inclusionin.zep.c

示例12: PHP_METHOD

/**
 * Phalcon\Config\Adapter\Yaml constructor
 *
 * @throws \Phalcon\Config\Exception
 */
PHP_METHOD(Phalcon_Config_Adapter_Yaml, __construct) {

	zephir_fcall_cache_entry *_5 = NULL;
	zephir_nts_static zephir_fcall_cache_entry *_2 = NULL, *_7 = NULL, *_8 = NULL;
	int ndocs = 0, ZEPHIR_LAST_CALL_STATUS;
	zval *callbacks = NULL;
	zval *filePath_param = NULL, *callbacks_param = NULL, *yamlConfig = NULL, _0, *_1 = NULL, *_3 = NULL, *_4 = NULL, *_6;
	zval *filePath = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &filePath_param, &callbacks_param);

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

	if (likely(Z_TYPE_P(filePath_param) == IS_STRING)) {
		zephir_get_strval(filePath, filePath_param);
	} else {
		ZEPHIR_INIT_VAR(filePath);
		ZVAL_EMPTY_STRING(filePath);
	}
	if (!callbacks_param) {
	ZEPHIR_INIT_VAR(callbacks);
	array_init(callbacks);
	} else {
	callbacks = callbacks_param;

	}


	ZEPHIR_SINIT_VAR(_0);
	ZVAL_STRING(&_0, "yaml", 0);
	ZEPHIR_CALL_FUNCTION(&_1, "extension_loaded", &_2, &_0);
	zephir_check_call_status();
	if (!(zephir_is_true(_1))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_config_exception_ce, "Yaml extension not loaded", "phalcon/config/adapter/yaml.zep", 62);
		return;
	}
	if (!ZEPHIR_IS_STRING_IDENTICAL(callbacks, "")) {
		ZEPHIR_INIT_VAR(_3);
		ZVAL_LONG(_3, 0);
		ZEPHIR_INIT_VAR(_4);
		ZVAL_LONG(_4, ndocs);
		Z_SET_ISREF_P(_4);
		ZEPHIR_CALL_FUNCTION(&yamlConfig, "yaml_parse_file", &_5, filePath, _3, _4, callbacks);
		Z_UNSET_ISREF_P(_4);
		zephir_check_call_status();
	} else {
		ZEPHIR_CALL_FUNCTION(&yamlConfig, "yaml_parse_file", &_5, filePath);
		zephir_check_call_status();
	}
	if (ZEPHIR_IS_FALSE_IDENTICAL(yamlConfig)) {
		ZEPHIR_INIT_NVAR(_3);
		object_init_ex(_3, phalcon_config_exception_ce);
		ZEPHIR_INIT_NVAR(_4);
		zephir_basename(_4, filePath TSRMLS_CC);
		ZEPHIR_INIT_VAR(_6);
		ZEPHIR_CONCAT_SVS(_6, "Configuration file ", _4, " can't be loaded");
		ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_7, _6);
		zephir_check_call_status();
		zephir_throw_exception_debug(_3, "phalcon/config/adapter/yaml.zep", 72 TSRMLS_CC);
		ZEPHIR_MM_RESTORE();
		return;
	}
	ZEPHIR_CALL_PARENT(NULL, phalcon_config_adapter_yaml_ce, this_ptr, "__construct", &_8, yamlConfig);
	zephir_check_call_status();
	ZEPHIR_MM_RESTORE();

}
开发者ID:flaver12,项目名称:cphalcon,代码行数:76,代码来源:yaml.zep.c

示例13: PHP_METHOD

/**
 * Executes the validation
 */
PHP_METHOD(Phalcon_Validation_Validator_File, validate) {

	zend_bool _1, _2, _3, _5, _6, _11, _12, _14, _20, _21, _50, _57$$16, _64$$21;
	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval *field = NULL;
	zval *validation, *field_param = NULL, *_SERVER, *_POST, *_FILES, *value = NULL, *message = NULL, *label = NULL, *replacePairs = NULL, *types = NULL, *byteUnits = NULL, *unit = NULL, *maxSize = NULL, *matches = NULL, *bytes = NULL, *mime = NULL, *tmp = NULL, *width = NULL, *height = NULL, *minResolution = NULL, *maxResolution = NULL, *minWidth = NULL, *maxWidth = NULL, *minHeight = NULL, *maxHeight = NULL, *fieldTypes = NULL, *code = NULL, *minResolutionArray = NULL, *maxResolutionArray = NULL, *_0, *_4, *_7, *_13, *_15, *_16 = NULL, *_25 = NULL, *_26 = NULL, *_42 = NULL, *_49 = NULL, *_51 = NULL, *_8$$3 = NULL, *_9$$3 = NULL, *_10$$3 = NULL, *_17$$4 = NULL, *_18$$4 = NULL, *_19$$4 = NULL, *_22$$5 = NULL, *_23$$5 = NULL, *_24$$5 = NULL, *_27$$6 = NULL, *_29$$6, *_30$$6, *_31$$6, *_32$$6, *_33$$6 = NULL, *_34$$6, *_35$$6, _36$$6, *_37$$6, *_38$$6 = NULL, *_28$$7, *_39$$9 = NULL, *_40$$9 = NULL, *_41$$9 = NULL, *_43$$10, _44$$13, *_45$$13, *_46$$15 = NULL, *_47$$15 = NULL, *_48$$15 = NULL, *_52$$16, *_53$$16 = NULL, *_54$$16 = NULL, *_61$$16 = NULL, *_55$$17, *_56$$18, *_58$$20 = NULL, *_59$$20 = NULL, *_60$$20 = NULL, *_62$$21, *_63$$22, *_65$$23 = NULL, *_66$$23 = NULL, *_67$$23 = NULL;

	ZEPHIR_MM_GROW();
	zephir_get_global(&_FILES, SS("_FILES") TSRMLS_CC);
	zephir_get_global(&_POST, SS("_POST") TSRMLS_CC);
	zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC);
	zephir_fetch_params(1, 2, 0, &validation, &field_param);

	if (UNEXPECTED(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (EXPECTED(Z_TYPE_P(field_param) == IS_STRING)) {
		zephir_get_strval(field, field_param);
	} else {
		ZEPHIR_INIT_VAR(field);
		ZVAL_EMPTY_STRING(field);
	}


	ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&label, this_ptr, "preparelabel", NULL, 0, validation, field);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&code, this_ptr, "preparecode", NULL, 0, field);
	zephir_check_call_status();
	zephir_array_fetch_string(&_0, _SERVER, SL("REQUEST_METHOD"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 112 TSRMLS_CC);
	_1 = ZEPHIR_IS_STRING(_0, "POST");
	if (_1) {
		_1 = ZEPHIR_IS_EMPTY(_POST);
	}
	_2 = _1;
	if (_2) {
		_2 = ZEPHIR_IS_EMPTY(_FILES);
	}
	_3 = _2;
	if (_3) {
		zephir_array_fetch_string(&_4, _SERVER, SL("CONTENT_LENGTH"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 112 TSRMLS_CC);
		_3 = ZEPHIR_GT_LONG(_4, 0);
	}
	_5 = _3;
	if (!(_5)) {
		_6 = zephir_array_isset_string(value, SS("error"));
		if (_6) {
			zephir_array_fetch_string(&_7, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 112 TSRMLS_CC);
			_6 = ZEPHIR_IS_LONG_IDENTICAL(_7, 1);
		}
		_5 = _6;
	}
	if (_5) {
		ZEPHIR_INIT_VAR(_8$$3);
		ZVAL_STRING(_8$$3, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_INIT_VAR(_9$$3);
		ZVAL_STRING(_9$$3, "messageIniSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&message, this_ptr, "preparemessage", NULL, 0, validation, field, _8$$3, _9$$3);
		zephir_check_temp_parameter(_8$$3);
		zephir_check_temp_parameter(_9$$3);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(replacePairs);
		zephir_create_array(replacePairs, 1, 0 TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
		ZEPHIR_INIT_NVAR(_8$$3);
		object_init_ex(_8$$3, phalcon_validation_message_ce);
		ZEPHIR_CALL_FUNCTION(&_10$$3, "strtr", NULL, 27, message, replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(_9$$3);
		ZVAL_STRING(_9$$3, "FileIniSize", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _8$$3, "__construct", NULL, 470, _10$$3, field, _9$$3, code);
		zephir_check_temp_parameter(_9$$3);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _8$$3);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	_11 = !(zephir_array_isset_string(value, SS("error")));
	if (!(_11)) {
		_11 = !(zephir_array_isset_string(value, SS("tmp_name")));
	}
	_12 = _11;
	if (!(_12)) {
		zephir_array_fetch_string(&_13, value, SL("error"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 128 TSRMLS_CC);
		_12 = !ZEPHIR_IS_LONG_IDENTICAL(_13, 0);
	}
	_14 = _12;
	if (!(_14)) {
		zephir_array_fetch_string(&_15, value, SL("tmp_name"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/file.zep", 128 TSRMLS_CC);
		ZEPHIR_CALL_FUNCTION(&_16, "is_uploaded_file", NULL, 247, _15);
		zephir_check_call_status();
		_14 = !zephir_is_true(_16);
	}
	if (_14) {
		ZEPHIR_INIT_VAR(_17$$4);
//.........这里部分代码省略.........
开发者ID:zamronypj,项目名称:cphalcon,代码行数:101,代码来源:file.zep.c

示例14: PHP_METHOD

PHP_METHOD(Test_Quantum, harmos) {

	zend_bool _13, _16, _32, _35;
	zval *_10 = NULL, *_11 = NULL, *_12 = NULL;
	zephir_fcall_cache_entry *_4 = NULL, *_6 = NULL, *_8 = NULL, *_36 = NULL;
	int i, j, n, ZEPHIR_LAST_CALL_STATUS, _14, _15, _17, _18, _33, _34;
	zval *x_param = NULL, *psr, *psi, *p2, *v, *paramater, *fp = NULL, *tmp, *_0 = NULL, _1 = zval_used_for_init, _2 = zval_used_for_init, *_3 = NULL, *_5 = NULL, *_7 = NULL, *_9 = NULL, *_19, *_20, *_21, *_22, *_23, *_24, *_25, *_26, _27 = zval_used_for_init, *_28, *_29, *_30, *_31;
	double x, dt, dx, k0, item_psr, item_psi;

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

	x = zephir_get_doubleval(x_param);


	dx = 0.02;
	k0 = (3.0 * 3.14159265358979323846);
	dt = zephir_safe_div_double_long((dx * dx), 4.0 TSRMLS_CC);
	ZEPHIR_INIT_VAR(paramater);
	zephir_create_array(paramater, 4, 0 TSRMLS_CC);
	ZEPHIR_INIT_VAR(_0);
	ZVAL_DOUBLE(_0, dx);
	zephir_array_fast_append(paramater, _0);
	ZEPHIR_INIT_NVAR(_0);
	ZVAL_DOUBLE(_0, k0);
	zephir_array_fast_append(paramater, _0);
	ZEPHIR_INIT_NVAR(_0);
	ZVAL_DOUBLE(_0, dt);
	zephir_array_fast_append(paramater, _0);
	ZEPHIR_INIT_NVAR(_0);
	ZVAL_DOUBLE(_0, x);
	zephir_array_fast_append(paramater, _0);
	i = 0;
	ZEPHIR_INIT_VAR(psr);
	array_init(psr);
	ZEPHIR_INIT_VAR(psi);
	array_init(psi);
	ZEPHIR_INIT_VAR(p2);
	array_init(p2);
	ZEPHIR_INIT_VAR(v);
	array_init(v);
	ZEPHIR_SINIT_VAR(_1);
	ZVAL_STRING(&_1, "harmos.txt", 0);
	ZEPHIR_SINIT_VAR(_2);
	ZVAL_STRING(&_2, "w", 0);
	ZEPHIR_CALL_FUNCTION(&fp, "fopen", NULL, 30, &_1, &_2);
	zephir_check_call_status();
	if (!(zephir_is_true(fp))) {
		RETURN_MM_LONG(1);
	}
	while (1) {
		if (!(i <= 751)) {
			break;
		}
		ZEPHIR_SINIT_NVAR(_1);
		ZVAL_DOUBLE(&_1, (k0 * x));
		ZEPHIR_CALL_FUNCTION(&_3, "sin", &_4, 10, &_1);
		zephir_check_call_status();
		ZEPHIR_SINIT_NVAR(_1);
		ZVAL_DOUBLE(&_1, ((x * x) * 2.0));
		ZEPHIR_CALL_FUNCTION(&_5, "exp", &_6, 1, &_1);
		zephir_check_call_status();
		ZEPHIR_INIT_LNVAR(_7);
		div_function(_7, _3, _5 TSRMLS_CC);
		item_psi = zephir_get_numberval(_7);
		ZEPHIR_SINIT_NVAR(_1);
		ZVAL_DOUBLE(&_1, (k0 * x));
		ZEPHIR_CALL_FUNCTION(&_3, "cos", &_8, 11, &_1);
		zephir_check_call_status();
		ZEPHIR_SINIT_NVAR(_1);
		ZVAL_DOUBLE(&_1, ((x * x) * 2.0));
		ZEPHIR_CALL_FUNCTION(&_5, "exp", &_6, 1, &_1);
		zephir_check_call_status();
		ZEPHIR_INIT_LNVAR(_9);
		div_function(_9, _3, _5 TSRMLS_CC);
		item_psr = zephir_get_numberval(_9);
		ZEPHIR_INIT_NVAR(_10);
		zephir_create_array(_10, 1, 0 TSRMLS_CC);
		ZEPHIR_INIT_NVAR(_0);
		ZVAL_DOUBLE(_0, item_psr);
		zephir_array_fast_append(_10, _0);
		zephir_array_update_long(&psr, i, &_10, PH_COPY | PH_SEPARATE, "test/quantum.zep", 39);
		ZEPHIR_INIT_NVAR(_11);
		zephir_create_array(_11, 1, 0 TSRMLS_CC);
		ZEPHIR_INIT_NVAR(_0);
		ZVAL_DOUBLE(_0, item_psi);
		zephir_array_fast_append(_11, _0);
		zephir_array_update_long(&psi, i, &_11, PH_COPY | PH_SEPARATE, "test/quantum.zep", 40);
		ZEPHIR_INIT_NVAR(_12);
		zephir_create_array(_12, 1, 0 TSRMLS_CC);
		ZEPHIR_INIT_NVAR(_0);
		ZVAL_DOUBLE(_0, (double) ((double) (5.0 * x) * x));
		zephir_array_fast_append(_12, _0);
		zephir_array_update_long(&v, i, &_12, PH_COPY | PH_SEPARATE, "test/quantum.zep", 41);
		x = (x + dx);
		i++;
	}
	i = 1;
	j = 1;
	ZEPHIR_INIT_VAR(tmp);
//.........这里部分代码省略.........
开发者ID:alessiot25,项目名称:zephir,代码行数:101,代码来源:quantum.zep.c

示例15: PHP_METHOD

/**
 * Executes the validation
 */
PHP_METHOD(Phalcon_Validation_Validator_CreditCard, validate) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *field = NULL;
	zval *validation, *field_param = NULL, *message = NULL, *label = NULL, *replacePairs = NULL, *value = NULL, *valid = NULL, *_0$$3 = NULL, *_2$$3 = NULL, *_3$$3, *_1$$5;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &validation, &field_param);

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


	ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&valid, this_ptr, "verifybyluhnalgorithm", NULL, 438, value);
	zephir_check_call_status();
	if (!(zephir_is_true(valid))) {
		ZEPHIR_INIT_VAR(_0$$3);
		ZVAL_STRING(_0$$3, "label", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&label, this_ptr, "getoption", NULL, 0, _0$$3);
		zephir_check_temp_parameter(_0$$3);
		zephir_check_call_status();
		if (ZEPHIR_IS_EMPTY(label)) {
			ZEPHIR_CALL_METHOD(&label, validation, "getlabel", NULL, 0, field);
			zephir_check_call_status();
		}
		ZEPHIR_INIT_NVAR(_0$$3);
		ZVAL_STRING(_0$$3, "message", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _0$$3);
		zephir_check_temp_parameter(_0$$3);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(replacePairs);
		zephir_create_array(replacePairs, 1, 0 TSRMLS_CC);
		zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
		if (ZEPHIR_IS_EMPTY(message)) {
			ZEPHIR_INIT_VAR(_1$$5);
			ZVAL_STRING(_1$$5, "CreditCard", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _1$$5);
			zephir_check_temp_parameter(_1$$5);
			zephir_check_call_status();
		}
		ZEPHIR_INIT_NVAR(_0$$3);
		object_init_ex(_0$$3, phalcon_validation_message_ce);
		ZEPHIR_CALL_FUNCTION(&_2$$3, "strtr", NULL, 55, message, replacePairs);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_3$$3);
		ZVAL_STRING(_3$$3, "CreditCard", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _0$$3, "__construct", NULL, 434, _2$$3, field, _3$$3);
		zephir_check_temp_parameter(_3$$3);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _0$$3);
		zephir_check_call_status();
		RETURN_MM_BOOL(0);
	}
	RETURN_MM_BOOL(1);

}
开发者ID:Dmitry-Kucher,项目名称:cphalcon,代码行数:69,代码来源:creditcard.zep.c


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