示例#1
0
/**
 * @brief mixed& Phalcon\Registry::offsetGet(mixed $offset)
 */
PHP_METHOD(Phalcon_Registry, offsetGet){

	zval *property;

	phalcon_fetch_params(0, 1, 0, &property);

	if (!phalcon_read_property_array(return_value, getThis(), SL("_data"), property)) {
		RETURN_NULL();
	}
}
示例#2
0
/**
 * @brief mixed& Phalcon\Registry::offsetGet(mixed $offset)
 */
PHP_METHOD(Phalcon_Registry, offsetGet){
	zval *property, *callback;

	phalcon_fetch_params(0, 1, 0, &property);

	if (phalcon_isset_property_array(getThis(), SL("_data"), property)) {
		callback = phalcon_read_property_array(getThis(), SL("_data"), property);
		RETURN_ZVAL(callback, 1, 0);
	}

	RETURN_NULL();
}
示例#3
0
/**
 * @brief void Phalcon\Registry::__call(string $name, array $arguments)
 */
PHP_METHOD(Phalcon_Registry, __call){
	zval *name, *arguments, *callback;

	phalcon_fetch_params(0, 2, 0, &name, &arguments);
	PHALCON_ENSURE_IS_STRING(name);

	if (phalcon_isset_property_array(getThis(), SL("_data"), name)) {
		callback = phalcon_read_property_array(getThis(), SL("_data"), name);
		PHALCON_RETURN_CALL_ZVAL_FUNCTIONW(callback, arguments);
	} else {
		zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Call to undefined method Phalcon\\Registry::%s", Z_STRVAL_P(name));
	}
}
示例#4
0
文件: di.c 项目: googlle/cphalcon7
/**
 * Returns a Phalcon\DI\Service instance
 *
 * @param string $name
 * @return Phalcon\DI\ServiceInterface
 */
PHP_METHOD(Phalcon_DI, getService){

	zval *name, *service;

	phalcon_fetch_params(0, 1, 0, &name);
	PHALCON_ENSURE_IS_STRING(name);
	
	if (phalcon_isset_property_array(getThis(), SL("_services"), name)) {
		service = phalcon_read_property_array(getThis(), SL("_services"), name);
		RETURN_ZVAL(service, 1, 0);
	}

	zend_throw_exception_ex(phalcon_di_exception_ce, 0, "Service '%s' was not found in the dependency injection container", Z_STRVAL_P(name));
}