Create Site Configuration

@return ConfigurationInterface
500616
public function create(): ConfigurationInterface
    {
        $config = $this->detectConfig();
        $config->set('env', $this->environment);

        return $config;
    }
489602
public function getSiteInstance()
    {
        return $this->site == null ? $this->site = new SiteImpl($this) : $this->site;
    }
1102785
public function build()
    {
        $settings = [];
        foreach ($this->settings as $name => $options) {
            if (isset($options['dsn'])) {
                unset(
                    $options['scheme'],
                    $options['host'],
                    $options['port'],
                    $options['path']
                );

                $parsedDsn = parse_url($options['dsn']);
                unset($options['dsn']);
                if ($parsedDsn) {
                    $options['scheme'] = isset($parsedDsn['scheme']) ? $parsedDsn['scheme'] : 'http';
                    if (isset($parsedDsn['host'])) {
                        $options['host'] = $parsedDsn['host'];
                    }
                    if (isset($parsedDsn['user'])) {
                        $auth = $parsedDsn['user'] . (isset($parsedDsn['pass']) ? ':' . $parsedDsn['pass'] : '');
                        $options['host'] = $auth . '@' . $options['host'];
                    }
                    $options['port'] = isset($parsedDsn['port']) ? $parsedDsn['port'] : 80;
                    $options['path'] = isset($parsedDsn['path']) ? $parsedDsn['path'] : '';
                }
            }

            $settings[$name] = $options;
        }

        $solariumClient = new Client(array('endpoint' => $settings), $this->eventDispatcher);
        foreach ($this->plugins as $pluginName => $plugin) {
            $solariumClient->registerPlugin($pluginName, $plugin);
        }

        return $solariumClient;
    }
369545
public function createEntity(Site $site = null)
    {
        if (!$site) {
            $site = new Site($this->config);
        } else {
            $site->updateSiteConfigRepository($this->config);
        }
        return $site;
    }
917680
public function configure()
    {
        $this->config = new Configuration();

        $this->config->setNamingStrategy(new Mapping\DefaultNamingStrategy());

        $cache = new ApcCache();
        if ($cache->isSupported()) {
            $cache->setPrefix('samurai.onikiri.table.schema');
        } else {
            $cache = new ArrayCache();
        }
        $this->config->setSchemaCacher($cache);

        return $this->config;
    }
1202876
private function createConfig()
    {
        $data = file_get_contents($this->stub);
        $data = str_replace('%password%', str_random(8), $data);
        return file_put_contents($this->config, $data);
    }
1346382
public static function getInstance() {

		if( !isset( self::$instance ) ) {

			self::$instance	= new SiteProperties();

			self::$instance->init( CoreGlobal::CONFIG_FRONTEND );
		}

		return self::$instance;
	}
550878
public function configure(array $options = array())
    {
        if (isset($options['host'])) {
            $this->host = $options['host'];
        }
        if (isset($options['port'])) {
            if (!is_numeric($options['port']) || is_float($options['port']) || $options['port'] < 0 || $options['port'] > 65535) {
                throw new ConfigurationException($this, 'Port is out of range');
            }
            $this->port = $options['port'];
        }

        if (isset($options['namespace'])) {
            $this->namespace = $options['namespace'];
        }

        if (isset($options['timeout'])) {
            $this->timeout = $options['timeout'];
        }

        if (isset($options['throwConnectionExceptions'])) {
            $this->throwConnectionExceptions = $options['throwConnectionExceptions'];
        }

        if (isset($options['tags'])) {
            $this->tags = $options['tags'];
        }

        return $this;
    }
1271371
public function setActiveSite(SiteInterface $site = null)
    {
        $this->site = $site;
        $this->app->instance(SiteModel::class, $site);

        return $this;
    }
1204342
public function create()
    {
        /**
         * @var ConfigurationInterface $configuration
         */
        $classNamespace = $this->getEntityNamespace();
        $configuration = new $classNamespace();

        $configuration
            ->setNamespace('')
            ->setType(ElcodiConfigurationTypes::TYPE_STRING)
            ->setCreatedAt($this->now());

        return $configuration;
    }
609257
public static function createFromServerConfiguration() {
        //@codeCoverageIgnoreStart
        if (extension_loaded('gmp')) {
            return new \SecurityLib\BigMath\GMP();
        } elseif (extension_loaded('bcmath')) {
            return new \SecurityLib\BigMath\BCMath();
        } else {
            return new \SecurityLib\BigMath\PHPMath();
        }
        //@codeCoverageIgnoreEnd
    }
642615
protected function buildManager()
    {
        $config = new Configuration;

        $this->setUpGeneralConfigurations($config);
        $this->setUpSpecificConfigurations($config);

        $documentManager = DocumentManager::create($this->getOption('connection'), $config, $this->getEventManager());

        if ($this->getRepositoryFactory() !== null) {
            $documentManager->setRepositoryFactory($this->getRepositoryFactory());
        }

        if ($this->getDefaultRepositoryClass() !== null) {
            $documentManager->setDefaultRepositoryClassName($this->getDefaultRepositoryClass());
        }

        return $documentManager;
    }
694215
def site_config_dir(self):
        """"""
        directory = appdirs.site_config_dir(self.appname, self.appauthor,
                             version=self.version, multipath=self.multipath)
        if self.create:
            self._ensure_directory_exists(directory)
        return directory
66545
protected function setupBuild()
    {
        /** @var Repository $config */
        $config = $this->container['config'];

        $build = [];

        $this->title('Build');

        $build['directory'] = $this->ask("Where should we put the generated site files?", $config['build.directory']);

        return $build;
    }
636705
public function setDefaultsFromConfiguration()
    {
        $set = [
            "urlType",
            "siteUrl",
            "baseUrl",
            "staticSiteUrl",
            "staticBaseUrl",
            "scriptName",
        ];
        
        foreach ($set as $item) {
            if (!isset($this->config[$item])) {
                continue;
            }
            
            $this->$item = $this->config[$item];
        }

        return $this;
    }
214425
public function create()
    {
        // Add entry page on top level
        $newIdOfEntryPage = StringUtility::getUniqueId('NEW');
        $data = [
            'pages' => [
                $newIdOfEntryPage => [
                    'title' => 'styleguide TCA demo',
                    'pid' => 0 - $this->getUidOfLastTopLevelPage(),
                    // Mark this page as entry point
                    'tx_styleguide_containsdemo' => 'tx_styleguide',
                    // Have the "globus" icon for this page
                    'is_siteroot' => 1,
                ],
            ],
        ];

        // Add rows of third party tables like be_users and fal records
        $this->populateRowsOfThirdPartyTables();

        $recordFinder = GeneralUtility::makeInstance(RecordFinder::class);
        $sysLanguageStyleguideDemoUids = $recordFinder->findUidsOfDemoLanguages();

        // Add a page for each main table below entry page
        $mainTables = $this->getListOfStyleguideMainTables();
        // Have the first main table inside entry page
        $neighborPage = $newIdOfEntryPage;
        foreach ($mainTables as $mainTable) {
            $newIdOfPage = StringUtility::getUniqueId('NEW');
            $data['pages'][$newIdOfPage] = [
                'title' => str_replace('_', ' ', substr($mainTable, strlen('tx_styleguide_'))),
                'tx_styleguide_containsdemo' => $mainTable,
                'hidden' => 0,
                'pid' => $neighborPage,
            ];

            if (!empty($sysLanguageStyleguideDemoUids)) {
                foreach ($sysLanguageStyleguideDemoUids as $languageUid) {
                    $newIdOfLocalizedPage = StringUtility::getUniqueId('NEW');
                    $data['pages'][$newIdOfLocalizedPage] = [
                        'title' => str_replace('_', ' ', substr($mainTable . " - language " . $languageUid, strlen('tx_styleguide_'))),
                        'tx_styleguide_containsdemo' => $mainTable,
                        'hidden' => 0,
                        'pid' => $neighborPage,
                        'sys_language_uid' => $languageUid,
                        'l10n_parent' => $newIdOfPage,
                        'l10n_source' => $newIdOfPage,
                    ];
                }
            }
            // Have next page after this page
            $neighborPage = '-' . $newIdOfPage;
        }

        // Populate page tree via DataHandler
        $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
        $dataHandler->start($data, []);
        $dataHandler->process_datamap();
        BackendUtility::setUpdateSignal('updatePageTree');

        // Create data for each main table
        foreach ($mainTables as $mainTable) {
            $generator = NULL;
            foreach ($this->tableHandler as $handlerName) {
                $generator = GeneralUtility::makeInstance($handlerName);
                if (!$generator instanceof TableHandlerInterface) {
                    throw new Exception(
                        'Table handler ' . $handlerName . ' must implement TableHandlerInterface',
                        1458302830
                    );
                }
                if ($generator->match($mainTable)) {
                    break;
                } else {
                    $generator = null;
                }
            }
            if (is_null($generator)) {
                throw new GeneratorNotFoundException(
                    'No table handler found',
                    1458302901
                );
            }
            $generator->handle($mainTable);
        }
    }
421025
protected static function create()
    {
        $config = new static();

        $config->config = (new ConfigFactory())->create($config->getProjectPath(), $config->CONFIG_FILE);

        return $config;
    }