Пример #1
0
/**
 * Reconfigure the route adding a new pattern and a set of paths
 */
PHP_METHOD(Phalcon_Mvc_Router_Route, reConfigure) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *pattern_param = NULL, *paths = NULL, *routePaths = NULL, *pcrePattern = NULL, *compiledPattern = NULL, *extracted = NULL, *_0, *_1;
	zval *pattern = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &pattern_param, &paths);

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


	ZEPHIR_CALL_SELF(&routePaths, "getroutepaths", NULL, 0, paths);
	zephir_check_call_status();
	if (!(zephir_start_with_str(pattern, SL("#")))) {
		if (zephir_memnstr_str(pattern, SL("{"), "phalcon/mvc/router/route.zep", 295)) {
			ZEPHIR_CALL_METHOD(&extracted, this_ptr, "extractnamedparams", NULL, 0, pattern);
			zephir_check_call_status();
			ZEPHIR_OBS_VAR(pcrePattern);
			zephir_array_fetch_long(&pcrePattern, extracted, 0, PH_NOISY, "phalcon/mvc/router/route.zep", 300 TSRMLS_CC);
			ZEPHIR_INIT_VAR(_0);
			zephir_array_fetch_long(&_1, extracted, 1, PH_NOISY | PH_READONLY, "phalcon/mvc/router/route.zep", 301 TSRMLS_CC);
			zephir_fast_array_merge(_0, &(routePaths), &(_1) TSRMLS_CC);
			ZEPHIR_CPY_WRT(routePaths, _0);
		} else {
			ZEPHIR_CPY_WRT(pcrePattern, pattern);
		}
		ZEPHIR_CALL_METHOD(&compiledPattern, this_ptr, "compilepattern", NULL, 0, pcrePattern);
		zephir_check_call_status();
	} else {
		ZEPHIR_CPY_WRT(compiledPattern, pattern);
	}
	zephir_update_property_this(this_ptr, SL("_pattern"), pattern TSRMLS_CC);
	zephir_update_property_this(this_ptr, SL("_compiledPattern"), compiledPattern TSRMLS_CC);
	zephir_update_property_this(this_ptr, SL("_paths"), routePaths TSRMLS_CC);
	ZEPHIR_MM_RESTORE();

}
Пример #2
0
PHP_METHOD(Xpl_Collection_ScalarSet, add) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *value, *_0 = NULL;

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



	ZEPHIR_CALL_SELF(&_0, "cast", NULL, 0, value);
	zephir_check_call_status();
	ZEPHIR_CALL_PARENT(NULL, xpl_collection_scalarset_ce, this_ptr, "attach", NULL, 0, _0);
	zephir_check_call_status();
	ZEPHIR_MM_RESTORE();

}
Пример #3
0
PHP_METHOD(Xpl_Collection_ScalarSet, contains) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *value, *_0 = NULL;

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



	ZEPHIR_CALL_SELF(&_0, "cast", NULL, 0, value);
	zephir_check_call_status();
	ZEPHIR_RETURN_CALL_PARENT(xpl_collection_scalarset_ce, this_ptr, "contains", NULL, 0, _0);
	zephir_check_call_status();
	RETURN_MM();

}
Пример #4
0
/**
 * getMemoryLimit allow to get the memory limit in octet
 *
 * @return int the memory limit value in octet
 */
PHP_METHOD(Phady_Util_Tools, getMemoryLimit) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *memory_limit = NULL, *getOctect = NULL, _0;

	ZEPHIR_MM_GROW();

	ZEPHIR_SINIT_VAR(_0);
	ZVAL_STRING(&_0, "memory_limit", 0);
	ZEPHIR_CALL_FUNCTION(&memory_limit, "ini_get", NULL, 155, &_0);
	zephir_check_call_status();
	ZEPHIR_CALL_FUNCTION(NULL, "print_r", NULL, 103, memory_limit);
	zephir_check_call_status();
	ZEPHIR_CALL_SELF(&getOctect, "getoctets", NULL, 0, memory_limit);
	zephir_check_call_status();
	RETURN_CCTOR(getOctect);

}
Пример #5
0
PHP_METHOD(Test_Bench_Foo, call_static) {

	zend_bool _0;
	int ZEPHIR_LAST_CALL_STATUS, _1;
	zephir_fcall_cache_entry *_3 = NULL;
	zval *n, n_sub, i, _2;
		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(&n_sub);
	ZVAL_UNDEF(&i);
	ZVAL_UNDEF(&_2);

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



	ZEPHIR_CPY_WRT(&_2, n);
	_1 = 1;
	_0 = 0;
	if (ZEPHIR_GE_LONG(&_2, _1)) {
		while (1) {
			if (_0) {
				_1++;
				if (!(ZEPHIR_GE_LONG(&_2, _1))) {
					break;
				}
			} else {
				_0 = 1;
			}
			ZEPHIR_INIT_NVAR(&i);
			ZVAL_LONG(&i, _1);
			ZEPHIR_CALL_SELF(NULL, "f", &_3, 0);
			zephir_check_call_status();
		}
	}
	ZEPHIR_MM_RESTORE();

}
Пример #6
0
PHP_METHOD(Yb_Std, renderScript) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *data = NULL;
	zval *path_param = NULL, *data_param = NULL, *ex = NULL;
	zval *path = NULL;

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

	zephir_get_strval(path, path_param);
	zephir_get_arrval(data, data_param);


	ZEPHIR_CALL_FUNCTION(NULL, "ob_start", NULL, 23);
	zephir_check_call_status();
	ZEPHIR_CALL_FUNCTION(NULL, "ob_implicit_flush", NULL, 24, ZEPHIR_GLOBAL(global_false));
	zephir_check_call_status();

	/* try_start_1: */

		ZEPHIR_CALL_SELF(NULL, "outputscript", NULL, 0, path, data);
		zephir_check_call_status_or_jump(try_end_1);
		ZEPHIR_RETURN_CALL_FUNCTION("ob_get_clean", NULL, 25);
		zephir_check_call_status_or_jump(try_end_1);
		RETURN_MM();

	try_end_1:

	if (EG(exception)) {
		ZEPHIR_CPY_WRT(ex, EG(exception));
		if (zephir_instance_of_ev(ex, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) {
			zend_clear_exception(TSRMLS_C);
			ZEPHIR_CALL_FUNCTION(NULL, "ob_end_clean", NULL, 26);
			zephir_check_call_status();
			zephir_throw_exception_debug(ex, "yb/std.zep", 442 TSRMLS_CC);
			ZEPHIR_MM_RESTORE();
			return;
		}
	}
	RETURN_MM_STRING("", 1);

}
Пример #7
0
PHP_METHOD(Cake_Core_Configure, check) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *_var_param = NULL, *_0 = NULL;
	zval *_var = NULL;

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

	zephir_get_strval(_var, _var_param);


	if (ZEPHIR_IS_EMPTY(_var)) {
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_CALL_SELF(&_0, "read", NULL, 0, _var);
	zephir_check_call_status();
	RETURN_MM_BOOL(Z_TYPE_P(_0) != IS_NULL);

}
Пример #8
0
PHP_METHOD(Xpl_Collection_ScalarSet, remove) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *value, *inf = NULL, *_0 = NULL;

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

	if (!inf) {
		inf = ZEPHIR_GLOBAL(global_null);
	}


	ZEPHIR_CALL_SELF(&_0, "cast", NULL, 0, value);
	zephir_check_call_status();
	ZEPHIR_CALL_PARENT(NULL, xpl_collection_scalarset_ce, this_ptr, "detach", NULL, 0, _0);
	zephir_check_call_status();
	ZEPHIR_MM_RESTORE();

}
Пример #9
0
/**
 * Retrieve singleton instance
 *
 * @return Yaf_Session
 */
PHP_METHOD(Yaf_Session, getInstance) {

    int ZEPHIR_LAST_CALL_STATUS;
    zval *_0, *_1, *_2;

    ZEPHIR_MM_GROW();

    _0 = zephir_fetch_static_property_ce(yaf_session_ce, SL("_instance") TSRMLS_CC);
    if (Z_TYPE_P(_0) == IS_NULL) {
        ZEPHIR_INIT_VAR(_1);
        object_init_ex(_1, yaf_session_ce);
        ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL);
        zephir_check_call_status();
        zephir_update_static_property_ce(yaf_session_ce, SL("_instance"), &_1 TSRMLS_CC);
        ZEPHIR_CALL_SELF(NULL, "start", NULL);
        zephir_check_call_status();
    }
    _2 = zephir_fetch_static_property_ce(yaf_session_ce, SL("_instance") TSRMLS_CC);
    RETURN_CTOR(_2);

}
Пример #10
0
PHP_METHOD(Cake_Core_Configure, load) {

	zephir_fcall_cache_entry *_1 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zend_bool merge;
	zval *key, *config = NULL, *merge_param = NULL, *engine = NULL, *values = NULL, *_0 = NULL, *_2;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 2, &key, &config, &merge_param);

	if (!config) {
		ZEPHIR_INIT_VAR(config);
		ZVAL_STRING(config, "default", 1);
	}
	if (!merge_param) {
		merge = 1;
	} else {
		merge = zephir_get_boolval(merge_param);
	}


	ZEPHIR_CALL_SELF(&engine, "_getengine", NULL, 0, config);
	zephir_check_call_status();
	if (!(zephir_is_true(engine))) {
		RETURN_MM_BOOL(0);
	}
	ZEPHIR_CALL_METHOD(&values, engine, "read", NULL, 0, key);
	zephir_check_call_status();
	if (merge) {
		_2 = zephir_fetch_static_property_ce(cake_core_configure_ce, SL("_values") TSRMLS_CC);
		ZEPHIR_CALL_CE_STATIC(&_0, cake_utility_hash_ce, "merge", &_1, 6, _2, values);
		zephir_check_call_status();
		ZEPHIR_CPY_WRT(values, _0);
	}
	ZEPHIR_RETURN_CALL_SELF("write", NULL, 0, values);
	zephir_check_call_status();
	RETURN_MM();

}
Пример #11
0
/**
 * Starts the session
 */
PHP_METHOD(Yaf_Session, start) {

    int ZEPHIR_LAST_CALL_STATUS;
    zval *session = NULL, *_0, *_SESSION;

    ZEPHIR_MM_GROW();

    ZEPHIR_CALL_SELF(&session, "getinstance", NULL);
    zephir_check_call_status();
    ZEPHIR_OBS_VAR(_0);
    zephir_read_property(&_0, session, SL("started"), PH_NOISY_CC);
    if (ZEPHIR_IS_TRUE(_0)) {
        RETURN_MM_BOOL(1);
    } else {
        ZEPHIR_CALL_FUNCTION(NULL, "session_start", NULL);
        zephir_check_call_status();
        zephir_update_property_zval(session, SL("started"), (1) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
        zephir_get_global(&_SESSION, SS("_SESSION") TSRMLS_CC);
        zephir_update_property_zval(session, SL("session"), _SESSION TSRMLS_CC);
    }
    ZEPHIR_MM_RESTORE();

}
Пример #12
0
PHP_METHOD(BeeFramework_Input, post) {

	int ZEPHIR_LAST_CALL_STATUS;
	zend_bool remove_xss;
	zval *index = NULL, *remove_xss_param = NULL, *_POST, *_0 = NULL, *_1;

	ZEPHIR_MM_GROW();
	zephir_get_global(&_POST, SS("_POST") TSRMLS_CC);
	zephir_fetch_params(1, 0, 2, &index, &remove_xss_param);

	if (!index) {
		ZEPHIR_INIT_VAR(index);
		ZVAL_STRING(index, "", 1);
	}
	if (!remove_xss_param) {
		remove_xss = 1;
	} else {
		remove_xss = zephir_get_boolval(remove_xss_param);
	}


	ZEPHIR_INIT_VAR(_0);
	if (ZEPHIR_IS_EMPTY(index)) {
		ZEPHIR_CPY_WRT(_0, _POST);
	} else {
		ZEPHIR_INIT_VAR(_1);
		if (remove_xss) {
			ZVAL_BOOL(_1, 1);
		} else {
			ZVAL_BOOL(_1, 0);
		}
		ZEPHIR_CALL_SELF(&_0, "_fetch_from_array", NULL, 0, _POST, index, _1);
		zephir_check_call_status();
	}
	RETURN_CCTOR(_0);

}
Пример #13
0
PHP_METHOD(Test_Scall, testCall18) {

	zephir_fcall_cache_entry *_4 = NULL;
	int _1, ZEPHIR_LAST_CALL_STATUS;
	zend_bool _0;
	zval *k_param = NULL, *p, *_3 = NULL;
	long k, i, j = 0, _2;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &k_param, &p);

	k = zephir_get_intval(k_param);


	_2 = k;
	_1 = 1;
	_0 = 0;
	if (_1 <= _2) {
		while (1) {
			if (_0) {
				_1++;
				if (!(_1 <= _2)) {
					break;
				}
			} else {
				_0 = 1;
			}
			i = _1;
			ZEPHIR_CALL_SELF(&_3, "testmethod16", &_4, p, p);
			zephir_check_call_status();
			j += zephir_get_numberval(_3);
		}
	}
	RETURN_MM_LONG(j);

}
PHP_METHOD(Monapi_Image_ResizeOptions_Auto, getSizeByAuto) {

	zval *width_param = NULL, *height_param = NULL, *original_width_param = NULL, *original_height_param = NULL, *optimal_width = NULL, *optimal_height = NULL, *_0 = NULL, *_1 = NULL, *_2 = NULL, *sizes;
	int width, height, original_width, original_height, ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 4, 0, &width_param, &height_param, &original_width_param, &original_height_param);

	width = zephir_get_intval(width_param);
	height = zephir_get_intval(height_param);
	original_width = zephir_get_intval(original_width_param);
	original_height = zephir_get_intval(original_height_param);


	if (original_height < original_width) {
		ZEPHIR_INIT_VAR(optimal_width);
		ZVAL_LONG(optimal_width, width);
		ZEPHIR_INIT_VAR(_0);
		ZVAL_LONG(_0, original_width);
		ZEPHIR_INIT_VAR(_1);
		ZVAL_LONG(_1, original_height);
		ZEPHIR_CALL_SELF(&optimal_height, "getsizebyfixedwidth", NULL, optimal_width, _0, _1);
		zephir_check_call_status();
		if (ZEPHIR_GT_LONG(optimal_height, height)) {
			ZEPHIR_INIT_NVAR(optimal_height);
			ZVAL_LONG(optimal_height, height);
			ZEPHIR_INIT_NVAR(_0);
			ZVAL_LONG(_0, original_width);
			ZEPHIR_INIT_NVAR(_1);
			ZVAL_LONG(_1, original_height);
			ZEPHIR_CALL_SELF(&optimal_width, "getsizebyfixedheight", NULL, optimal_height, _0, _1);
			zephir_check_call_status();
		}
	} else if (original_height > original_width) {
		ZEPHIR_INIT_NVAR(_0);
		ZVAL_LONG(_0, height);
		ZEPHIR_INIT_NVAR(_1);
		ZVAL_LONG(_1, original_width);
		ZEPHIR_INIT_VAR(_2);
		ZVAL_LONG(_2, original_height);
		ZEPHIR_CALL_SELF(&optimal_width, "getsizebyfixedheight", NULL, _0, _1, _2);
		zephir_check_call_status();
		ZEPHIR_INIT_NVAR(optimal_height);
		ZVAL_LONG(optimal_height, height);
		if (ZEPHIR_GT_LONG(optimal_width, width)) {
			ZEPHIR_INIT_NVAR(optimal_width);
			ZVAL_LONG(optimal_width, width);
			ZEPHIR_INIT_NVAR(_0);
			ZVAL_LONG(_0, original_width);
			ZEPHIR_INIT_NVAR(_1);
			ZVAL_LONG(_1, original_height);
			ZEPHIR_CALL_SELF(&optimal_height, "getsizebyfixedwidth", NULL, optimal_width, _0, _1);
			zephir_check_call_status();
		}
	} else {
		if (height > width) {
			ZEPHIR_INIT_NVAR(optimal_width);
			ZVAL_LONG(optimal_width, width);
			ZEPHIR_INIT_NVAR(_0);
			ZVAL_LONG(_0, width);
			ZEPHIR_INIT_NVAR(_1);
			ZVAL_LONG(_1, original_width);
			ZEPHIR_INIT_NVAR(_2);
			ZVAL_LONG(_2, original_height);
			ZEPHIR_CALL_SELF(&optimal_height, "getsizebyfixedwidth", NULL, _0, _1, _2);
			zephir_check_call_status();
		} else if (height < width) {
			ZEPHIR_INIT_NVAR(_0);
			ZVAL_LONG(_0, height);
			ZEPHIR_INIT_NVAR(_1);
			ZVAL_LONG(_1, original_width);
			ZEPHIR_INIT_NVAR(_2);
			ZVAL_LONG(_2, original_height);
			ZEPHIR_CALL_SELF(&optimal_width, "getsizebyfixedheight", NULL, _0, _1, _2);
			zephir_check_call_status();
			ZEPHIR_INIT_NVAR(optimal_height);
			ZVAL_LONG(optimal_height, height);
		} else {
			ZEPHIR_INIT_NVAR(optimal_width);
			ZVAL_LONG(optimal_width, width);
			ZEPHIR_INIT_NVAR(optimal_height);
			ZVAL_LONG(optimal_height, height);
		}
	}
	ZEPHIR_INIT_VAR(sizes);
	array_init_size(sizes, 3);
	zephir_array_update_string(&sizes, SL("optimal_width"), &optimal_width, PH_COPY | PH_SEPARATE);
	zephir_array_update_string(&sizes, SL("optimal_height"), &optimal_height, PH_COPY | PH_SEPARATE);
	RETURN_CCTOR(sizes);

}
Пример #15
0
/**
 * @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 {
			zephir_array_update_zval(&annotations, annoName, &val, PH_COPY | PH_SEPARATE);
		}
	}
	RETURN_CCTOR(annotations);

}
Пример #16
0
/**
 * @return mixed
 */
PHP_METHOD(Lynx_Annotation_RegexDocParser, parseValue) {

	int ZEPHIR_LAST_CALL_STATUS;
	zephir_nts_static zephir_fcall_cache_entry *_14 = NULL;
	HashTable *_11;
	HashPosition _10;
	zend_bool _3, _15, _20;
	zval *value, *val = NULL, *vals, *v = NULL, _0, _1, *_2, _4, *_5, _6 = zval_used_for_init, _7 = zval_used_for_init, *_8 = NULL, _9 = zval_used_for_init, **_12, *_13 = NULL, *_16, _17, _18, *_19, _21, *_22, _23, _24, *_25 = NULL, *_26;

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



	ZEPHIR_INIT_VAR(val);
	zephir_fast_trim(val, value, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
	ZEPHIR_SINIT_VAR(_0);
	ZVAL_LONG(&_0, 0);
	ZEPHIR_SINIT_VAR(_1);
	ZVAL_LONG(&_1, 1);
	ZEPHIR_INIT_VAR(_2);
	zephir_substr(_2, val, 0 , 1 , 0);
	_3 = ZEPHIR_IS_STRING(_2, "[");
	if (_3) {
		ZEPHIR_SINIT_VAR(_4);
		ZVAL_LONG(&_4, -1);
		ZEPHIR_INIT_VAR(_5);
		zephir_substr(_5, val, -1 , 0, ZEPHIR_SUBSTR_NO_LENGTH);
		_3 = ZEPHIR_IS_STRING(_5, "]");
	}
	if (_3) {
		ZEPHIR_INIT_VAR(vals);
		ZEPHIR_SINIT_VAR(_6);
		ZVAL_LONG(&_6, 1);
		ZEPHIR_SINIT_VAR(_7);
		ZVAL_LONG(&_7, -1);
		ZEPHIR_INIT_VAR(_8);
		zephir_substr(_8, val, 1 , -1 , 0);
		ZEPHIR_SINIT_VAR(_9);
		ZVAL_LONG(&_9, ',');
		zephir_fast_explode(vals, &_9, _8, LONG_MAX TSRMLS_CC);
		ZEPHIR_INIT_NVAR(val);
		array_init(val);
		zephir_is_iterable(vals, &_11, &_10, 0, 0, "lynx/Annotation/RegexDocParser.zep", 89);
		for (
		  ; zephir_hash_get_current_data_ex(_11, (void**) &_12, &_10) == SUCCESS
		  ; zephir_hash_move_forward_ex(_11, &_10)
		) {
			ZEPHIR_GET_HVALUE(v, _12);
			ZEPHIR_CALL_SELF(&_13, "parsevalue", &_14, v);
			zephir_check_call_status();
			zephir_array_append(&val, _13, PH_SEPARATE, "lynx/Annotation/RegexDocParser.zep", 86);
		}
		RETURN_CCTOR(val);
	} else {
		ZEPHIR_SINIT_NVAR(_6);
		ZVAL_LONG(&_6, 0);
		ZEPHIR_SINIT_NVAR(_7);
		ZVAL_LONG(&_7, 1);
		ZEPHIR_INIT_NVAR(_8);
		zephir_substr(_8, val, 0 , 1 , 0);
		_15 = ZEPHIR_IS_STRING(_8, "{");
		if (_15) {
			ZEPHIR_SINIT_NVAR(_9);
			ZVAL_LONG(&_9, -1);
			ZEPHIR_INIT_VAR(_16);
			zephir_substr(_16, val, -1 , 0, ZEPHIR_SUBSTR_NO_LENGTH);
			_15 = ZEPHIR_IS_STRING(_16, "}");
		}
		if (_15) {
			zephir_json_decode(return_value, &(return_value), val, 0  TSRMLS_CC);
			RETURN_MM();
		} else {
			ZEPHIR_SINIT_VAR(_17);
			ZVAL_LONG(&_17, 0);
			ZEPHIR_SINIT_VAR(_18);
			ZVAL_LONG(&_18, 1);
			ZEPHIR_INIT_VAR(_19);
			zephir_substr(_19, val, 0 , 1 , 0);
			_20 = ZEPHIR_IS_STRING(_19, "\"");
			if (_20) {
				ZEPHIR_SINIT_VAR(_21);
				ZVAL_LONG(&_21, -1);
				ZEPHIR_INIT_VAR(_22);
				zephir_substr(_22, val, -1 , 0, ZEPHIR_SUBSTR_NO_LENGTH);
				_20 = ZEPHIR_IS_STRING(_22, "\"");
			}
			if (_20) {
				ZEPHIR_SINIT_VAR(_23);
				ZVAL_LONG(&_23, 1);
				ZEPHIR_SINIT_VAR(_24);
				ZVAL_LONG(&_24, -1);
				ZEPHIR_INIT_VAR(_25);
				zephir_substr(_25, val, 1 , -1 , 0);
				ZEPHIR_CPY_WRT(val, _25);
				ZEPHIR_RETURN_CALL_SELF("parsevalue", &_14, val);
				zephir_check_call_status();
				RETURN_MM();
			} else {
				ZEPHIR_INIT_NVAR(_25);
				zephir_fast_strtolower(_25, val);
				if (ZEPHIR_IS_STRING(_25, "true")) {
					RETURN_MM_BOOL(1);
				} else {
					ZEPHIR_INIT_VAR(_26);
					zephir_fast_strtolower(_26, val);
					if (ZEPHIR_IS_STRING(_26, "false")) {
						RETURN_MM_BOOL(0);
					} else {
						if (zephir_is_numeric(val)) {
							if (zephir_get_doubleval(val) == zephir_get_intval(val)) {
								RETURN_MM_LONG(zephir_get_intval(val));
							} else {
								RETURN_MM_DOUBLE(zephir_get_doubleval(val));
							}
						}
					}
				}
			}
		}
	}
	RETURN_CCTOR(val);

}