@param \Rancoud\Database\Configurator|array $configuration

@throws \Exception
162929
public static function useNewDatabaseDriver($configuration): void
    {
        static::throwExceptionIfHasStarted();

        $driver = new Database();
        $driver->setNewDatabase($configuration);

        static::$driver = $driver;
    }
983144
public function init(?string $configuration = 'project'): void
    {
        $config = Core::i()->config->getConfiguration($configuration);
        if (isset($config['site_name'])) {
            $this->site_name = $config['site_name'];
        }
        if (isset($config['title_format'])) {
            $this->title_format = $config['title_format'];
        }
    }
1020908
private function addDefaultActions(array &$configuration)
    {
        if (!key_exists('actions', $configuration) || !is_array($configuration['actions'])) {
            $configuration['actions'] = [];
        }

        if (0 !== count($configuration['actions'])) {
            return;
        }
        $configuration['actions'] = [
            'create' => [],
            'list' => [],
            'edit' => [],
            'delete' => [],
        ];
    }
39888
public function checkAlias(array $configuration)
    {
        foreach ($configuration as $classNamespace => $classConfiguration) {
            if (
                isset($classConfiguration['alias']) &&
                $classConfiguration['alias']
            ) {
                return $this;
            }
        }

        throw new TranslationDefinitionException();
    }
1082870
public function addConfiguration(ConfigurationInterface $configuration)
    {
        if (isset($this->configurations[$configuration->getName()])) {
            throw new ConfigurationException(sprintf('Configuration "%s" already added.', $configuration->getName()));
        }

        $this->validateConfiguration($configuration);

        $this->configurations[$configuration->getName()] = $configuration;
    }
8940
protected function includeConfiguration($configuration)
    {
        if (file_exists($configuration)) {
            $callable = include $configuration;
            if (is_callable($callable)) {
                call_user_func($callable, $this->eventEmitter);
            }
        }

        return true;
    }
558038
protected function initializeConfiguration(array $configuration = null)
    {
        if ($configuration !== null) {
            $this->conf = $configuration;
            return;
        }

        $frontEnd = $this->getFrontEndController();
        if ($frontEnd !== null && !isset($frontEnd->config['config'])) {
            $frontEnd->config['config'] = [];
        }

        $pageId = $this->getCurrentBePageId();
        if (isset(self::$cachedConfigurations[$pageId])) {
            $this->conf = self::$cachedConfigurations[$pageId];
        } else {
            // We need to create our own template setup if we are in the
            // BE and we aren't currently creating a DirectMail page.
            if (TYPO3_MODE === 'BE' && $frontEnd === null) {
                $this->conf = $this->retrievePageConfig($pageId);
            } else {
                // On the front end, we can use the provided template setup.
                $this->conf = ($this->extKey !== '')
                    ? $frontEnd->tmpl->setup['plugin.']['tx_' . $this->extKey . '.'] : [];
            }

            self::$cachedConfigurations[$pageId] = $this->conf;
        }
    }
944104
public function configure(array $configuration)
    {
        // allows to use the default options when a null value is passed
        if (array_key_exists('options', $configuration) && $configuration['options'] === null) {
            unset($configuration['options']);
        }

        $optionsResolver = new OptionsResolver();
        $optionsResolver
            ->setDefined(['host', 'database', 'options', 'driver_options'])
            ->setDefaults([
                'options' => ['connect' => false],
                'driver_options' => ['typeMap' => ['root' => 'array', 'document' => 'array', 'array' => 'array']],
            ])
            ->setRequired(['host', 'database'])
            ->setAllowedTypes('host', 'string')
            ->setAllowedTypes('database', 'string')
            ->setAllowedTypes('options', 'array')
            ->setAllowedTypes('driver_options', 'array')
        ;

        try {
            $this->configuration = $optionsResolver->resolve($configuration);
        } catch (\Exception $e) {
            throw new NoSQLDriverException('Wrong configuration: '.$e->getMessage(), $e->getCode(), $e);
        }
    }
254037
public function update($identifier, array $configuration)
    {
        $presets = $this->loadPresets();
        if (empty($presets[$identifier])) {
            throw new Exception('Could not find preset', 1410552339);
        }
        if (empty($configuration)) {
            throw new Exception('Empty configuration is not allowed', 1410595612);
        }
        $presets[$identifier] = $configuration;
        $this->savePresets($presets, 'Updates preset with identifier "' . $identifier . '"');
    }
959417
private function parseConfigurationArray(array $configuration = array())
    {
        if (!isset($configuration['host'])) {
            throw new \Exception('Missing Magento Host');
        }
        $url = parse_url($configuration['host']);
        $this->baseUri = sprintf('%s://%s', $url['scheme'], $url['host']);

        if (isset($url['port'])) {
            $this->baseUri .= ':'.$url['port'];
        }

        if (isset($url['path'])) {
            $this->baseUri .= '/'.trim($url['path'], '/');
        }
        $this->isAdmin = !empty($configuration['admin']);
        if (!empty($configuration['adminUrl'])) {
            $this->adminUrl = $configuration['adminUrl'].'/oauth_authorize';
        } else {
            $this->adminUrl = $this->baseUri.'/admin/oauth_authorize';
        }
    }
1013204
protected function setup(array $config = [])
    {
        if (!isset($config['data_provider'])) {
            throw new Exception(translate('{data_provider} must be a DatapPovider objetc'), 500, Exception::BADARGUMENTS);
        } elseif (isset($config['data_provider']) && !($config['data_provider'] instanceof DataProviderInterface)) {
            throw new Exception(translate('{data_provider} must be a DatapPovider objetc'), 500, Exception::BADARGUMENTS);
        }

        if (!isset($config['columns'])) {
            throw new Exception(translate('{columns} must be an array type Column[]'), 500, Exception::BADARGUMENTS);
        }

        parent::setup($config);

        $this->setupColumns();
    }
123565
public static function enable($configuration = array())
	{
		self::setConfiguration($configuration);

		if (!self::initialize()) {
			return;
		}

		error_reporting(self::$configuration->getErrorReportingLevel());
	}
9474
public function setConfiguration($configuration)
    {
        $this->configuration = (string) $configuration;

        $message = sprintf("Set configuration to [%s].", $this->configuration);
        $this->log($message, Project::MSG_DEBUG);
    }
1342211
public function setup($configurations = array())
    {
        foreach ($configurations as $key => $value) {
            if (!$this->registry->config->has($key)) {
                throw new \RuntimeException(sprintf('Unknown setup key %s.', $key));
            }
            if ($this->registry->validator->has($key)) {
                $validator = $this->registry->validator->get($key);
                if (!$validator->isValid($value)) {
                    if (count($choices = $validator->getChoices())) {
                        throw new \RuntimeException(sprintf('Invalid value %s for %s, values are %s.', var_export($value, true), $key, implode(', ', $choices)));
                    } else {
                        throw new \RuntimeException(sprintf('Invalid value %s for %s.', var_export($value, true), $key));
                    }
                }
            }
            $this->registry->config->set($key, $value);
        }

        return $this;
    }
1281813
public function configure(array $configuration) : bool
    {
        //====================================================================//
        // Setup Connector Configuration
        $this->getConnector()->configure(
            $this->getWebserviceId(),
            $this->getWebserviceId(),
            $configuration
        );
        //====================================================================//
        // Mark Connector as Configured
        return $this->identified = true;
    }
1241857
public function write($configuration)
    {
        $ht = $this->getHTaccessFilename();
        $fs = $this->getFilesystem();
        if (@$fs->put($ht, $configuration) === false) {
            throw new Exception("Failed to write to file $ht");
        }
    }
822086
protected function processConfigurationTraitCRUD(&$configuration)
    {
        if(!isset($configuration['subjects'][$this->name]['CRUD'])) {
            throw new \Exception(sprintf('missing CRUD configuration for subject %s', $this->name));
        }
        if(!isset($configuration['subjects'][$this->name]['CRUD']['actions'])) {
            throw new \Exception(sprintf('missing CRUD actions configuration for subject %s', $this->name));
        }
        if(!isset($configuration['subjects'][$this->name]['CRUD']['inputFields'])) {
            throw new \Exception(sprintf('missing CRUD inputFields configuration for subject %s', $this->name));
        }
    }