Fetch the dynamic marketplaces configuration for this environment
and configure the Maestrano presets

@param $preset string Dev-Platform configuration preset
@throws Maestrano_Config_Error
13987
public static function loadMarketplacesConfigWithPreset($preset)
    {
        if (self::$cache == NULL)
            self::$cache = new Maestrano_Util_Cache();
        self::$cache->cache_path = dirname(__FILE__) . '/';
        self::$cache->cache_time = 43200; // 12h

        if(!$data = self::$cache->get_cache('dev-platform')) {
            $apiKey = self::$config[$preset]['environment.api_key'];
            $apiSecret = self::$config[$preset]['environment.api_secret'];
            $host = self::$config[$preset]['dev-platform.host'];
            $api_path = self::$config[$preset]['dev-platform.api_path'];

            try {
                // Call to the dev-platform
                $response = \Httpful\Request::get($host . $api_path . "marketplaces")
                    ->authenticateWith($apiKey, $apiSecret)
                    ->send();
                $data = $response->raw_body;

                if ($response->code >= 400) {
                    throw new Maestrano_Config_Error("HTTP Error, code: $response->code", $response->code);
                }
            } catch (Exception $e) {
                error_log("maestrano-php: An error occurred while retrieving the marketplaces. Error: $e");
                error_log("maestrano-php: Re-using existing cached configuration, if any.");
                if (!$data = self::$cache->get_cached_file('dev-platform'))
                    throw new Maestrano_Config_Error("No cached configuration found.");
            }

            self::$cache->set_cache('dev-platform', $data);
        }

        // Transform json as an associative array
        $json_body = json_decode($data, true);

        // Dev-platform error management
        if (array_key_exists('error', $json_body))
            throw new Maestrano_Config_Error("An error occurred while retrieving the marketplaces. Body content: " . print_r($json_body, true));

        self::loadMultipleMarketplaces($json_body['marketplaces']);
    }
1356728
public function getConfigSetting($setting) {
		$source = $this->getConfigData();
		foreach(func_get_args() as $setting) {
			if(empty($source[$setting])) return null;
			$source = $source[$setting];
		}
		return $source;
	}
473914
public static function add(PresetInterface $preset)
    {
        $db = Loader::db();
        $db->Execute('insert into AreaLayouts (arLayoutIsPreset) values (?)', array(1));
        $arLayoutID = $db->Insert_ID();
        if ($arLayoutID) {
            $db->Execute('insert into AreaLayoutsUsingPresets (arLayoutID, preset) values (?, ?)', array($arLayoutID, $preset->getIdentifier()));
            $ar = static::getByID($arLayoutID);

            return $ar;
        }
    }
1272539
public function getPageConfig(string $page)
    {
        if (!array_key_exists($page, $this->config['pages'])) {
            throw new InvalidPageException(
                sprintf(
                    'Page "%s" not found in current configuration. Available pages are: "%s"',
                    $page,
                    implode('", "', array_keys($this->config['pages']))
                )
            );
        }

        return (array) $this->config['pages'][$page];
    }
519432
public function getConfig($key = null)
	{
		if (isLaravel5())
		{
			$configNameSpace = 'vendor.'.$this->packageVendor.'.'.$this->packageName.'.';
											//question ? result if true :(result is false)
			$key = $configNameSpace  . ($key ? '.'.$key : '');

			return $this->app['config']->get($key);
		}
	}
955274
public static function autoConfigure($configFile = null) {
        Maestrano_Config_Client::with('dev-platform')->configure($configFile);
        Maestrano_Config_Client::with('dev-platform')->loadMarketplacesConfig();
    }
1317946
private function initializeConfig(Application $app)
    {
        $config_provider = $app->make('Concrete\Core\Config\ConfigServiceProvider');
        $config_provider->register();

        /*
         * @var \Concrete\Core\Config\Repository\Repository
         */
        $config = $app->make('config');

        return $config;
    }
1187737
public static function configure(ServicesConfig $config)
    {
        $config->validate();

        $gateway = null;
        if (isset($config->merchantId) && !empty($config->merchantId)) {
            $gateway = new RealexConnector();
            $gateway->merchantId = $config->merchantId;
            $gateway->sharedSecret = $config->sharedSecret;
            $gateway->accountId = $config->accountId;
            $gateway->channel = $config->channel;
            $gateway->rebatePassword = $config->rebatePassword;
            $gateway->refundPassword = $config->refundPassword;
            $gateway->timeout = $config->timeout;
            $gateway->serviceUrl = $config->serviceUrl;
            $gateway->hostedPaymentConfig = $config->hostedPaymentConfig;
            $gateway->curlOptions = $config->curlOptions;
            static::$instance = new static($gateway, $gateway);
        } else {
            $gateway = new PorticoConnector();
            $gateway->siteId = $config->siteId;
            $gateway->licenseId = $config->licenseId;
            $gateway->deviceId = $config->deviceId;
            $gateway->username = $config->username;
            $gateway->password = $config->password;
            $gateway->secretApiKey = $config->secretApiKey;
            $gateway->developerId = $config->developerId;
            $gateway->versionNumber = $config->versionNumber;
            $gateway->timeout = $config->timeout;
            $gateway->serviceUrl = $config->serviceUrl . '/Hps.Exchange.PosGateway/PosGatewayService.asmx';
            $gateway->curlOptions = $config->curlOptions;

            $payplanEndPoint = (strpos(strtolower($config->serviceUrl), 'cert.') > 0) ?
                                '/Portico.PayPlan.v2/':
                                '/PayPlan.v2/';
            
            $recurring = new PayPlanConnector();
            $recurring->siteId = $config->siteId;
            $recurring->licenseId = $config->licenseId;
            $recurring->deviceId = $config->deviceId;
            $recurring->username = $config->username;
            $recurring->password = $config->password;
            $recurring->secretApiKey = $config->secretApiKey;
            $recurring->developerId = $config->developerId;
            $recurring->versionNumber = $config->versionNumber;
            $recurring->timeout = $config->timeout;
            $recurring->serviceUrl = $config->serviceUrl . $payplanEndPoint;
            $recurring->curlOptions = $config->curlOptions;

            static::$instance = new static($gateway, $recurring);
        }
    }
1315736
private function bind(array $configurations)
    {
        $configuratorFactory = clone $this->configuratorFactory;

        if (isset($configurations['crud'])) {
            /** @var CrudConfigurator $crudConfigurator */
            $crudConfigurator = $configuratorFactory->getConfigurator(CrudConfigurator::class);
            $crudConfigurator->setCrud($configurations['crud']);
            $configuratorFactory->addConfigurator($crudConfigurator);
        }

        if (isset($configurations['driver'])) {
            /** @var DriverConfigurator $driverConfigurator */
            $driverConfigurator = $configuratorFactory->getConfigurator(DriverConfigurator::class);
            $driverConfigurator->setDriver($configurations['driver']);
            $configuratorFactory->addConfigurator($driverConfigurator);
        }

        if (isset($configurations['grid'])) {
            /** @var GridConfigurator $gridConfigurator */
            $gridConfigurator = $configuratorFactory->getConfigurator(GridConfigurator::class);
            $gridConfigurator->setGrid($configurations['grid']);
            $configuratorFactory->addConfigurator($gridConfigurator);
        }

        if (isset($configurations['page'])) {
            /** @var PageConfigurator $pageConfigurator */
            $pageConfigurator = $configuratorFactory->getConfigurator(PageConfigurator::class);
            $pageConfigurator->setPage($configurations['page']);
            $configuratorFactory->addConfigurator($pageConfigurator);
        }

        if (isset($configurations['plugin'])) {
            /** @var PluginConfigurator $pluginConfigurator */
            $pluginConfigurator = $configuratorFactory->getConfigurator(PluginConfigurator::class);
            $pluginConfigurator->setPlugin($configurations['plugin']);
            $configuratorFactory->addConfigurator($pluginConfigurator);
        }

        if (isset($configurations['security'])) {
            /** @var SecurityConfigurator $securityConfigurator */
            $securityConfigurator = $configuratorFactory->getConfigurator(SecurityConfigurator::class);
            $securityConfigurator->setSecurity($configurations['security']);
            $configuratorFactory->addConfigurator($securityConfigurator);
        }

        if (isset($configurations['util'])) {
            /** @var UtilConfigurator $utilConfigurator */
            $utilConfigurator = $configuratorFactory->getConfigurator(UtilConfigurator::class);
            $utilConfigurator->setUtil($configurations['util']);
            $configuratorFactory->addConfigurator($utilConfigurator);
        }

        return $configuratorFactory;
    }
1098727
public function resolvePredicate(Predicate $predicate) {
        $this->_bindings = array_merge($this->_bindings, $predicate->getBindings());

        return $this;
    }
255888
public function sdkConfig(string $prepayId): array
    {
        $config = $this->bridgeConfig($prepayId, false);

        $config['timestamp'] = $config['timeStamp'];
        unset($config['timeStamp']);

        return $config;
    }
134435
public function getConfig($key = '')
    {
        if (empty($key)) {
            return $this->_config;
        }

        if (!\array_key_exists($key, $this->_config)) {
            throw new InvalidException('Config key is not set: '.$key);
        }

        return $this->_config[$key];
    }
1279207
public function getConfiguredPlatform(PDO $con = null, $database = null)
    {
        $buildConnection = $this->getBuildConnection($database);
        //First try to load platform from the user provided build properties
        if ($this->getBuildProperty('platformClass')) {
            // propel.platform.class = platform.${propel.database}Platform by default
            $clazz = $this->getClassname('platformClass');
        } elseif (null !== $buildConnection['adapter']) {
            $clazz = Phing::import('platform.' . ucfirst($buildConnection['adapter']) . 'Platform');
        } else {
            return null;
        }
        $platform = new $clazz();

        if (!$platform instanceof PropelPlatformInterface) {
            throw new BuildException("Specified platform class ($clazz) does not implement teh PropelPlatformInterface interface.");
        }

        if ($this->getBuildProperty('disableIdentifierQuoting')) {
            $platform->setIdentifierQuoting(false);
        } else {
            $platform->setIdentifierQuoting(true);
        }
        $platform->setConnection($con);
        $platform->setGeneratorConfig($this);

        return $platform;
    }
463440
protected function fetchConfig($key)
	{
		$config = $this->config[ $key ];

		if (isset($this->configOverride[ $this->renderMode ][ $key ])) {
			$override = $this->configOverride[ $this->renderMode ][ $key ];
			$config = array_merge($config, $override);
		}

		return $config;
	}
52330
public static function configureWithPreset($preset, $settings = null)
    {
        // Load from JSON file if string provided
        if (is_string($settings)) {
            return self::configureWithPreset($preset, json_decode(file_get_contents($settings), true));
        }

        // Ensure preset is initialized
        if (!array_key_exists($preset, self::$config) || is_null(self::$config[$preset])) {
            self::$config[$preset] = array();
        }

        //-------------------------------
        // Dev Platform Config
        //-------------------------------
        self::configureDevPlatformSetting('dev-platform', 'host', 'MNO_DEVPL_HOST', $preset, $settings);
        self::configureDevPlatformSetting('dev-platform', 'api_path', 'MNO_DEVPL_API_PATH', $preset, $settings);
        self::configureDevPlatformSetting('environment', 'api_key', 'MNO_DEVPL_ENV_KEY', $preset, $settings);
        self::configureDevPlatformSetting('environment', 'api_secret', 'MNO_DEVPL_ENV_SECRET', $preset, $settings);

        return self::$config[$preset];
    }
46304
public function load()
    {
        if (!empty($this->_statements)) {
            return;
        }

        foreach ($this->data as $type=>$item) {
            if (!is_array($item)) {
                $item = array( $item );
            }
            $use_statements = Config::get('use-statements');
            $adapter_name = isset($use_statements[$type]) ? $use_statements[$type] : null;
            if (!empty($adapter_name)) {
                $cls_name = 'AssetsManager\Package\PresetAdapter\\'.$adapter_name;
                if (@class_exists($cls_name)) {
                    $interfaces = class_implements($cls_name);
                    $config_interface = Config::getInternal('assets-preset-adapter-interface');
                    if (in_array($config_interface, $interfaces)) {
                        if (!isset($this->_statements[$type])) {
                            $this->_statements[$type] = array();
                        }
                        foreach ($item as $item_ctt) {
                            if (!is_array($item_ctt)) {
                                $item_ctt = array( $item_ctt );
                            }
                            $statement = new $cls_name($item_ctt, $this);
                            $statement->parse();
                            $this->_statements[$type][] = $statement;
                        }
                    } else {
                        throw new \DomainException(
                            sprintf('Preset statement class "%s" must implement interface "%s"!',
                                $cls_name, $config_interface)
                        );
                    }
                } else {
                    throw new \DomainException(
                        sprintf('Preset statement class "%s" not found!', $cls_name)
                    );
                }
            } else {
                throw new \LogicException(
                    sprintf('Unknown preset statement type "%s" in preset "%s"!', $type, $this->getName())
                );
            }
        }
    }
787160
private function configureDatabase(array $config) {
        if (!isset($config['database']) || !isset($config['database']['adapter'])) {
            throw new InvalidArgumentException('Missing database adapter configuration for the image variations event listener', 500);
        }

        $config = $config['database'];

        if (is_callable($config['adapter'])) {
            $databaseAdapter = $config['adapter']();
        } else if (is_string($config['adapter'])) {
            $databaseAdapter = new $config['adapter'](isset($config['params']) ? $config['params'] : null);
        } else {
            $databaseAdapter = $config['adapter'];
        }

        if (!($databaseAdapter instanceof DatabaseInterface)) {
            throw new InvalidArgumentException('Invalid database adapter for the image variations event listener', 500);
        }

        $this->database = $databaseAdapter;
    }