Exemplo n.º 1
0
PHP_METHOD(Test_BuiltIn_StringMethods, getLength2) {

	zval _0;


	ZEPHIR_SINIT_VAR(_0);
	ZVAL_STRING(&_0, "hello", 0);
	RETURN_LONG(zephir_fast_strlen_ev(&_0));

}
Exemplo n.º 2
0
PHP_METHOD(PocketMine_Math_Vector2, lengthSquared) {

	zval *_0, *_1, _2, _3, *_4;

	ZEPHIR_MM_GROW();

	_0 = zephir_fetch_nproperty_this(this_ptr, SL("x"), PH_NOISY_CC);
	_1 = zephir_fetch_nproperty_this(this_ptr, SL("x"), PH_NOISY_CC);
	ZEPHIR_SINIT_VAR(_2);
	mul_function(&_2, _0, _1 TSRMLS_CC);
	_0 = zephir_fetch_nproperty_this(this_ptr, SL("y"), PH_NOISY_CC);
	_1 = zephir_fetch_nproperty_this(this_ptr, SL("y"), PH_NOISY_CC);
	ZEPHIR_SINIT_VAR(_3);
	mul_function(&_3, _0, _1 TSRMLS_CC);
	ZEPHIR_INIT_VAR(_4);
	zephir_add_function(_4, &_2, &_3 TSRMLS_CC);
	RETURN_MM_DOUBLE(zephir_get_doubleval(_4));

}
Exemplo n.º 3
0
/**
 * Makes a connection to the Beanstalkd server
 */
PHP_METHOD(Phalcon_Queue_Beanstalk, connect) {

	zval *connection = NULL, *parameters = NULL, *_0, _9, *_1$$4, *_2$$4, *_3$$4, *_4$$4, *_5$$5, *_6$$5, *_7$$5, *_8$$5;
	int ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	ZEPHIR_OBS_VAR(connection);
	zephir_read_property_this(&connection, this_ptr, SL("_connection"), PH_NOISY_CC);
	if (Z_TYPE_P(connection) == IS_RESOURCE) {
		ZEPHIR_CALL_METHOD(NULL, this_ptr, "disconnect", NULL, 0);
		zephir_check_call_status();
	}
	ZEPHIR_OBS_VAR(parameters);
	zephir_read_property_this(&parameters, this_ptr, SL("_parameters"), PH_NOISY_CC);
	zephir_array_fetch_string(&_0, parameters, SL("persistent"), PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 139 TSRMLS_CC);
	if (zephir_is_true(_0)) {
		zephir_array_fetch_string(&_1$$4, parameters, SL("host"), PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 140 TSRMLS_CC);
		zephir_array_fetch_string(&_2$$4, parameters, SL("port"), PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 140 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_3$$4);
		ZVAL_NULL(_3$$4);
		ZEPHIR_INIT_VAR(_4$$4);
		ZVAL_NULL(_4$$4);
		ZEPHIR_MAKE_REF(_3$$4);
		ZEPHIR_MAKE_REF(_4$$4);
		ZEPHIR_CALL_FUNCTION(&connection, "pfsockopen", NULL, 406, _1$$4, _2$$4, _3$$4, _4$$4);
		ZEPHIR_UNREF(_3$$4);
		ZEPHIR_UNREF(_4$$4);
		zephir_check_call_status();
	} else {
		zephir_array_fetch_string(&_5$$5, parameters, SL("host"), PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 142 TSRMLS_CC);
		zephir_array_fetch_string(&_6$$5, parameters, SL("port"), PH_NOISY | PH_READONLY, "phalcon/queue/beanstalk.zep", 142 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_7$$5);
		ZVAL_NULL(_7$$5);
		ZEPHIR_INIT_VAR(_8$$5);
		ZVAL_NULL(_8$$5);
		ZEPHIR_MAKE_REF(_7$$5);
		ZEPHIR_MAKE_REF(_8$$5);
		ZEPHIR_CALL_FUNCTION(&connection, "fsockopen", NULL, 407, _5$$5, _6$$5, _7$$5, _8$$5);
		ZEPHIR_UNREF(_7$$5);
		ZEPHIR_UNREF(_8$$5);
		zephir_check_call_status();
	}
	if (Z_TYPE_P(connection) != IS_RESOURCE) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_queue_beanstalk_exception_ce, "Can't connect to Beanstalk server", "phalcon/queue/beanstalk.zep", 146);
		return;
	}
	ZEPHIR_SINIT_VAR(_9);
	ZVAL_LONG(&_9, -1);
	ZEPHIR_CALL_FUNCTION(NULL, "stream_set_timeout", NULL, 408, connection, &_9, ZEPHIR_GLOBAL(global_null));
	zephir_check_call_status();
	zephir_update_property_this(this_ptr, SL("_connection"), connection TSRMLS_CC);
	RETURN_CCTOR(connection);

}
Exemplo n.º 4
0
/**
 * Applies a format to a message before sent it to the internal log
 *
 * @param string message
 * @param int type
 * @param int timestamp
 * @param array $context
 * @return string
 */
PHP_METHOD(Phalcon_Logger_Formatter_Line, format) {

	int type, timestamp, ZEPHIR_LAST_CALL_STATUS;
	zval *message_param = NULL, *type_param = NULL, *timestamp_param = NULL, *context = NULL, *format = NULL, *_0 = NULL, *_1, _2 = zval_used_for_init, *_3 = NULL, *_4;
	zval *message = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 3, 1, &message_param, &type_param, &timestamp_param, &context);

	zephir_get_strval(message, message_param);
	type = zephir_get_intval(type_param);
	timestamp = zephir_get_intval(timestamp_param);
	if (!context) {
		context = ZEPHIR_GLOBAL(global_null);
	}


	ZEPHIR_OBS_VAR(format);
	zephir_read_property_this(&format, this_ptr, SL("_format"), PH_NOISY_CC);
	if (zephir_memnstr_str(format, SL("%date%"), "phalcon/logger/formatter/line.zep", 81)) {
		ZEPHIR_INIT_VAR(_0);
		_1 = zephir_fetch_nproperty_this(this_ptr, SL("_dateFormat"), PH_NOISY_CC);
		ZEPHIR_SINIT_VAR(_2);
		ZVAL_LONG(&_2, timestamp);
		ZEPHIR_CALL_FUNCTION(&_3, "date", NULL, 285, _1, &_2);
		zephir_check_call_status();
		ZEPHIR_SINIT_NVAR(_2);
		ZVAL_STRING(&_2, "%date%", 0);
		zephir_fast_str_replace(&_0, &_2, _3, format TSRMLS_CC);
		ZEPHIR_CPY_WRT(format, _0);
	}
	if (zephir_memnstr_str(format, SL("%type%"), "phalcon/logger/formatter/line.zep", 88)) {
		ZEPHIR_INIT_NVAR(_0);
		ZEPHIR_INIT_VAR(_4);
		ZVAL_LONG(_4, type);
		ZEPHIR_CALL_METHOD(&_3, this_ptr, "gettypestring", NULL, 0, _4);
		zephir_check_call_status();
		ZEPHIR_SINIT_NVAR(_2);
		ZVAL_STRING(&_2, "%type%", 0);
		zephir_fast_str_replace(&_0, &_2, _3, format TSRMLS_CC);
		ZEPHIR_CPY_WRT(format, _0);
	}
	ZEPHIR_INIT_NVAR(_0);
	ZEPHIR_SINIT_NVAR(_2);
	ZVAL_STRING(&_2, "%message%", 0);
	zephir_fast_str_replace(&_0, &_2, message, format TSRMLS_CC);
	ZEPHIR_CPY_WRT(format, _0);
	if (Z_TYPE_P(context) == IS_ARRAY) {
		ZEPHIR_RETURN_CALL_METHOD(this_ptr, "interpolate", NULL, 0, format, context);
		zephir_check_call_status();
		RETURN_MM();
	}
	RETURN_CCTOR(format);

}
Exemplo n.º 5
0
/**
 * 判断数字是否在某个区域之间。[2, 10],包含边界值。
 * @param int value 原值。
 * @param int start_value 起始值。
 * @param int end_value 截止值。
 * @return boolean
 */
PHP_METHOD(Winer_Validator, number_between) {

	zend_bool _1, _3;
	zval *value_param = NULL, *start_value_param = NULL, *end_value_param = NULL, _0, _2, _4;
	int value, start_value, end_value;

	zephir_fetch_params(0, 3, 0, &value_param, &start_value_param, &end_value_param);

	value = zephir_get_intval(value_param);
	start_value = zephir_get_intval(start_value_param);
	end_value = zephir_get_intval(end_value_param);


	ZEPHIR_SINIT_VAR(_0);
	ZVAL_LONG(&_0, value);
	_1 = zephir_is_numeric(&_0) == 0;
	if (!(_1)) {
		ZEPHIR_SINIT_VAR(_2);
		ZVAL_LONG(&_2, start_value);
		_1 = zephir_is_numeric(&_2) == 0;
	}
	_3 = _1;
	if (!(_3)) {
		ZEPHIR_SINIT_VAR(_4);
		ZVAL_LONG(&_4, end_value);
		_3 = zephir_is_numeric(&_4) == 0;
	}
	if (_3) {
		RETURN_BOOL(0);
	}
	if (start_value >= end_value) {
		RETURN_BOOL(0);
	}
	if (value < start_value) {
		RETURN_BOOL(0);
	}
	if (value > end_value) {
		RETURN_BOOL(0);
	}
	RETURN_BOOL(1);

}
Exemplo n.º 6
0
/**
 * Concatenates strings using the separator only once without duplication in places concatenation
 *
 * <code>
 *    $str = Phalcon\Text::concat("/", "/tmp/", "/folder_1/", "/folder_2", "folder_3/");
 *    echo $str; // /tmp/folder_1/folder_2/folder_3/
 * </code>
 *
 * @param string separator
 * @param string a
 * @param string b
 * @param string ...N
 */
PHP_METHOD(Phalcon_Text, concat) {

	HashTable *_6;
	HashPosition _5;
	int ZEPHIR_LAST_CALL_STATUS;
	zephir_fcall_cache_entry *_1 = NULL;
	zval *separator = NULL, *a = NULL, *b = NULL, _0 = zval_used_for_init, *c = NULL, *_2 = NULL, *_3 = NULL, *_4 = NULL, **_7, *_8 = NULL, *_9 = NULL, *_10 = NULL;

	ZEPHIR_MM_GROW();

	ZEPHIR_SINIT_VAR(_0);
	ZVAL_LONG(&_0, 0);
	ZEPHIR_CALL_FUNCTION(&separator, "func_get_arg", &_1, 418, &_0);
	zephir_check_call_status();
	ZEPHIR_SINIT_NVAR(_0);
	ZVAL_LONG(&_0, 1);
	ZEPHIR_CALL_FUNCTION(&a, "func_get_arg", &_1, 418, &_0);
	zephir_check_call_status();
	ZEPHIR_SINIT_NVAR(_0);
	ZVAL_LONG(&_0, 2);
	ZEPHIR_CALL_FUNCTION(&b, "func_get_arg", &_1, 418, &_0);
	zephir_check_call_status();
	ZEPHIR_CALL_FUNCTION(&_2, "func_num_args", NULL, 419);
	zephir_check_call_status();
	if (ZEPHIR_GT_LONG(_2, 3)) {
		ZEPHIR_CALL_FUNCTION(&_3, "func_get_args", NULL, 165);
		zephir_check_call_status();
		ZEPHIR_SINIT_NVAR(_0);
		ZVAL_LONG(&_0, 3);
		ZEPHIR_CALL_FUNCTION(&_4, "array_slice", NULL, 377, _3, &_0);
		zephir_check_call_status();
		zephir_is_iterable(_4, &_6, &_5, 0, 0, "phalcon/text.zep", 246);
		for (
		  ; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS
		  ; zephir_hash_move_forward_ex(_6, &_5)
		) {
			ZEPHIR_GET_HVALUE(c, _7);
			ZEPHIR_INIT_NVAR(_8);
			zephir_fast_trim(_8, b, separator, ZEPHIR_TRIM_RIGHT TSRMLS_CC);
			ZEPHIR_INIT_NVAR(_9);
			zephir_fast_trim(_9, c, separator, ZEPHIR_TRIM_LEFT TSRMLS_CC);
			ZEPHIR_INIT_LNVAR(_10);
			ZEPHIR_CONCAT_VVV(_10, _8, separator, _9);
			ZEPHIR_CPY_WRT(b, _10);
		}
	}
	ZEPHIR_INIT_NVAR(_8);
	zephir_fast_trim(_8, a, separator, ZEPHIR_TRIM_RIGHT TSRMLS_CC);
	ZEPHIR_INIT_NVAR(_9);
	zephir_fast_trim(_9, b, separator, ZEPHIR_TRIM_LEFT TSRMLS_CC);
	ZEPHIR_CONCAT_VVV(return_value, _8, separator, _9);
	RETURN_MM();

}
Exemplo n.º 7
0
PHP_METHOD(Test_Optimizers_IsScalar, testVar) {

	zval _0;
	int a = 1;


	ZEPHIR_SINIT_VAR(_0);
	ZVAL_LONG(&_0, a);
	RETURN_BOOL(zephir_is_scalar(&_0));

}
Exemplo n.º 8
0
PHP_METHOD(Test_Optimizers_IsScalar, testDoubleVar) {

	zval _0;
	double a = 1;


	ZEPHIR_SINIT_VAR(_0);
	ZVAL_DOUBLE(&_0, a);
	RETURN_BOOL(zephir_is_scalar(&_0));

}
Exemplo n.º 9
0
PHP_METHOD(Test_Statements, test544Issue) {

	zephir_fcall_cache_entry *_8 = NULL;
	zval *step_param = NULL, *_0, *_1, *_2, *_3, *_4, *_5, _6 = zval_used_for_init, *_7 = NULL, *_9, *_10, *_11 = NULL;
	int step, filledWidth, unfilledWidth, ZEPHIR_LAST_CALL_STATUS;

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

	if (unlikely(Z_TYPE_P(step_param) != IS_LONG)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'step' must be a long/integer") TSRMLS_CC);
		RETURN_MM_NULL();
	}

	step = Z_LVAL_P(step_param);


	_0 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC);
	_1 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC);
	if (ZEPHIR_GT_LONG(_0, step)) {
		_2 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC);
		_3 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC);
		filledWidth = (long) ((zephir_safe_div_long_zval(((zephir_get_numberval(_2) - 1)), _3 TSRMLS_CC) * step));
		_4 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC);
		unfilledWidth = (((zephir_get_numberval(_4) - 1)) - filledWidth);
		_5 = zephir_fetch_nproperty_this(this_ptr, SL("filledChar"), PH_NOISY_CC);
		ZEPHIR_SINIT_VAR(_6);
		ZVAL_LONG(&_6, filledWidth);
		ZEPHIR_CALL_FUNCTION(&_7, "str_repeat", &_8, 17, _5, &_6);
		zephir_check_call_status();
		_9 = zephir_fetch_nproperty_this(this_ptr, SL("arrow"), PH_NOISY_CC);
		_10 = zephir_fetch_nproperty_this(this_ptr, SL("unfilledChar"), PH_NOISY_CC);
		ZEPHIR_SINIT_NVAR(_6);
		ZVAL_LONG(&_6, unfilledWidth);
		ZEPHIR_CALL_FUNCTION(&_11, "str_repeat", &_8, 17, _10, &_6);
		zephir_check_call_status();
		ZEPHIR_CONCAT_VVV(return_value, _7, _9, _11);
		RETURN_MM();
	} else if (ZEPHIR_IS_LONG_IDENTICAL(_1, step)) {
		_2 = zephir_fetch_nproperty_this(this_ptr, SL("filledChar"), PH_NOISY_CC);
		_3 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC);
		ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 17, _2, _3);
		zephir_check_call_status();
		RETURN_MM();
	} else {
		_2 = zephir_fetch_nproperty_this(this_ptr, SL("unfilledChar"), PH_NOISY_CC);
		_3 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC);
		ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_8, 17, _2, _3);
		zephir_check_call_status();
		RETURN_MM();
	}

}
Exemplo n.º 10
0
PHP_METHOD(Test_BuiltIn_IntMethods, getPow) {

	zval *num_param = NULL, *exp_param = NULL, *_0, _1, _2;
	int num, exp;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &num_param, &exp_param);

	num = zephir_get_intval(num_param);
	exp = zephir_get_intval(exp_param);


	ZEPHIR_INIT_VAR(_0);
	ZEPHIR_SINIT_VAR(_1);
	ZVAL_LONG(&_1, num);
	ZEPHIR_SINIT_VAR(_2);
	ZVAL_LONG(&_2, exp);
	zephir_pow_function(_0, &_1, &_2);
	RETURN_CCTOR(_0);

}
Exemplo n.º 11
0
/**
 * Sets Cache headers to use HTTP cache
 *
 *<code>
 *	$this->response->setCache(60);
 *</code>
 */
PHP_METHOD(Phalcon_Http_Response, setCache) {

	zval *_1, *_3;
	zval *minutes_param = NULL, *date, _0, _2, *_4;
	int minutes, ZEPHIR_LAST_CALL_STATUS;

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

	if (unlikely(Z_TYPE_P(minutes_param) != IS_LONG)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'minutes' must be a int") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	minutes = Z_LVAL_P(minutes_param);


	ZEPHIR_INIT_VAR(date);
	object_init_ex(date, php_date_get_date_ce());
	ZEPHIR_CALL_METHOD(NULL, date, "__construct", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_SINIT_VAR(_0);
	ZVAL_LONG(&_0, minutes);
	ZEPHIR_INIT_VAR(_1);
	ZEPHIR_CONCAT_SVS(_1, "+", &_0, " minutes");
	ZEPHIR_CALL_METHOD(NULL, date, "modify", NULL, 0, _1);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "setexpires", NULL, 0, date);
	zephir_check_call_status();
	ZEPHIR_SINIT_VAR(_2);
	ZVAL_LONG(&_2, ((minutes * 60)));
	ZEPHIR_INIT_VAR(_3);
	ZEPHIR_CONCAT_SV(_3, "max-age=", &_2);
	ZEPHIR_INIT_VAR(_4);
	ZVAL_STRING(_4, "Cache-Control", ZEPHIR_TEMP_PARAM_COPY);
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "setheader", NULL, 0, _4, _3);
	zephir_check_temp_parameter(_4);
	zephir_check_call_status();
	RETURN_THIS();

}
Exemplo n.º 12
0
/**
 * Sets the expiration time for this cache item.
 *
 * @param \DateTimeInterface expiration
 *   The point in time after which the item MUST be considered expired.
 *   If null is passed explicitly, a default value MAY be used. If none is set,
 *   the value should be stored permanently or for as long as the
 *   implementation allows.
 *
 * @return \Xpl\Cache\Item The called object.
 */
PHP_METHOD(Xpl_Cache_Item, expiresAt) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *expiration, *_0$$3, *_1$$3, *_2$$3, *_3$$5 = NULL, *_4$$5, *_5$$5, *_6$$6, *_7$$6 = NULL, _8$$6, *_9$$6 = NULL;

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



	if (Z_TYPE_P(expiration) == IS_NULL) {
		ZEPHIR_INIT_VAR(_0$$3);
		zephir_time(_0$$3);
		_1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("defaultTtl"), PH_NOISY_CC);
		ZEPHIR_INIT_VAR(_2$$3);
		zephir_add_function(_2$$3, _0$$3, _1$$3);
		zephir_update_property_this(this_ptr, SL("expires"), _2$$3 TSRMLS_CC);
	} else {
		if (zephir_is_instance_of(expiration, SL("DateTimeInterface") TSRMLS_CC)) {
			ZEPHIR_INIT_VAR(_4$$5);
			ZVAL_STRING(_4$$5, "U", ZEPHIR_TEMP_PARAM_COPY);
			ZEPHIR_CALL_METHOD(&_3$$5, expiration, "format", NULL, 0, _4$$5);
			zephir_check_temp_parameter(_4$$5);
			zephir_check_call_status();
			ZEPHIR_INIT_ZVAL_NREF(_5$$5);
			ZVAL_LONG(_5$$5, zephir_get_intval(_3$$5));
			zephir_update_property_this(this_ptr, SL("expires"), _5$$5 TSRMLS_CC);
		} else {
			ZEPHIR_INIT_VAR(_6$$6);
			object_init_ex(_6$$6, xpl_cache_invalidargumentexception_ce);
			ZEPHIR_INIT_VAR(_7$$6);
			if (Z_TYPE_P(expiration) == IS_OBJECT) {
				ZEPHIR_INIT_NVAR(_7$$6);
				zephir_get_class(_7$$6, expiration, 0 TSRMLS_CC);
			} else {
				ZEPHIR_INIT_NVAR(_7$$6);
				zephir_gettype(_7$$6, expiration TSRMLS_CC);
			}
			ZEPHIR_SINIT_VAR(_8$$6);
			ZVAL_STRING(&_8$$6, "Expiration date must be null or instance of DateTimeInterface, given: \"%s\".", 0);
			ZEPHIR_CALL_FUNCTION(&_9$$6, "sprintf", NULL, 41, &_8$$6, _7$$6);
			zephir_check_call_status();
			ZEPHIR_CALL_METHOD(NULL, _6$$6, "__construct", NULL, 42, _9$$6);
			zephir_check_call_status();
			zephir_throw_exception_debug(_6$$6, "xpl/cache/item.zep", 147 TSRMLS_CC);
			ZEPHIR_MM_RESTORE();
			return;
		}
	}
	RETURN_THIS();

}
Exemplo n.º 13
0
/**
 * Determine if data is associative array
 *
 * @param mixed data
 * @return boolean
 */
PHP_METHOD(Phal_Format_Reader_Hal_JsonReader, isAssocArray) {

	int ZEPHIR_LAST_CALL_STATUS;
	zephir_nts_static zephir_fcall_cache_entry *_4 = NULL;
	zval *data, *_0, _1, _2, *_3 = NULL;

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



	ZEPHIR_INIT_VAR(_0);
	zephir_array_keys(_0, data TSRMLS_CC);
	ZEPHIR_SINIT_VAR(_1);
	ZVAL_LONG(&_1, 0);
	ZEPHIR_SINIT_VAR(_2);
	ZVAL_LONG(&_2, (zephir_fast_count_int(data TSRMLS_CC) - 1));
	ZEPHIR_CALL_FUNCTION(&_3, "range", &_4, &_1, &_2);
	zephir_check_call_status();
	RETURN_MM_BOOL(!ZEPHIR_IS_IDENTICAL(_0, _3));

}
Exemplo n.º 14
0
PHP_METHOD(Test_BuiltIn_StringMethods, getTrimmed) {

	zval *_0, _1;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(_0);
	ZEPHIR_SINIT_VAR(_1);
	ZVAL_STRING(&_1, " hello \t\n", 0);
	zephir_fast_trim(_0, &_1, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
	RETURN_CCTOR(_0);

}
Exemplo n.º 15
0
PHP_METHOD(Test_Statements, test544IssueWithVariable) {

	zephir_fcall_cache_entry *_6 = NULL;
	zval *step_param = NULL, *_0, *_1$$3, *_2$$3, *_3$$3, _4$$3 = zval_used_for_init, *_5$$3 = NULL, *_7$$3, *_8$$3, *_9$$3 = NULL, *_10$$4, *_11$$4, *_12$$5, *_13$$5;
	int step, ZEPHIR_LAST_CALL_STATUS, filledWidth = 0, unfilledWidth = 0, totalSteps = 0;

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

	if (unlikely(Z_TYPE_P(step_param) != IS_LONG)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'step' must be a int") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	step = Z_LVAL_P(step_param);


	_0 = zephir_fetch_nproperty_this(this_ptr, SL("totalSteps"), PH_NOISY_CC);
	totalSteps = zephir_get_numberval(_0);
	if (step < totalSteps) {
		_1$$3 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC);
		filledWidth = (long) ((zephir_safe_div_long_long(((zephir_get_numberval(_1$$3) - 1)), totalSteps TSRMLS_CC) * step));
		_2$$3 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC);
		unfilledWidth = (((zephir_get_numberval(_2$$3) - 1)) - filledWidth);
		_3$$3 = zephir_fetch_nproperty_this(this_ptr, SL("filledChar"), PH_NOISY_CC);
		ZEPHIR_SINIT_VAR(_4$$3);
		ZVAL_LONG(&_4$$3, filledWidth);
		ZEPHIR_CALL_FUNCTION(&_5$$3, "str_repeat", &_6, 17, _3$$3, &_4$$3);
		zephir_check_call_status();
		_7$$3 = zephir_fetch_nproperty_this(this_ptr, SL("arrow"), PH_NOISY_CC);
		_8$$3 = zephir_fetch_nproperty_this(this_ptr, SL("unfilledChar"), PH_NOISY_CC);
		ZEPHIR_SINIT_NVAR(_4$$3);
		ZVAL_LONG(&_4$$3, unfilledWidth);
		ZEPHIR_CALL_FUNCTION(&_9$$3, "str_repeat", &_6, 17, _8$$3, &_4$$3);
		zephir_check_call_status();
		ZEPHIR_CONCAT_VVV(return_value, _5$$3, _7$$3, _9$$3);
		RETURN_MM();
	} else if (step == totalSteps) {
		_10$$4 = zephir_fetch_nproperty_this(this_ptr, SL("filledChar"), PH_NOISY_CC);
		_11$$4 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC);
		ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 17, _10$$4, _11$$4);
		zephir_check_call_status();
		RETURN_MM();
	} else {
		_12$$5 = zephir_fetch_nproperty_this(this_ptr, SL("unfilledChar"), PH_NOISY_CC);
		_13$$5 = zephir_fetch_nproperty_this(this_ptr, SL("width"), PH_NOISY_CC);
		ZEPHIR_RETURN_CALL_FUNCTION("str_repeat", &_6, 17, _12$$5, _13$$5);
		zephir_check_call_status();
		RETURN_MM();
	}

}
Exemplo n.º 16
0
PHP_METHOD(PhalconPlus_Enum_Sys, init) {

	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval *moduleDir_param = NULL, *_0, *_1, _2, *_3 = NULL, *_6 = NULL, *_4$$4;
	zval *moduleDir = NULL, *_5$$4;

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

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


	ZEPHIR_OBS_VAR(_0);
	zephir_read_static_property_ce(&_0, phalconplus_enum_sys_ce, SL("primaryModuleDir") TSRMLS_CC);
	if (!(ZEPHIR_IS_EMPTY(_0))) {
		RETURN_MM_NULL();
	}
	ZEPHIR_INIT_VAR(_1);
	ZEPHIR_SINIT_VAR(_2);
	ZVAL_STRING(&_2, "/", 0);
	zephir_fast_trim(_1, moduleDir, &_2, ZEPHIR_TRIM_RIGHT TSRMLS_CC);
	zephir_get_strval(moduleDir, _1);
	ZEPHIR_CALL_FUNCTION(&_3, "is_dir", NULL, 39, moduleDir);
	zephir_check_call_status();
	if (!(zephir_is_true(_3))) {
		ZEPHIR_INIT_VAR(_4$$4);
		object_init_ex(_4$$4, zend_exception_get_default(TSRMLS_C));
		ZEPHIR_INIT_VAR(_5$$4);
		ZEPHIR_CONCAT_SV(_5$$4, "Module directory not exists or not a dir, file positon: ", moduleDir);
		ZEPHIR_CALL_METHOD(NULL, _4$$4, "__construct", NULL, 7, _5$$4);
		zephir_check_call_status();
		zephir_throw_exception_debug(_4$$4, "phalconplus/Enum/Sys.zep", 28 TSRMLS_CC);
		ZEPHIR_MM_RESTORE();
		return;
	}
	zephir_update_static_property_ce(phalconplus_enum_sys_ce, SL("primaryModuleDir"), &moduleDir TSRMLS_CC);
	ZEPHIR_CALL_FUNCTION(&_6, "dirname", NULL, 71, moduleDir);
	zephir_check_call_status();
	zephir_update_static_property_ce(phalconplus_enum_sys_ce, SL("rootDir"), &_6 TSRMLS_CC);
	RETURN_MM_NULL();

}
Exemplo n.º 17
0
PHP_METHOD(Xpl_ClassLoader, getPrefixes) {

	zval *_0, _1;
	int ZEPHIR_LAST_CALL_STATUS;


	_0 = zephir_fetch_nproperty_this(this_ptr, SL("prefixesPsr0"), PH_NOISY_CC);
	ZEPHIR_SINIT_VAR(_1);
	ZVAL_STRING(&_1, "array_merge", 0);
	ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, &_1, _0);
	zephir_check_call_status();
	return;

}
Exemplo n.º 18
0
/**
 * Returns an JSON string of information about a single variable.
 *
 * <code>
 *    $foo = ["key" => "value"];
 *    echo (new \Phalcon\Debug\Dump())->toJson($foo);
 *    $foo = new stdClass();
 *    $foo->bar = 'buz';
 *    echo (new \Phalcon\Debug\Dump())->toJson($foo);
 * </code>
 *
 * @param mixed variable
 */
PHP_METHOD(Phalcon_Debug_Dump, toJson) {

	zval *variable, _0;

	zephir_fetch_params(0, 1, 0, &variable);



	ZEPHIR_SINIT_VAR(_0);
	ZVAL_LONG(&_0, ((128 | 64) | 256));
	zephir_json_encode(return_value, &(return_value), variable, zephir_get_intval(&_0)  TSRMLS_CC);
	return;

}
Exemplo n.º 19
0
PHP_METHOD(Test_Arithmetic, doubleSumExpression) {

	zval _0, *_1 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	ZEPHIR_SINIT_VAR(_0);
	ZVAL_LONG(&_0, 0);
	ZEPHIR_CALL_FUNCTION(&_1, "exp", NULL, 1, &_0);
	zephir_check_call_status();
	RETURN_MM_DOUBLE((1.0 + zephir_get_numberval(_1)));

}
Exemplo n.º 20
0
PHP_METHOD(Test_Optimizers_Math, testSqrtVar) {

	zval _0;
	int a = 4, ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	ZEPHIR_SINIT_VAR(_0);
	ZVAL_LONG(&_0, a);
	ZEPHIR_RETURN_CALL_FUNCTION("sqrt", NULL, 9, &_0);
	zephir_check_call_status();
	RETURN_MM();

}
Exemplo n.º 21
0
PHP_METHOD(Test_Optimizers_ACos, testIntValue1) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval _0;

	ZEPHIR_MM_GROW();

	ZEPHIR_SINIT_VAR(_0);
	ZVAL_LONG(&_0, 0);
	ZEPHIR_RETURN_CALL_FUNCTION("acos", NULL, 10, &_0);
	zephir_check_call_status();
	RETURN_MM();

}
Exemplo n.º 22
0
PHP_METHOD(Xs_Command, __toString) {

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

    ZEPHIR_MM_GROW();

    _0 = zephir_fetch_nproperty_this(this_ptr, SL("buf1"), PH_NOISY_CC);
    if (zephir_fast_strlen_ev(_0) > 0xff) {
        _1 = zephir_fetch_nproperty_this(this_ptr, SL("buf1"), PH_NOISY_CC);
        ZEPHIR_SINIT_VAR(_2);
        ZVAL_LONG(&_2, 0);
        ZEPHIR_SINIT_VAR(_3);
        ZVAL_LONG(&_3, 0xff);
        ZEPHIR_INIT_VAR(_4);
        zephir_substr(_4, _1, 0 , 0xff , 0);
        zephir_update_property_this(this_ptr, SL("buf1"), _4 TSRMLS_CC);
    }
    _1 = zephir_fetch_nproperty_this(this_ptr, SL("cmd"), PH_NOISY_CC);
    _5 = zephir_fetch_nproperty_this(this_ptr, SL("arg1"), PH_NOISY_CC);
    _6 = zephir_fetch_nproperty_this(this_ptr, SL("arg2"), PH_NOISY_CC);
    _7 = zephir_fetch_nproperty_this(this_ptr, SL("buf1"), PH_NOISY_CC);
    _8 = zephir_fetch_nproperty_this(this_ptr, SL("buf"), PH_NOISY_CC);
    ZEPHIR_SINIT_NVAR(_2);
    ZVAL_STRING(&_2, "CCCCI", 0);
    ZEPHIR_SINIT_NVAR(_3);
    ZVAL_LONG(&_3, zephir_fast_strlen_ev(_7));
    ZEPHIR_SINIT_VAR(_9);
    ZVAL_LONG(&_9, zephir_fast_strlen_ev(_8));
    ZEPHIR_CALL_FUNCTION(&_10, "pack", NULL, 2, &_2, _1, _5, _6, &_3, &_9);
    zephir_check_call_status();
    _11 = zephir_fetch_nproperty_this(this_ptr, SL("buf"), PH_NOISY_CC);
    _12 = zephir_fetch_nproperty_this(this_ptr, SL("buf1"), PH_NOISY_CC);
    ZEPHIR_CONCAT_VVV(return_value, _10, _11, _12);
    RETURN_MM();

}
Exemplo n.º 23
0
PHP_METHOD(Yb_Std, uuid) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *salt_param = NULL, *_0 = NULL, *_1 = NULL, *_2, *_3 = NULL, *_4, _5, _6, *_7 = NULL;
	zval *salt = NULL;

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

	if (!salt_param) {
		ZEPHIR_INIT_VAR(salt);
		ZVAL_STRING(salt, "", 1);
	} else {
		zephir_get_strval(salt, salt_param);
	}


	ZEPHIR_CALL_FUNCTION(&_0, "mt_rand", NULL, 76);
	zephir_check_call_status();
	ZEPHIR_CALL_FUNCTION(&_1, "uniqid", NULL, 77, _0, ZEPHIR_GLOBAL(global_true));
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_2);
	ZEPHIR_CONCAT_VV(_2, _1, salt);
	ZEPHIR_CALL_FUNCTION(&_3, "sha1", NULL, 78, _2);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_4);
	zephir_time(_4);
	ZEPHIR_SINIT_VAR(_5);
	ZVAL_STRING(&_5, "%04x", 0);
	ZEPHIR_SINIT_VAR(_6);
	ZVAL_LONG(&_6, (zephir_get_intval(_4) & 0xffff));
	ZEPHIR_CALL_FUNCTION(&_7, "sprintf", NULL, 1, &_5, &_6);
	zephir_check_call_status();
	ZEPHIR_CONCAT_VV(return_value, _3, _7);
	RETURN_MM();

}
Exemplo n.º 24
0
PHP_METHOD(Test_Fcall, testCall3) {

	int ZEPHIR_LAST_CALL_STATUS;
	zephir_nts_static zephir_fcall_cache_entry *_2 = NULL, *_3 = NULL;
	zval *handle = NULL, *handle2 = NULL, *buffer = NULL, _0 = zval_used_for_init, _1 = zval_used_for_init;

	ZEPHIR_MM_GROW();

	ZEPHIR_SINIT_VAR(_0);
	ZVAL_STRING(&_0, "inputfile.txt", 0);
	ZEPHIR_SINIT_VAR(_1);
	ZVAL_STRING(&_1, "r", 0);
	ZEPHIR_CALL_FUNCTION(&handle, "fopen", &_2, &_0, &_1);
	zephir_check_call_status();
	ZEPHIR_SINIT_NVAR(_0);
	ZVAL_STRING(&_0, "outputfile.txt", 0);
	ZEPHIR_SINIT_NVAR(_1);
	ZVAL_STRING(&_1, "w", 0);
	ZEPHIR_CALL_FUNCTION(&handle2, "fopen", &_2, &_0, &_1);
	zephir_check_call_status();
	if (zephir_is_true(handle)) {
		while (1) {
			ZEPHIR_SINIT_NVAR(_0);
			ZVAL_LONG(&_0, 4096);
			ZEPHIR_CALL_FUNCTION(&buffer, "fgets", &_3, handle, &_0);
			zephir_check_call_status();
			if (ZEPHIR_IS_FALSE_IDENTICAL(buffer)) {
				break;
			}
			zephir_fwrite(NULL, handle2, buffer TSRMLS_CC);
		}
		zephir_fclose(handle TSRMLS_CC);
		zephir_fclose(handle2 TSRMLS_CC);
	}
	ZEPHIR_MM_RESTORE();

}
Exemplo n.º 25
0
/**
 * Phalcon\Http\Request\File constructor
 */
PHP_METHOD(Phalcon_Http_Request_File, __construct) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *file_param = NULL, *key = NULL, *name, *tempName, *size, *type, *error, _0 = zval_used_for_init, *_1 = NULL, *_2 = NULL;
	zval *file = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &file_param, &key);

	file = file_param;

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


	ZEPHIR_OBS_VAR(name);
	if (zephir_array_isset_string_fetch(&name, file, SS("name"), 0 TSRMLS_CC)) {
		zephir_update_property_this(this_ptr, SL("_name"), name TSRMLS_CC);
		ZEPHIR_SINIT_VAR(_0);
		ZVAL_STRING(&_0, "PATHINFO_EXTENSION", 0);
		ZEPHIR_CALL_FUNCTION(&_1, "defined", NULL, 204, &_0);
		zephir_check_call_status();
		if (zephir_is_true(_1)) {
			ZEPHIR_SINIT_NVAR(_0);
			ZVAL_LONG(&_0, 4);
			ZEPHIR_CALL_FUNCTION(&_2, "pathinfo", NULL, 205, name, &_0);
			zephir_check_call_status();
			zephir_update_property_this(this_ptr, SL("_extension"), _2 TSRMLS_CC);
		}
	}
	if (zephir_array_isset_string_fetch(&tempName, file, SS("tmp_name"), 1 TSRMLS_CC)) {
		zephir_update_property_this(this_ptr, SL("_tmp"), tempName TSRMLS_CC);
	}
	if (zephir_array_isset_string_fetch(&size, file, SS("size"), 1 TSRMLS_CC)) {
		zephir_update_property_this(this_ptr, SL("_size"), size TSRMLS_CC);
	}
	if (zephir_array_isset_string_fetch(&type, file, SS("type"), 1 TSRMLS_CC)) {
		zephir_update_property_this(this_ptr, SL("_type"), type TSRMLS_CC);
	}
	if (zephir_array_isset_string_fetch(&error, file, SS("error"), 1 TSRMLS_CC)) {
		zephir_update_property_this(this_ptr, SL("_error"), error TSRMLS_CC);
	}
	if (zephir_is_true(key)) {
		zephir_update_property_this(this_ptr, SL("_key"), key TSRMLS_CC);
	}
	ZEPHIR_MM_RESTORE();

}
Exemplo n.º 26
0
/**
 * Phalcon\Cache\Backend\File constructor
 *
 * @param	Phalcon\Cache\FrontendInterface frontend
 * @param	array options
 */
PHP_METHOD(Phalcon_Cache_Backend_File, __construct) {

	int ZEPHIR_LAST_CALL_STATUS;
	zephir_fcall_cache_entry *_5 = NULL;
	zend_bool _1;
	zval *frontend, *options = NULL, *prefix, *safekey, *_0, *_2, *_3, _4;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &frontend, &options);

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


	if (!(zephir_array_isset_string(options, SS("cacheDir")))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cache directory must be specified with the option cacheDir", "phalcon/cache/backend/file.zep", 78);
		return;
	}
	ZEPHIR_OBS_VAR(safekey);
	if (zephir_array_isset_string_fetch(&safekey, options, SS("safekey"), 0 TSRMLS_CC)) {
		if (Z_TYPE_P(safekey) != IS_BOOL) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "safekey option should be a boolean.", "phalcon/cache/backend/file.zep", 83);
			return;
		}
		zephir_update_property_this(this_ptr, SL("_useSafeKey"), safekey TSRMLS_CC);
	}
	ZEPHIR_OBS_VAR(prefix);
	if (zephir_array_isset_string_fetch(&prefix, options, SS("prefix"), 0 TSRMLS_CC)) {
		_0 = zephir_fetch_nproperty_this(this_ptr, SL("_useSafeKey"), PH_NOISY_CC);
		_1 = zephir_is_true(_0);
		if (_1) {
			ZEPHIR_INIT_VAR(_2);
			ZEPHIR_INIT_VAR(_3);
			ZEPHIR_SINIT_VAR(_4);
			ZVAL_STRING(&_4, "/[^a-zA-Z0-9_.-]+/", 0);
			zephir_preg_match(_3, &_4, prefix, _2, 0, 0 , 0  TSRMLS_CC);
			_1 = zephir_is_true(_3);
		}
		if (_1) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "FileCache prefix should only use alphanumeric characters.", "phalcon/cache/backend/file.zep", 92);
			return;
		}
	}
	ZEPHIR_CALL_PARENT(NULL, phalcon_cache_backend_file_ce, this_ptr, "__construct", &_5, 36, frontend, options);
	zephir_check_call_status();
	ZEPHIR_MM_RESTORE();

}
Exemplo n.º 27
0
PHP_METHOD(Test_Fcall, testStrtokVarBySlash) {

	zval *value, _0;

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



	ZEPHIR_SINIT_VAR(_0);
	ZVAL_STRING(&_0, "/", 0);
	zephir_call_func_p2(return_value, "strtok", value, &_0);
	RETURN_MM();

}
Exemplo n.º 28
0
PHP_METHOD(Test_BuiltIn_IntMethods, getAbs1) {

	int ZEPHIR_LAST_CALL_STATUS;
	zephir_nts_static zephir_fcall_cache_entry *_2 = NULL;
	zval _0, *_1 = NULL;

	ZEPHIR_MM_GROW();

	ZEPHIR_SINIT_VAR(_0);
	ZVAL_LONG(&_0, -5);
	ZEPHIR_CALL_FUNCTION(&_1, "abs", &_2, &_0);
	zephir_check_call_status();
	RETURN_CCTOR(_1);

}
Exemplo n.º 29
0
PHP_METHOD(Test_Fcall, testCall3) {

	zend_function *_2 = NULL;
	zval *handle, *handle2, *buffer = NULL, _0 = zval_used_for_init, _1 = zval_used_for_init;

	ZEPHIR_MM_GROW();

	ZEPHIR_SINIT_VAR(_0);
	ZVAL_STRING(&_0, "inputfile.txt", 0);
	ZEPHIR_SINIT_VAR(_1);
	ZVAL_STRING(&_1, "r", 0);
	ZEPHIR_INIT_VAR(handle);
	zephir_call_func_p2(handle, "fopen", &_0, &_1);
	ZEPHIR_SINIT_NVAR(_0);
	ZVAL_STRING(&_0, "outputfile.txt", 0);
	ZEPHIR_SINIT_NVAR(_1);
	ZVAL_STRING(&_1, "w", 0);
	ZEPHIR_INIT_VAR(handle2);
	zephir_call_func_p2(handle2, "fopen", &_0, &_1);
	if (zephir_is_true(handle)) {
		while (1) {
			ZEPHIR_SINIT_NVAR(_0);
			ZVAL_LONG(&_0, 4096);
			ZEPHIR_INIT_NVAR(buffer);
			ZEPHIR_CALL_INTERNAL_FUNCTION(buffer, &buffer, "fgets", &_2, 2, handle, &_0);
			if (ZEPHIR_IS_FALSE(buffer)) {
				break;
			}
			zephir_fwrite(NULL, handle2, buffer TSRMLS_CC);
		}
		zephir_fclose(handle TSRMLS_CC);
		zephir_fclose(handle2 TSRMLS_CC);
	}
	ZEPHIR_MM_RESTORE();

}
Exemplo n.º 30
0
/**
 * Registers a set of PSR-4 directories for a given namespace,
 * replacing any others previously set for this namespace.
 *
 * @param string       $prefix The prefix/namespace, with trailing "\\"
 * @param array|string $paths  The PSR-4 base directories
 *
 * @throws \InvalidArgumentException
 */
PHP_METHOD(Xpl_ClassLoader, setPsr4) {

	zval *prefix, *paths = NULL, *_0$$4, _1$$4, _2$$4, *_3$$4;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &prefix, &paths);

	ZEPHIR_SEPARATE_PARAM(paths);


	if (Z_TYPE_P(paths) == IS_STRING) {
		ZEPHIR_INIT_NVAR(paths);
		zephir_create_array(paths, 1, 0 TSRMLS_CC);
		zephir_array_fast_append(paths, paths);
	}
	if (Z_TYPE_P(prefix) == IS_STRING) {
		if (!(zephir_end_with_str(prefix, SL("\\")))) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "A non-empty PSR-4 prefix must end with a namespace separator.", "xpl/classloader.zep", 366);
			return;
		}
		ZEPHIR_INIT_VAR(_0$$4);
		ZVAL_LONG(_0$$4, zephir_fast_strlen_ev(prefix));
		ZEPHIR_SINIT_VAR(_1$$4);
		ZVAL_LONG(&_1$$4, 0);
		ZEPHIR_SINIT_VAR(_2$$4);
		ZVAL_LONG(&_2$$4, 1);
		ZEPHIR_INIT_VAR(_3$$4);
		zephir_substr(_3$$4, prefix, 0 , 1 , 0);
		zephir_update_property_array_multi(this_ptr, SL("prefixLengthsPsr4"), &_0$$4 TSRMLS_CC, SL("zz"), 2, _3$$4, prefix);
		zephir_update_property_array(this_ptr, SL("prefixDirsPsr4"), prefix, paths TSRMLS_CC);
	} else {
		zephir_update_property_this(this_ptr, SL("fallbackDirsPsr4"), paths TSRMLS_CC);
	}
	ZEPHIR_MM_RESTORE();

}