Flesh out the settings

@param SecuritySettingsInterface $sourceSettings

@throws \Exception

@return DefaultSecuritySettings
763192
public static function createFromArray(array $data, SecuritySettingsInterface $sourceSettings = null)
    {
        if ($sourceSettings && !$sourceSettings instanceof self) {
            throw new \InvalidArgumentException('Provide an instance of DefaultSecuritySettings for $sourceSettings');
        }

        $settings = $sourceSettings ? clone $sourceSettings : new static();
        \assert($settings instanceof self);
        $settings->mergeSettings($data);

        return $settings;
    }
630949
public function injectSettings(array $settings)
    {
        if (isset($settings['security']['cryptography']['RSAWalletServicePHP']['openSSLConfiguration'])
            && is_array($settings['security']['cryptography']['RSAWalletServicePHP']['openSSLConfiguration'])) {
            $this->openSSLConfiguration = $settings['security']['cryptography']['RSAWalletServicePHP']['openSSLConfiguration'];
        }

        if (isset($settings['security']['cryptography']['RSAWalletServicePHP']['keystorePath'])) {
            $this->keystorePathAndFilename = $settings['security']['cryptography']['RSAWalletServicePHP']['keystorePath'];
        } else {
            throw new MissingConfigurationException('The configuration setting Neos.Flow.security.cryptography.RSAWalletServicePHP.keystorePath is missing. Please specify it in your Settings.yaml file. Beware: This file must not be accessible by the public!', 1305711354);
        }

        if (isset($settings['security']['cryptography']['RSAWalletServicePHP']['paddingAlgorithm']) && is_int($settings['security']['cryptography']['RSAWalletServicePHP']['paddingAlgorithm'])) {
            $this->paddingAlgorithm = $settings['security']['cryptography']['RSAWalletServicePHP']['paddingAlgorithm'];
        } else {
            throw new SecurityException('The padding algorithm given in security.cryptography.RSAWalletServicePHP.paddingAlgorithm is not available.', 1556785429);
        }
    }
1135626
public function validateFieldSettings($fieldSettings)
    {
        $validationErrors = array();

        foreach ($fieldSettings as $name => $value) {
            if (isset($this->settingsSchema[$name])) {
                switch ($name) {
                    case 'mediaType':
                        if (!in_array($value, self::$availableTypes)) {
                            $validationErrors[] = new ValidationError(
                                "Setting '%setting%' is of unknown type",
                                null,
                                array(
                                    '%setting%' => $name,
                                ),
                                "[$name]"
                            );
                        }
                        break;
                }
            } else {
                $validationErrors[] = new ValidationError(
                    "Setting '%setting%' is unknown",
                    null,
                    array(
                        '%setting%' => $name,
                    ),
                    "[$name]"
                );
            }
        }

        return $validationErrors;
    }
818250
public function setClientConfig($id, ClientConfig $configSource) {
        $sources = $this->hasOption(self::OPTION_CONFIG_SOURCES)
            ? $this->getOption(self::OPTION_CONFIG_SOURCES)
            : array()
        ;
        $sources[$id] = $configSource;
        $this->setOption(self::OPTION_CONFIG_SOURCES, $sources);
    }
20800
protected function applySecondLevelCacheSettingsToConfiguration(array $configuredSettings, Configuration $doctrineConfiguration)
    {
        if (!isset($configuredSettings['enable']) || $configuredSettings['enable'] !== true) {
            return;
        }

        $doctrineConfiguration->setSecondLevelCacheEnabled();
        $regionsConfiguration = $doctrineConfiguration->getSecondLevelCacheConfiguration()->getRegionsConfiguration();
        if (isset($configuredSettings['defaultLifetime'])) {
            $regionsConfiguration->setDefaultLifetime($configuredSettings['defaultLifetime']);
        }
        if (isset($configuredSettings['defaultLockLifetime'])) {
            $regionsConfiguration->setDefaultLockLifetime($configuredSettings['defaultLockLifetime']);
        }

        if (isset($configuredSettings['regions']) && is_array($configuredSettings['regions'])) {
            foreach ($configuredSettings['regions'] as $regionName => $regionLifetime) {
                $regionsConfiguration->setLifetime($regionName, $regionLifetime);
            }
        }

        $cache = new CacheAdapter();
        // must use ObjectManager in compile phase...
        $cache->setCache($this->objectManager->get(CacheManager::class)->getCache('Flow_Persistence_Doctrine_SecondLevel'));

        $factory = new \Doctrine\ORM\Cache\DefaultCacheFactory($regionsConfiguration, $cache);
        $doctrineConfiguration->getSecondLevelCacheConfiguration()->setCacheFactory($factory);
    }
1095099
public function mergeSettings($newSettings)
    {
        if (\is_object($this->getSettings())) {
            $settingsClass = \get_class($this->getSettings());
            $settings = $settingsClass::createFromArray($newSettings, $this->getSettings());
        } else {
            $settings = \array_replace($this->getSettings(), $newSettings);
        }

        $this->setSettings($settings);
    }
1161316
public function injectSettings(array $settings) {
		if (isset($settings['client']['serviceBaseUri'])) {
			$this->clientServiceBaseUri = $settings['client']['serviceBaseUri'];
		}
		if (isset($settings['client']['publicKeyFingerprint'])) {
			$this->clientPublicKeyFingerprint = $settings['client']['publicKeyFingerprint'];
		}
	}
1047816
public function setComposerSettings(array $composerSettings = [])
    {
        /**
         * If array is type array("config.value:true","require:library/src",)
         */
        $settings = [];
        foreach ($composerSettings as $index => $value) {
            if (is_numeric($index) && mb_strpos($value, ':') > 0) {
                $path = implode('', array_slice(explode(':', $value), 0, 1));
                $val = implode(':', array_slice(explode(':', $value), 1));
                self::dotNotationToArray($path, $val, $settings);
            } else {
                $settings[$index] = $value;
            }
        }
        return $this->setOptionValue(self::COMPOSER_SETTINGS, $settings);
    }
1122833
public function initSettings(array $settings)
    {
        if (!isset($settings['tcp'])) {
            throw new \InvalidArgumentException('Tcp startup parameter is not configured，settings=' . \json_encode($settings));
        }

        if (!isset($settings['http'])) {
            throw new \InvalidArgumentException('HTTP startup parameters is not configured, settings=' . \json_encode($settings));
        }

        if (!isset($settings['server'])) {
            throw new \InvalidArgumentException('server startup parameters is not configured, settings=' . \json_encode($settings));
        }

        if (!isset($settings['setting'])) {
            throw new \InvalidArgumentException('"setting" parameters is not configured, settings=' . \json_encode($settings));
        }

        foreach ($settings['setting'] as $key => $value) {
            // path alias
            if ($value && \is_string($value) && $value[0] === '@') {
                $settings['setting'][$key] = App::getAlias($value);
            }
        }

        $this->setting = $settings['setting'];
        $this->tcpSetting = $settings['tcp'];
        $this->httpSetting = $settings['http'];
        $this->serverSetting = $settings['server'];

        // fix bug must to int
        if (isset($this->setting['task_ipc_mode'])) {
            $this->setting['task_ipc_mode'] = (int)$this->setting['task_ipc_mode'];
        }
        if (isset($this->setting['message_queue_key'])) {
            $this->setting['message_queue_key'] = (int)$this->setting['message_queue_key'];
        }
    }
958219
public static function settings($settings=array())
		{
			self::$_readOnce 		= isset($settings['readOnce']) ? (boolean) $settings['readOnce'] : false;
			self::$_defaultReturn 	= (array_key_exists('defaultReturn',$settings)) ? $settings['defaultReturn'] : 'ST__EXCEPTION';
		}
722061
public function build(InputSettings $settings)
    {
        $this->settings = $settings;

        $this->setElement();
        $this->setValidator();
        $this->setLabel();
        $this->setDefault();
        $this->setAttributes();
        $this->setData();
        $this->setAdditionalOptions();

        return $this->getElement();
    }
627046
protected function extractComponentSettings($aSettings, $sSlug)
    {
        $aOut = [];

        foreach ($aSettings as $oSetting) {

            //  If the object contains a `fields` property then consider this a field set and inception
            if (isset($oSetting->fields)) {

                $aOut = array_merge(
                    $aOut,
                    $this->extractComponentSettings(
                        $oSetting->fields,
                        $sSlug
                    )
                );

            } else {

                $sValue = appSetting($oSetting->key, $sSlug);
                if (is_null($sValue) && isset($oSetting->default)) {
                    $sValue = $oSetting->default;
                }
                $aOut[$oSetting->key] = $sValue;
            }
        }

        return $aOut;
    }
976762
public function addSecuritySettingParser(SecuritySettingsParserInterface $securitySettingsParser)
    {
        foreach ($securitySettingsParser->getCompatibleTypes() as $contentType) {
            $this->securitySettingsParsers[$contentType] = $securitySettingsParser;
        }
    }
928422
public function injectSettings(array $settings): void
    {
        if (isset($settings['security']['authentication']['authenticationStrategy'])) {
            $authenticationStrategyName = $settings['security']['authentication']['authenticationStrategy'];
            switch ($authenticationStrategyName) {
                case 'allTokens':
                    $this->authenticationStrategy = Context::AUTHENTICATE_ALL_TOKENS;
                    break;
                case 'oneToken':
                    $this->authenticationStrategy = Context::AUTHENTICATE_ONE_TOKEN;
                    break;
                case 'atLeastOneToken':
                    $this->authenticationStrategy = Context::AUTHENTICATE_AT_LEAST_ONE_TOKEN;
                    break;
                case 'anyToken':
                    $this->authenticationStrategy = Context::AUTHENTICATE_ANY_TOKEN;
                    break;
                default:
                    throw new Exception('Invalid setting "' . $authenticationStrategyName . '" for security.authentication.authenticationStrategy', 1291043022);
            }
        }
    }
1290956
public function validateFieldSettings($fieldSettings)
    {
        $validationErrors = array();

        foreach ($fieldSettings as $settingKey => $settingValue) {
            switch ($settingKey) {
                case 'configuration':
                    if (!is_array($settingValue)) {
                        $validationErrors[] = new ValidationError(
                            "FieldType '%fieldType%' expects setting '%setting%' to be of type '%type%'",
                            null,
                            array(
                                '%fieldType%' => $this->getFieldTypeIdentifier(),
                                '%setting%' => $settingKey,
                                '%type%' => 'hash',
                            ),
                            "[$settingKey]"
                        );
                    }
                    break;
                default:
                    $validationErrors[] = new ValidationError(
                        "Setting '%setting%' is unknown",
                        null,
                        array(
                            '%setting%' => $settingKey,
                        ),
                        "[$settingKey]"
                    );
            }
        }

        return $validationErrors;
    }
1170686
public function validateFieldSettings($fieldSettings)
    {
        $validationErrors = [];

        if (!is_array($fieldSettings)) {
            $validationErrors[] = new ValidationError('Field settings must be in form of an array');

            return $validationErrors;
        }

        foreach ($fieldSettings as $name => $value) {
            if (!isset($this->settingsSchema[$name])) {
                $validationErrors[] = new ValidationError(
                    'Setting "%setting%" is unknown',
                    null,
                    [
                        '%setting%' => $name,
                    ],
                    "[${name}]"
                );

                continue;
            }

            switch ($name) {
                case 'hideRootTag':
                    if (!is_bool($value)) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' value must be of boolean type",
                            null,
                            [
                                '%setting%' => $name,
                            ],
                            "[${name}]"
                        );
                    }

                    break;
                case 'editView':
                    if (!is_string($value)) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' value must be of string type",
                            null,
                            [
                                '%setting%' => $name,
                            ],
                            "[${name}]"
                        );
                    }

                    $editViewExists = false;
                    foreach ($this->availableEditViews as $editView) {
                        if ($editView['identifier'] === $value) {
                            $editViewExists = true;

                            break;
                        }
                    }

                    if (!$editViewExists) {
                        $validationErrors[] = new ValidationError(
                            "Edit view '%editView%' does not exist",
                            null,
                            [
                                '%editView%' => $value,
                            ],
                            "[${name}]"
                        );
                    }

                    break;
            }
        }

        return $validationErrors;
    }
757959
public function setSettings($settings = [])
    {
        $original = $this->settings;
        $this->mergeSettings($settings, $this->settings);
        if ($this->settings != $original) {
            // @todo - Log Curl equivalent during test mode (adds overhead and risk so only do it during test)
            // if (!isset($this->settings['handler']) && class_exists(
            //         '\Namshi\Cuzzle\Middleware\CurlFormatterMiddleware'
            //     )) {
            //     $this->logger      = new Logger('guzzle.to.curl'); //initialize the logger
            //     $this->testHandler = new TestHandler(); //test logger handler
            //     $this->logger->pushHandler($this->testHandler);
            //
            //     $this->handler = HandlerStack::create();
            //     $this->handler->after('cookies', new \Namshi\Cuzzle\Middleware\CurlFormatterMiddleware($this->logger));
            //     $this->settings['handler'] = $this->handler;
            // }
            $this->client = new Client($this->settings);
        }
    }