示例#1
0
/**
 * Removes a service from the services container using the array syntax
 *
 * @param string $alias
 */
PHP_METHOD(Phalcon_DI, offsetUnset){

	zval *alias;

	phalcon_fetch_params(0, 1, 0, &alias);
	
	RETURN_CCTORW(alias);
}
示例#2
0
文件: none.c 项目: BlueShark/cphalcon
/**
 * Prepares data to be retrieved to user
 *
 * @param mixed $data
 */
PHP_METHOD(Phalcon_Cache_Frontend_None, afterRetrieve){

	zval *data;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &data) == FAILURE) {
		RETURN_NULL();
	}

	RETURN_CCTORW(data);
}
示例#3
0
/**
 * x
 */
PHP_METHOD(Test_Router, doRemoveExtraSlashes) {

	zval *route;

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



	RETURN_CCTORW(route);

}
示例#4
0
PHP_METHOD(Test_Mcall, optionalParameterVar) {

	zval *param = NULL;

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

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


	RETURN_CCTORW(param);

}
/**
 * Set the default Di container to return by getDefault()
 *
 * @param DiInterface $di
 * @return DiInterface
 */
PHP_METHOD(Pdm_Di_Container, setDefault) {

	zval *di;

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



	if (!(zephir_instance_of_ev(di, pdm_di_containerinterface_ce TSRMLS_CC))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(spl_ce_InvalidArgumentException, "Parameter 'di' must be an instance of 'Pdm\\Di\\ContainerInterface'", "", 0);
		return;
	}
	zephir_update_static_property_ce(pdm_di_container_ce, SL("defaultInstance"), di TSRMLS_CC);
	RETURN_CCTORW(di);

}
示例#6
0
文件: di.c 项目: 11mariom/cphalcon
/**
 * Sets a service using a raw Phalcon\DI\Service definition
 *
 * @param string $name
 * @param Phalcon\DI\ServiceInterface $rawDefinition
 * @return Phalcon\DI\ServiceInterface
 */
PHP_METHOD(Phalcon_DI, setRaw){

	zval *name, *raw_definition;

	phalcon_fetch_params(0, 2, 0, &name, &raw_definition);
	
	if (Z_TYPE_P(name) != IS_STRING) {
		PHALCON_THROW_EXCEPTION_STRW(phalcon_di_exception_ce, "The service name must be a string");
		return;
	}
	if (Z_TYPE_P(raw_definition) != IS_OBJECT) {
		PHALCON_THROW_EXCEPTION_STRW(phalcon_di_exception_ce, "The service definition must be an object");
		return;
	}
	
	phalcon_update_property_array(this_ptr, SL("_services"), name, raw_definition TSRMLS_CC);
	
	RETURN_CCTORW(raw_definition);
}