PHP_METHOD(Auryn_AbstractCachingReflector, __construct) {

	int ZEPHIR_LAST_CALL_STATUS;
	zend_bool _0, _1;
	zval *reflector = NULL, *cache = NULL, *_2 = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 0, 2, &reflector, &cache);

	if (!reflector) {
		reflector = ZEPHIR_GLOBAL(global_null);
	}
	if (!cache) {
		cache = ZEPHIR_GLOBAL(global_null);
	}


	_0 = Z_TYPE_P(reflector) != IS_NULL;
	if (_0) {
		_0 = !zephir_instance_of_ev(reflector, auryn_reflectorinterface_ce TSRMLS_CC);
	}
	if (_0) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'reflector' must be an instance of 'Auryn\\\\ReflectorInterface'", "", 0);
		return;
	}
	_1 = Z_TYPE_P(cache) != IS_NULL;
	if (_1) {
		_1 = !zephir_instance_of_ev(cache, auryn_reflectioncacheinterface_ce TSRMLS_CC);
	}
	if (_1) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'cache' must be an instance of 'Auryn\\\\ReflectionCacheInterface'", "", 0);
		return;
	}
	if (unlikely(Z_TYPE_P(reflector) == IS_NULL)) {
		ZEPHIR_INIT_VAR(_2);
		object_init_ex(_2, auryn_standardreflector_ce);
		if (zephir_has_constructor(_2 TSRMLS_CC)) {
			ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL);
			zephir_check_call_status();
		}
		zephir_update_property_this(this_ptr, SL("reflector"), _2 TSRMLS_CC);
	} else {
		zephir_update_property_this(this_ptr, SL("reflector"), reflector TSRMLS_CC);
	}
	if (unlikely(Z_TYPE_P(cache) == IS_NULL)) {
		ZEPHIR_INIT_LNVAR(_2);
		object_init_ex(_2, auryn_reflectioncachearray_ce);
		if (zephir_has_constructor(_2 TSRMLS_CC)) {
			ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL);
			zephir_check_call_status();
		}
		zephir_update_property_this(this_ptr, SL("cache"), _2 TSRMLS_CC);
	} else {
		zephir_update_property_this(this_ptr, SL("cache"), cache TSRMLS_CC);
	}
	ZEPHIR_MM_RESTORE();

}
Ejemplo n.º 2
0
/**
 * Detects and returns the first available cache driver.
 *
 * @return \Xpl\Cache\DriverInterface
 */
PHP_METHOD(Xpl_Cache_Cache, getDetectedDriver) {

	zend_class_entry *_7$$4;
	HashTable *_2;
	HashPosition _1;
	zval *driverClasses = NULL, *classname = NULL, *_0 = NULL, **_3, *_4$$3 = NULL, *_5$$3 = NULL, *_6$$4 = NULL;
	zephir_fcall_cache_entry *_8 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(driverClasses);
	zephir_create_array(driverClasses, 3, 0 TSRMLS_CC);
	ZEPHIR_INIT_VAR(_0);
	ZVAL_STRING(_0, "Xpl\\Cache\\Driver\\ApcuDriver", 1);
	zephir_array_fast_append(driverClasses, _0);
	ZEPHIR_INIT_NVAR(_0);
	ZVAL_STRING(_0, "Xpl\\Cache\\Driver\\ApcDriver", 1);
	zephir_array_fast_append(driverClasses, _0);
	ZEPHIR_INIT_NVAR(_0);
	ZVAL_STRING(_0, "Xpl\\Cache\\Driver\\XCacheDriver", 1);
	zephir_array_fast_append(driverClasses, _0);
	zephir_is_iterable(driverClasses, &_2, &_1, 0, 0, "xpl/cache/cache.zep", 215);
	for (
	  ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
	  ; zephir_hash_move_forward_ex(_2, &_1)
	) {
		ZEPHIR_GET_HVALUE(classname, _3);
		ZEPHIR_INIT_NVAR(_4$$3);
		ZEPHIR_INIT_LNVAR(_5$$3);
		ZEPHIR_CONCAT_VS(_5$$3, classname, "::isAvailable");
		ZEPHIR_CALL_USER_FUNC(_4$$3, _5$$3);
		zephir_check_call_status();
		if (ZEPHIR_IS_TRUE_IDENTICAL(_4$$3)) {
			zephir_fetch_safe_class(_6$$4, classname);
				_7$$4 = zend_fetch_class(Z_STRVAL_P(_6$$4), Z_STRLEN_P(_6$$4), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
			object_init_ex(return_value, _7$$4);
			if (zephir_has_constructor(return_value TSRMLS_CC)) {
				ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", &_8, 0);
				zephir_check_call_status();
			}
			RETURN_MM();
		}
	}
	object_init_ex(return_value, xpl_cache_driver_memorydriver_ce);
	if (zephir_has_constructor(return_value TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0);
		zephir_check_call_status();
	}
	RETURN_MM();

}
Ejemplo n.º 3
0
PHP_METHOD(ADOdb_Cache, create) {

	zend_class_entry *_0, *_1, *_2;
	zval *type = NULL;

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

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


	if ((Z_TYPE_P(type) == IS_NULL)) {
		ZEPHIR_INIT_NVAR(type);
		ZVAL_LONG(type, 0);
	}
	do {
		if (ZEPHIR_IS_LONG(type, 0)) {
			object_init_ex(return_value, adodb_driver_cache_memory_ce);
			zephir_call_method_noret(return_value, "__construct");
			RETURN_MM();
		}
		if (ZEPHIR_IS_LONG(type, 2)) {
			_0 = zend_fetch_class(SL("ADOdb\\Driver\\Cache\\APC"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
			object_init_ex(return_value, _0);
			if (zephir_has_constructor(return_value TSRMLS_CC)) {
				zephir_call_method_noret(return_value, "__construct");
			}
			RETURN_MM();
		}
		if (ZEPHIR_IS_LONG(type, 3)) {
			_1 = zend_fetch_class(SL("ADOdb\\Driver\\Cache\\Libredis"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
			object_init_ex(return_value, _1);
			if (zephir_has_constructor(return_value TSRMLS_CC)) {
				zephir_call_method_noret(return_value, "__construct");
			}
			RETURN_MM();
		}
		_2 = zend_fetch_class(SL("ADOdb\\Driver\\Cache\\File"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
		object_init_ex(return_value, _2);
		if (zephir_has_constructor(return_value TSRMLS_CC)) {
			zephir_call_method_noret(return_value, "__construct");
		}
		RETURN_MM();
	} while(0);

	ZEPHIR_MM_RESTORE();

}
Ejemplo n.º 4
0
PHP_METHOD(Test_Trie, getTrieNodeByKey) {

	zend_class_entry *_5;
	zephir_nts_static zephir_fcall_cache_entry *_2 = NULL;
	int i, ZEPHIR_LAST_CALL_STATUS;
	zend_bool create;
	zval *key_param = NULL, *create_param = NULL, *trieNode = NULL, *keyLen, *character = NULL, _0 = zval_used_for_init, _1 = zval_used_for_init, *_3 = NULL, *_4 = NULL, *_6 = NULL, *_7;
	zval *key = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &key_param, &create_param);

	zephir_get_strval(key, key_param);
	if (!create_param) {
		create = 0;
	} else {
		create = zephir_get_boolval(create_param);
	}


	ZEPHIR_OBS_VAR(trieNode);
	zephir_read_property_this(&trieNode, this_ptr, SL("trie"), PH_NOISY_CC);
	ZEPHIR_INIT_VAR(keyLen);
	ZVAL_LONG(keyLen, zephir_fast_strlen_ev(key));
	i = 0;
	while (1) {
		if (!(ZEPHIR_GT_LONG(keyLen, i))) {
			break;
		}
		ZEPHIR_SINIT_NVAR(_0);
		ZVAL_LONG(&_0, i);
		ZEPHIR_SINIT_NVAR(_1);
		ZVAL_LONG(&_1, 1);
		ZEPHIR_CALL_FUNCTION(&character, "substr", &_2, key, &_0, &_1);
		zephir_check_call_status();
		ZEPHIR_OBS_NVAR(_3);
		zephir_read_property(&_3, trieNode, SL("children"), PH_NOISY_CC);
		if (!(zephir_array_isset(_3, character))) {
			if (create) {
				ZEPHIR_INIT_LNVAR(_4);
				_5 = zend_fetch_class(SL("tries\\trienode"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
				object_init_ex(_4, _5);
				if (zephir_has_constructor(_4 TSRMLS_CC)) {
					ZEPHIR_CALL_METHOD(NULL, _4, "__construct", NULL);
					zephir_check_call_status();
				}
				zephir_update_property_array(trieNode, SL("children"), character, _4 TSRMLS_CC);
			} else {
				RETURN_MM_BOOL(0);
			}
		}
		ZEPHIR_OBS_NVAR(_6);
		zephir_read_property(&_6, trieNode, SL("children"), PH_NOISY_CC);
		zephir_array_fetch(&_7, _6, character, PH_NOISY | PH_READONLY TSRMLS_CC);
		ZEPHIR_CPY_WRT(trieNode, _7);
		i += 1;
	}
	RETURN_CCTOR(trieNode);

}
Ejemplo n.º 5
0
PHP_METHOD(Owl_Cache_Driver_Redis, getInstance) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *_0, *_1, *_2, *_3 = NULL, *_4, *_5;

	ZEPHIR_MM_GROW();

	_0 = zephir_fetch_nproperty_this(this_ptr, SL("instance"), PH_NOISY_CC);
	if (Z_TYPE_P(_0) == IS_NULL) {
		ZEPHIR_INIT_VAR(_1);
		object_init_ex(_1, zephir_get_internal_ce(SS("redis") TSRMLS_CC));
		if (zephir_has_constructor(_1 TSRMLS_CC)) {
			ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 0);
			zephir_check_call_status();
		}
		zephir_update_property_this(this_ptr, SL("instance"), _1 TSRMLS_CC);
		_2 = zephir_fetch_nproperty_this(this_ptr, SL("instance"), PH_NOISY_CC);
		ZEPHIR_INIT_VAR(_3);
		ZVAL_STRING(_3, "localhost", ZEPHIR_TEMP_PARAM_COPY);
		ZEPHIR_CALL_METHOD(NULL, _2, "connect", NULL, 0, _3);
		zephir_check_temp_parameter(_3);
		zephir_check_call_status();
		_4 = zephir_fetch_nproperty_this(this_ptr, SL("instance"), PH_NOISY_CC);
		ZEPHIR_INIT_NVAR(_3);
		ZVAL_LONG(_3, 1);
		ZEPHIR_INIT_VAR(_5);
		ZVAL_LONG(_5, 1);
		ZEPHIR_CALL_METHOD(NULL, _4, "setoption", NULL, 0, _3, _5);
		zephir_check_call_status();
		RETURN_MM_MEMBER(this_ptr, "instance");
	}
	RETURN_MM_MEMBER(this_ptr, "instance");

}
Ejemplo n.º 6
0
PHP_METHOD(Test_Oo_OoDynamicA, getNew) {

	zend_class_entry *_1;
	zval className, fullClassName, _0;
	int ZEPHIR_LAST_CALL_STATUS;
	ZEPHIR_INIT_THIS();

	ZVAL_UNDEF(&className);
	ZVAL_UNDEF(&fullClassName);
	ZVAL_UNDEF(&_0);

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(&className);
	zephir_get_called_class(&className TSRMLS_CC);
	ZEPHIR_INIT_VAR(&fullClassName);
	ZEPHIR_CONCAT_SV(&fullClassName, "\\", &className);
	zephir_fetch_safe_class(_0, fullClassName);
	_1 = zephir_fetch_class_str_ex(Z_STRVAL_P(&_0), Z_STRLEN_P(&_0), ZEND_FETCH_CLASS_AUTO);
	object_init_ex(return_value, _1);
	if (zephir_has_constructor(return_value TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0);
		zephir_check_call_status();
	}
	RETURN_MM();

}
Ejemplo n.º 7
0
PHP_METHOD(Test_Instanceoff, testInstanceOf8) {

	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval *test_param = NULL, a;
	zval test;
	zval *this_ptr = getThis();

	ZVAL_UNDEF(&test);
	ZVAL_UNDEF(&a);

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

	zephir_get_strval(&test, test_param);


	ZEPHIR_INIT_VAR(&a);
	object_init_ex(&a, test_instanceoff_ce);
	if (zephir_has_constructor(&a TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, &a, "__construct", NULL, 0);
		zephir_check_call_status();
	}
	RETURN_MM_BOOL(zephir_is_instance_of(&a, Z_STRVAL_P(&test), Z_STRLEN_P(&test) TSRMLS_CC));

}
Ejemplo n.º 8
0
/**
 * Return the strategy to obtain the meta-data
 */
PHP_METHOD(Phalcon_Mvc_Model_MetaData, getStrategy) {

	zval _0, _1$$3;
	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval *this_ptr = getThis();

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

	ZEPHIR_MM_GROW();

	ZEPHIR_OBS_VAR(&_0);
	zephir_read_property(&_0, this_ptr, SL("_strategy"), PH_NOISY_CC);
	if (Z_TYPE_P(&_0) == IS_NULL) {
		ZEPHIR_INIT_VAR(&_1$$3);
		object_init_ex(&_1$$3, phalcon_mvc_model_metadata_strategy_introspection_ce);
		if (zephir_has_constructor(&_1$$3 TSRMLS_CC)) {
			ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 0);
			zephir_check_call_status();
		}
		zephir_update_property_zval(this_ptr, SL("_strategy"), &_1$$3);
	}
	RETURN_MM_MEMBER(getThis(), "_strategy");

}
PHP_METHOD(Configman_BaseServiceConfig, getService) {

	int ZEPHIR_LAST_CALL_STATUS;
	zend_class_entry *_1;
	zval *service_param = NULL, *service_class_name, *upcase_service, *_0 = NULL;
	zval *service = NULL;

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

	zephir_get_strval(service, service_param);


	ZEPHIR_INIT_VAR(upcase_service);
	zephir_ucfirst(upcase_service, service);
	ZEPHIR_INIT_VAR(service_class_name);
	ZEPHIR_CONCAT_SVSVS(service_class_name, "\\Configman\\Service\\", upcase_service, "\\", upcase_service, "Config");
	zephir_fetch_safe_class(_0, service_class_name);
	_1 = zend_fetch_class(Z_STRVAL_P(_0), Z_STRLEN_P(_0), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
	object_init_ex(return_value, _1);
	if (zephir_has_constructor(return_value TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0, service);
		zephir_check_call_status();
	}
	RETURN_MM();

}
Ejemplo n.º 10
0
PHP_METHOD(Phalcon_Translate_Adapter, __construct) {

	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval *options_param = NULL, interpolator;
	zval options;
	zval *this_ptr = getThis();

	ZVAL_UNDEF(&options);
	ZVAL_UNDEF(&interpolator);

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

	ZEPHIR_OBS_COPY_OR_DUP(&options, options_param);


	ZEPHIR_OBS_VAR(&interpolator);
	if (!(zephir_array_isset_string_fetch(&interpolator, &options, SL("interpolator"), 0))) {
		ZEPHIR_INIT_NVAR(&interpolator);
		object_init_ex(&interpolator, phalcon_translate_interpolator_associativearray_ce);
		if (zephir_has_constructor(&interpolator TSRMLS_CC)) {
			ZEPHIR_CALL_METHOD(NULL, &interpolator, "__construct", NULL, 0);
			zephir_check_call_status();
		}
	}
	ZEPHIR_CALL_METHOD(NULL, this_ptr, "setinterpolator", NULL, 0, &interpolator);
	zephir_check_call_status();
	ZEPHIR_MM_RESTORE();

}
Ejemplo n.º 11
0
/**
 * Creates an instance of the JWT bearer grant type.
 *
 * @param OAuth2\Storage\JWTBearerInterface storage A valid storage interface that implements storage hooks for the JWT bearer grant type.
 * @param string audience The audience to validate the token against. This is usually the full URI of the OAuth token requests endpoint.
 * @param OAuth2\Encryption\Jwt jwtUtil OPTONAL The class used to decode, encode and verify JWTs.
 */
PHP_METHOD(OAuth2_GrantType_JwtBearer, __construct) {

	int ZEPHIR_LAST_CALL_STATUS;
	zephir_nts_static zend_class_entry *_1 = NULL;
	zend_bool _0;
	zval *audience = NULL;
	zval *storage, *audience_param = NULL, *jwtUtil = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 1, &storage, &audience_param, &jwtUtil);

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

	if (likely(Z_TYPE_P(audience_param) == IS_STRING)) {
		zephir_get_strval(audience, audience_param);
	} else {
		ZEPHIR_INIT_VAR(audience);
		ZVAL_EMPTY_STRING(audience);
	}
	if (!jwtUtil) {
		ZEPHIR_CPY_WRT(jwtUtil, ZEPHIR_GLOBAL(global_null));
	} else {
		ZEPHIR_SEPARATE_PARAM(jwtUtil);
	}


	if (!(zephir_instance_of_ev(storage, oauth2_storage_jwtbearerinterface_ce TSRMLS_CC))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'storage' must be an instance of 'OAuth2\\Storage\\JwtBearerInterface'", "", 0);
		return;
	}
	_0 = Z_TYPE_P(jwtUtil) != IS_NULL;
	if (_0) {
		_0 = !zephir_instance_of_ev(jwtUtil, oauth2_encryption_encryptioninterface_ce TSRMLS_CC);
	}
	if (_0) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'jwtUtil' must be an instance of 'OAuth2\\Encryption\\EncryptionInterface'", "", 0);
		return;
	}
	zephir_update_property_this(this_ptr, SL("storage"), storage TSRMLS_CC);
	zephir_update_property_this(this_ptr, SL("audience"), audience TSRMLS_CC);
	if (Z_TYPE_P(jwtUtil) == IS_NULL) {
		ZEPHIR_INIT_NVAR(jwtUtil);
		if (!_1) {
			_1 = zend_fetch_class(SL("OAuth2\\Encryption\\Jwt"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
		}
		object_init_ex(jwtUtil, _1);
		if (zephir_has_constructor(jwtUtil TSRMLS_CC)) {
			ZEPHIR_CALL_METHOD(NULL, jwtUtil, "__construct", NULL);
			zephir_check_call_status();
		}
	}
	zephir_update_property_this(this_ptr, SL("jwtUtil"), jwtUtil TSRMLS_CC);
	ZEPHIR_MM_RESTORE();

}
Ejemplo n.º 12
0
/**
 * Initializes the internal handler, calling functions on it
 *
 * @param  string method
 * @param  array arguments
 * @return mixed
 */
PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, __call) {

	zend_class_entry *_1$$3;
	zval *_3;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *method_param = NULL, *arguments = NULL, *handler = NULL, *definition = NULL, *modelBinder = NULL, *bindCacheKey = NULL, *_0$$3 = NULL, *_2$$4 = NULL;
	zval *method = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &method_param, &arguments);

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


	ZEPHIR_OBS_VAR(handler);
	zephir_read_property_this(&handler, this_ptr, SL("_handler"), PH_NOISY_CC);
	ZEPHIR_OBS_VAR(definition);
	zephir_read_property_this(&definition, this_ptr, SL("_definition"), PH_NOISY_CC);
	if (Z_TYPE_P(handler) != IS_OBJECT) {
		ZEPHIR_INIT_NVAR(handler);
		zephir_fetch_safe_class(_0$$3, definition);
			_1$$3 = zend_fetch_class(Z_STRVAL_P(_0$$3), Z_STRLEN_P(_0$$3), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
		object_init_ex(handler, _1$$3);
		if (zephir_has_constructor(handler TSRMLS_CC)) {
			ZEPHIR_CALL_METHOD(NULL, handler, "__construct", NULL, 0);
			zephir_check_call_status();
		}
		zephir_update_property_this(this_ptr, SL("_handler"), handler TSRMLS_CC);
	}
	ZEPHIR_OBS_VAR(modelBinder);
	zephir_read_property_this(&modelBinder, this_ptr, SL("_modelBinder"), PH_NOISY_CC);
	if (Z_TYPE_P(modelBinder) != IS_NULL) {
		ZEPHIR_INIT_VAR(bindCacheKey);
		ZEPHIR_CONCAT_SVSV(bindCacheKey, "_PHMB_", definition, "_", method);
		ZEPHIR_CALL_METHOD(&_2$$4, modelBinder, "bindtohandler", NULL, 0, handler, arguments, bindCacheKey, method);
		zephir_check_call_status();
		ZEPHIR_CPY_WRT(arguments, _2$$4);
	}
	ZEPHIR_INIT_VAR(_3);
	zephir_create_array(_3, 2, 0 TSRMLS_CC);
	zephir_array_fast_append(_3, handler);
	zephir_array_fast_append(_3, method);
	ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, _3, arguments);
	zephir_check_call_status();
	RETURN_MM();

}
Ejemplo n.º 13
0
/**
 * Create internal connection to redis
 */
PHP_METHOD(Phalcon_Cache_Backend_Redis, _connect) {

	zend_bool _0, _1;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *options, *redis, *persistent, *success = NULL, *host, *port, *auth;

	ZEPHIR_MM_GROW();

	ZEPHIR_OBS_VAR(options);
	zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC);
	ZEPHIR_INIT_VAR(redis);
	object_init_ex(redis, zephir_get_internal_ce(SS("redis") TSRMLS_CC));
	if (zephir_has_constructor(redis TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL);
		zephir_check_call_status();
	}
	ZEPHIR_OBS_VAR(host);
	_0 = !(zephir_array_isset_string_fetch(&host, options, SS("host"), 0 TSRMLS_CC));
	if (!(_0)) {
		ZEPHIR_OBS_VAR(port);
		_0 = !(zephir_array_isset_string_fetch(&port, options, SS("port"), 0 TSRMLS_CC));
	}
	_1 = _0;
	if (!(_1)) {
		ZEPHIR_OBS_VAR(persistent);
		_1 = !(zephir_array_isset_string_fetch(&persistent, options, SS("persistent"), 0 TSRMLS_CC));
	}
	if (_1) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/redis.zep", 104);
		return;
	}
	if (zephir_is_true(persistent)) {
		ZEPHIR_CALL_METHOD(&success, redis, "pconnect", NULL, host, port);
		zephir_check_call_status();
	} else {
		ZEPHIR_CALL_METHOD(&success, redis, "connect", NULL, host, port);
		zephir_check_call_status();
	}
	if (!(zephir_is_true(success))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cannot connect to Redisd server", "phalcon/cache/backend/redis.zep", 114);
		return;
	}
	ZEPHIR_OBS_VAR(auth);
	if (zephir_array_isset_string_fetch(&auth, options, SS("auth"), 0 TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(&success, redis, "auth", NULL, auth);
		zephir_check_call_status();
		if (!(zephir_is_true(success))) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Redisd server is authentication failed", "phalcon/cache/backend/redis.zep", 121);
			return;
		}
	}
	zephir_update_property_this(this_ptr, SL("_redis"), redis TSRMLS_CC);
	ZEPHIR_MM_RESTORE();

}
Ejemplo n.º 14
0
PHP_METHOD(Test_Oo_OoParams, createOtherClassWithoutWriteCurrentNamespace) {

	ZEPHIR_MM_GROW();

	object_init_ex(return_value, test_oo_oodynamica_ce);
	if (zephir_has_constructor(return_value TSRMLS_CC)) {
		zephir_call_method_noret(return_value, "__construct");
	}
	RETURN_MM();

}
Ejemplo n.º 15
0
/**
 * Dumps a PHP array to a YAML string.
 *
 * The dump method, when supplied with an array, will do its best
 * to convert the array into friendly YAML.
 *
 * @param array array  PHP array
 * @param int   inline The level where you switch to inline YAML
 * @param int   indent The amount of spaces to use for indentation of nested nodes.
 * @param int   flags  A bit field of DUMP_* constants to customize the dumped YAML string
 *
 * @return string A YAML string representing the original PHP array
 */
PHP_METHOD(Symphir_Component_Yaml_Yaml, dump) {

	zephir_nts_static zend_class_entry *_0 = NULL;
	int inlineLevel, indent, flags, ZEPHIR_LAST_CALL_STATUS;
	zval *phpArray_param = NULL, *inlineLevel_param = NULL, *indent_param = NULL, *flags_param = NULL, yaml, _1, _2, _3;
	zval phpArray;
	ZEPHIR_INIT_THIS();

	ZVAL_UNDEF(&phpArray);
	ZVAL_UNDEF(&yaml);
	ZVAL_UNDEF(&_1);
	ZVAL_UNDEF(&_2);
	ZVAL_UNDEF(&_3);

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 3, &phpArray_param, &inlineLevel_param, &indent_param, &flags_param);

	zephir_get_arrval(&phpArray, phpArray_param);
	if (!inlineLevel_param) {
		inlineLevel = 2;
	} else {
		inlineLevel = zephir_get_intval(inlineLevel_param);
	}
	if (!indent_param) {
		indent = 4;
	} else {
		indent = zephir_get_intval(indent_param);
	}
	if (!flags_param) {
		flags = 0;
	} else {
		flags = zephir_get_intval(flags_param);
	}


	ZEPHIR_INIT_VAR(&yaml);
	if (!_0) {
	_0 = zephir_fetch_class_str_ex(SL("Symphir\\Component\\Yaml\\Dumper"), ZEND_FETCH_CLASS_AUTO);
	}
	object_init_ex(&yaml, _0);
	if (zephir_has_constructor(&yaml TSRMLS_CC)) {
		ZVAL_LONG(&_1, indent);
		ZEPHIR_CALL_METHOD(NULL, &yaml, "__construct", NULL, 0, &_1);
		zephir_check_call_status();
	}
	ZVAL_LONG(&_1, inlineLevel);
	ZVAL_LONG(&_2, 0);
	ZVAL_LONG(&_3, flags);
	ZEPHIR_RETURN_CALL_METHOD(&yaml, "dump", NULL, 0, &phpArray, &_1, &_2, &_3);
	zephir_check_call_status();
	RETURN_MM();

}
Ejemplo n.º 16
0
PHP_METHOD(Test_UseTest, testUseNamespaceAlias) {

	zend_class_entry *_0;

	ZEPHIR_MM_GROW();

	_0 = zend_fetch_class(SL("Oo\\OoConstruct"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
	object_init_ex(return_value, _0);
	if (zephir_has_constructor(return_value TSRMLS_CC)) {
		zephir_call_method_noret(return_value, "__construct");
	}
	RETURN_MM();

}
Ejemplo n.º 17
0
PHP_METHOD(Owl_Log_AbstractWriter, defaultFormatter) {

	int ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	object_init_ex(return_value, owl_log_formatter_line_ce);
	if (zephir_has_constructor(return_value TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0);
		zephir_check_call_status();
	}
	RETURN_MM();

}
Ejemplo n.º 18
0
PHP_METHOD(Test_UseTest, createInstance) {

	zend_class_entry *_0;

	ZEPHIR_MM_GROW();

	_0 = zend_fetch_class(SL("\\stdClass"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
	object_init_ex(return_value, _0);
	if (zephir_has_constructor(return_value TSRMLS_CC)) {
		zephir_call_method_noret(return_value, "__construct");
	}
	RETURN_MM();

}
Ejemplo n.º 19
0
PHP_METHOD(Test_Oo, testInstance3) {

	zval *o;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(o);
	object_init_ex(o, test_oo_oonoconstruct_ce);
	if (zephir_has_constructor(o TSRMLS_CC)) {
		zephir_call_method_noret(o, "__construct");
	}
	RETURN_CCTOR(o);

}
Ejemplo n.º 20
0
PHP_METHOD(Test_Oo_OoParams, createOtherClassWithoutWriteCurrentNamespace) {

	int ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	object_init_ex(return_value, test_oo_oodynamica_ce);
	if (zephir_has_constructor(return_value TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 0);
		zephir_check_call_status();
	}
	RETURN_MM();

}
Ejemplo n.º 21
0
PHP_METHOD(Test_Instanceoff, testInstanceOf2) {

	zval *a;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(a);
	object_init_ex(a, test_instanceoff_ce);
	if (zephir_has_constructor(a TSRMLS_CC)) {
		zephir_call_method_noret(a, "__construct");
	}
	RETURN_MM_BOOL(zephir_instance_of_ev(a, test_instanceoff_ce TSRMLS_CC));

}
Ejemplo n.º 22
0
PHP_METHOD(Lynx_DBAL_Driver_PgSQL, getNewPlatform) {

	int ZEPHIR_LAST_CALL_STATUS;

	ZEPHIR_MM_GROW();

	object_init_ex(return_value, lynx_dbal_platform_pgsql_ce);
	if (zephir_has_constructor(return_value TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL);
		zephir_check_call_status();
	}
	RETURN_MM();

}
Ejemplo n.º 23
0
/**
 * Initializes the internal handler, calling functions on it
 *
 * @param  string method
 * @param  array arguments
 * @return mixed
 */
PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, __call) {

	zval *_2;
	int ZEPHIR_LAST_CALL_STATUS;
	zend_class_entry *_1;
	zval *method_param = NULL, *arguments, *handler = NULL, *definition, *_0 = NULL;
	zval *method = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &method_param, &arguments);

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

	if (likely(Z_TYPE_P(method_param) == IS_STRING)) {
		zephir_get_strval(method, method_param);
	} else {
		ZEPHIR_INIT_VAR(method);
		ZVAL_EMPTY_STRING(method);
	}


	ZEPHIR_OBS_VAR(handler);
	zephir_read_property_this(&handler, this_ptr, SL("_handler"), PH_NOISY_CC);
	if (Z_TYPE_P(handler) != IS_OBJECT) {
		ZEPHIR_OBS_VAR(definition);
		zephir_read_property_this(&definition, this_ptr, SL("_definition"), PH_NOISY_CC);
		ZEPHIR_INIT_NVAR(handler);
		zephir_fetch_safe_class(_0, definition);
		_1 = zend_fetch_class(Z_STRVAL_P(_0), Z_STRLEN_P(_0), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
		object_init_ex(handler, _1);
		if (zephir_has_constructor(handler TSRMLS_CC)) {
			ZEPHIR_CALL_METHOD(NULL, handler, "__construct", NULL);
			zephir_check_call_status();
		}
		zephir_update_property_this(this_ptr, SL("_handler"), handler TSRMLS_CC);
	}
	ZEPHIR_INIT_VAR(_2);
	zephir_create_array(_2, 2, 0 TSRMLS_CC);
	zephir_array_fast_append(_2, handler);
	zephir_array_fast_append(_2, method);
	ZEPHIR_CALL_USER_FUNC_ARRAY(return_value, _2, arguments);
	zephir_check_call_status();
	RETURN_MM();

}
Ejemplo n.º 24
0
PHP_METHOD(Test_Instanceoff, testInstanceOf2) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *a;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(a);
	object_init_ex(a, test_instanceoff_ce);
	if (zephir_has_constructor(a TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, a, "__construct", NULL, 0);
		zephir_check_call_status();
	}
	RETURN_MM_BOOL(zephir_instance_of_ev(a, test_instanceoff_ce TSRMLS_CC));

}
Ejemplo n.º 25
0
PHP_METHOD(Test_Oo, testInstance3) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *o;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(o);
	object_init_ex(o, test_oo_oonoconstruct_ce);
	if (zephir_has_constructor(o TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, o, "__construct", NULL);
		zephir_check_call_status();
	}
	RETURN_CCTOR(o);

}
Ejemplo n.º 26
0
/**
 * Create internal connection to memcached
 */
PHP_METHOD(Phalcon_Cache_Backend_Memcache, _connect) {

    zend_bool _0, _1;
    zval *options = NULL, *memcache = NULL, *persistent = NULL, *success = NULL, *host = NULL, *port = NULL;
    int ZEPHIR_LAST_CALL_STATUS;

    ZEPHIR_MM_GROW();

    ZEPHIR_OBS_VAR(options);
    zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC);
    ZEPHIR_INIT_VAR(memcache);
    object_init_ex(memcache, zephir_get_internal_ce(SS("memcache") TSRMLS_CC));
    if (zephir_has_constructor(memcache TSRMLS_CC)) {
        ZEPHIR_CALL_METHOD(NULL, memcache, "__construct", NULL, 0);
        zephir_check_call_status();
    }
    ZEPHIR_OBS_VAR(host);
    _0 = !(zephir_array_isset_string_fetch(&host, options, SS("host"), 0 TSRMLS_CC));
    if (!(_0)) {
        ZEPHIR_OBS_VAR(port);
        _0 = !(zephir_array_isset_string_fetch(&port, options, SS("port"), 0 TSRMLS_CC));
    }
    _1 = _0;
    if (!(_1)) {
        ZEPHIR_OBS_VAR(persistent);
        _1 = !(zephir_array_isset_string_fetch(&persistent, options, SS("persistent"), 0 TSRMLS_CC));
    }
    if (_1) {
        ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/memcache.zep", 105);
        return;
    }
    if (zephir_is_true(persistent)) {
        ZEPHIR_CALL_METHOD(&success, memcache, "pconnect", NULL, 0, host, port);
        zephir_check_call_status();
    } else {
        ZEPHIR_CALL_METHOD(&success, memcache, "connect", NULL, 0, host, port);
        zephir_check_call_status();
    }
    if (!(zephir_is_true(success))) {
        ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cannot connect to Memcached server", "phalcon/cache/backend/memcache.zep", 115);
        return;
    }
    zephir_update_property_this(this_ptr, SL("_memcache"), memcache TSRMLS_CC);
    ZEPHIR_MM_RESTORE();

}
Ejemplo n.º 27
0
/**
 * Starts the profile of a SQL sentence
 *
 * @param string sqlStatement
 * @return Phalcon\Db\Profiler
 */
PHP_METHOD(Phalcon_Db_Profiler, startProfile) {

	zephir_nts_static zephir_fcall_cache_entry *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *sqlStatement, *sqlVariables = NULL, *sqlBindTypes = NULL, *activeProfile, *_3;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 2, &sqlStatement, &sqlVariables, &sqlBindTypes);

	if (!sqlVariables) {
		sqlVariables = ZEPHIR_GLOBAL(global_null);
	}
	if (!sqlBindTypes) {
		sqlBindTypes = ZEPHIR_GLOBAL(global_null);
	}


	ZEPHIR_INIT_VAR(activeProfile);
	object_init_ex(activeProfile, phalcon_db_profiler_item_ce);
	if (zephir_has_constructor(activeProfile TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, activeProfile, "__construct", NULL);
		zephir_check_call_status();
	}
	ZEPHIR_CALL_METHOD(NULL, activeProfile, "setsqlstatement", &_0, sqlStatement);
	zephir_check_call_status();
	if (Z_TYPE_P(sqlVariables) == IS_ARRAY) {
		ZEPHIR_CALL_METHOD(NULL, activeProfile, "setsqlvariables", &_1, sqlVariables);
		zephir_check_call_status();
	}
	if (Z_TYPE_P(sqlBindTypes) == IS_ARRAY) {
		ZEPHIR_CALL_METHOD(NULL, activeProfile, "setsqlbindtypes", &_2, sqlBindTypes);
		zephir_check_call_status();
	}
	ZEPHIR_INIT_VAR(_3);
	zephir_microtime(_3, ZEPHIR_GLOBAL(global_true) TSRMLS_CC);
	ZEPHIR_CALL_METHOD(NULL, activeProfile, "setinitialtime", &_4, _3);
	zephir_check_call_status();
	if ((zephir_method_exists_ex(this_ptr, SS("beforestartprofile") TSRMLS_CC) == SUCCESS)) {
		ZEPHIR_CALL_METHOD(NULL, this_ptr, "beforestartprofile", NULL, activeProfile);
		zephir_check_call_status();
	}
	zephir_update_property_this(this_ptr, SL("_activeProfile"), activeProfile TSRMLS_CC);
	RETURN_THIS();

}
Ejemplo n.º 28
0
PHP_METHOD(Test_Oo, testInstance11) {

	zval *o, *_0, *_1;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(o);
	object_init_ex(o, test_oo_ooconstructparams_ce);
	if (zephir_has_constructor(o TSRMLS_CC)) {
		ZEPHIR_INIT_VAR(_0);
		ZVAL_LONG(_0, 1);
		ZEPHIR_INIT_VAR(_1);
		ZVAL_LONG(_1, 2);
		zephir_call_method_p2_noret(o, "__construct", _0, _1);
	}
	RETURN_CCTOR(o);

}
Ejemplo n.º 29
0
PHP_METHOD(Test_Mcall, aa) {

	zephir_nts_static zephir_fcall_cache_entry *_0 = NULL;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *a;

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(a);
	object_init_ex(a, test_mcall_ce);
	if (zephir_has_constructor(a TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, a, "__construct", NULL);
		zephir_check_call_status();
	}
	ZEPHIR_RETURN_CALL_METHOD(a, "bb", &_0);
	zephir_check_call_status();
	RETURN_MM();

}
Ejemplo n.º 30
0
PHP_METHOD(Test_Instanceoff, testInstanceOf2) {

	zval a;
	zend_long ZEPHIR_LAST_CALL_STATUS;
	zval *this_ptr = getThis();

	ZVAL_UNDEF(&a);

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(&a);
	object_init_ex(&a, test_instanceoff_ce);
	if (zephir_has_constructor(&a TSRMLS_CC)) {
		ZEPHIR_CALL_METHOD(NULL, &a, "__construct", NULL, 0);
		zephir_check_call_status();
	}
	RETURN_MM_BOOL(zephir_instance_of_ev(&a, test_instanceoff_ce TSRMLS_CC));

}