in consumer/FSOFConsumer.php [32:86]
public static function init(array $settings = NULL)
{
if (self::isConsumerInit())
{
// Do not allow execution twice
return;
}
\Logger::getLogger(__CLASS__)->info("consumer cfg:".json_encode($settings, true));
$consumerRoot = __DIR__;
$fsofBootPath = dirname($consumerRoot);
//加载commom
$fsofCommonPath = $fsofBootPath.DIRECTORY_SEPARATOR.'common';
require_once($fsofCommonPath.DIRECTORY_SEPARATOR.'BootStrap.php');
//加载registry
$fsofRegistryPath = $fsofBootPath.DIRECTORY_SEPARATOR.'registry';
require_once($fsofRegistryPath.DIRECTORY_SEPARATOR.'BootStrap.php');
//检查输入参数app_src
if ((!isset($settings['app_src'])) || (!isset($settings['app_name'])))
{
throw new \Exception("FSOFConsumer::init传入的app的src路径参数不准确");
}
$consumerConfigFile = $settings['app_src'];
$consumerConfigFile = rtrim($consumerConfigFile, DIRECTORY_SEPARATOR);
$consumerConfigFile = $consumerConfigFile.DIRECTORY_SEPARATOR.'consumer'.DIRECTORY_SEPARATOR.$settings['app_name'].'.consumer';
if (file_exists($consumerConfigFile))
{
try
{
$consumerConfig = parse_ini_file($consumerConfigFile, true);
}
catch (\Exception $e)
{
throw new \Exception("consumer配置文件有误[".$consumerConfigFile."]");
}
}
else
{
$consumerConfig = array();
}
self::$_initSetting = $settings;
//注册consumer框架的autoLoader
self::registerConsumerFrameAutoLoader($consumerRoot);
//注册consumer的动态代理工厂
ProxyFactory::setConsumerConfig($consumerConfig, $consumerConfigFile, $settings);
// FSOFConsumer is now initialized
self::$_init = TRUE;
}