/** * @return Config * @throws \Exception */ public static function initIntegrationConfig() { static::$config = static::readConfigFile(dirname(__DIR__) . '/config.php'); $config = static::initUnitConfig(); $config->appId = self::confxt('app_id'); $config->appSecret = self::confxt('app_secret'); $config->accessToken = self::confxt('access_token'); $config->accountId = self::confxt('act_id'); $config->pageId = self::confxt('page_id'); $config->appUrl = self::confxt('app_url'); $config->businessId = self::confxt('business_id'); // Optionals $config->secondaryBusinessId = self::confx('secondary_business_id', ''); $config->secondaryAccountId = self::confx('secondary_account_id', ''); $config->secondaryPageId = self::confx('secondary_page_id', ''); $config->secondaryAppId = self::confx('secondary_app_id', ''); $config->graphBaseDomain = self::confx('graph_base_domain'); $config->skipSslVerification = self::confx('skip_ssl_verification', false); $config->curlLogger = self::confx('curl_logger'); if (date_default_timezone_set(self::confxt('act_timezone')) === false) { throw new \InvalidArgumentException(sprintf('Not a valid timezone: "%s"', self::confx('act_timezone'))); } SkippableFeaturesManager::setInstance(new SkippableFeaturesManager(self::confx('skip_if', array()))); return $config; }
/** * @return Config */ public function getConfig() { if ($this->config === null) { $this->config = parent::getConfig(); $this->config->appId = $this->confxt('app_id'); $this->config->appSecret = $this->confxt('app_secret'); $this->config->accessToken = $this->confxt('access_token'); $this->config->accountId = $this->confxt('act_id'); $this->config->pageId = $this->confxt('page_id'); $this->config->appUrl = $this->confxt('app_url'); $this->config->businessId = $this->confxt('business_id'); // Optionals $this->config->secondaryBusinessId = $this->confx('secondary_business_id', ''); $this->config->secondaryAccountId = $this->confx('secondary_account_id', ''); $this->config->secondaryPageId = $this->confx('secondary_page_id', ''); $this->config->secondaryAppId = $this->confx('secondary_app_id', ''); $this->config->graphBaseDomain = $this->confx('graph_base_domain'); $this->config->skipSslVerification = $this->confx('skip_ssl_verification', false); $this->config->curlLogger = $this->confx('curl_logger'); if (date_default_timezone_set($this->confxt('act_timezone')) === false) { throw new \InvalidArgumentException(sprintf('Not a valid timezone: "%s"', $this->confx('act_timezone'))); } SkippableFeaturesManager::setInstance(new SkippableFeaturesManager($this->confx('skip_if', array()))); } return $this->config; }