Parse settings to array

@param \Laranix\Tracker\Settings $settings
@return array
@throws \Laranix\Support\Exception\InvalidTypeException
431595
protected function getPayload(Settings $settings) : array
    {
        $settings->hasRequiredSettings();

        $now = Carbon::now()->toDateTimeString();

        if ($this->config->get('tracker.save_rendered', true) && $settings->data !== null) {
            $rendered = markdown($settings->data);
        }

        return [
            'user_id'           => $settings->user,
            'ipv4'              => $settings->ipv4(),
            'user_agent'        => $settings->userAgent(),
            'request_method'    => $settings->requestMethod(),
            'request_url'       => $settings->requestUrl(),
            'type'              => strtolower($settings->type),
            'type_id'           => $settings->typeId,
            'item_id'           => $settings->itemId,
            'level'             => (int) $settings->flagLevel,
            'trackable_type'    => $settings->trackType !== Tracker::TRACKER_ANY ? $settings->trackType : Tracker::TRACKER_TRAIL,
            'data'              => $settings->data,
            'data_rendered'     => $rendered ?? null,
            'created_at'        => $now,
            'updated_at'        => $now,
        ];
    }
874856
public function setAll(array $settings)
    {
        foreach ($settings as $name => $value) {
            if (is_string($name) && $this->exists($name)) { // avoid the logic exception
                $this->set($name, $value);
            }
        }
    }
94212
public function load(array $settings = null)
    {
        $classVars = array_keys(get_class_vars(get_class($this)));

        foreach ($settings as $name => $value) {
            if (in_array($name, $this->blacklistConfig, true)) {
                continue;
            }

            if (in_array($name, $classVars, true)) {
                $method = 'set' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($name);
                if (method_exists($this, $method)) {
                    $this->configMapping += $this->configHelper->getNewSettingPath($name);
                    $this->{$method}($this->castToType($value, $name));
                } else {
                    $this->logger->debug(
                        'The evaluated method "' . $method . '" is not available in class ' . __CLASS__
                    );
                }
            } else {
                if (array_key_exists($name, $this->additionalSettings)) {
                    $this->additionalSettings[$name] = $value;
                } else {
                    $this->logger->debug(
                        'The given setting property "' . $name . '" is not available in class ' . __CLASS__
                    );
                }
            }
        }
    }
57095
protected function getConnectionDriver(array $settings = [])
    {
        $connection = Arr::get($settings, 'connection');
        $key        = 'database.connections.' . $connection;

        if (!$this->config->has($key)) {
            throw new InvalidArgumentException("Connection [{$connection}] has no configuration in [{$key}]");
        }

        return $this->config->get($key);
    }
770851
public function injectSettings(array $settings)
    {
        $this->settings = $settings['persistence'];
        if (!is_array($this->settings['backendOptions'])) {
            throw new InvalidConfigurationException(sprintf('The Neos.Flow.persistence.backendOptions settings need to be an array, %s given.', gettype($this->settings['backendOptions'])), 1426149224);
        }
        if (!is_array($this->settings['doctrine']['secondLevelCache'])) {
            throw new InvalidConfigurationException(sprintf('The TYPO3.Flow.persistence.doctrine.secondLevelCache settings need to be an array, %s given.', gettype($this->settings['doctrine']['secondLevelCache'])), 1491305513);
        }
    }
225635
protected function getSettingMessages(FieldTypeInterface $setting): array
    {
        $messages = [];

        foreach ($setting->getOption('messages', []) as $attr => $message) {
            $messages[$setting->getName().'.'.$attr] = $message;
        }

        return $messages;
    }
430713
public function settings($settings = null)
    {
        if (is_null($settings)) {
            return $this->settings;
        }

        $this->settings = $settings;
        return $this;
    }
553879
protected static function getSettings(ContainerInterface $container, string $settingsClass): array
    {
        /** @var SettingsProviderInterface $provider */
        $provider = $container->get(SettingsProviderInterface::class);
        $settings = $provider->get($settingsClass);

        return $settings;
    }
407002
public function checkSettings($settings)
    {
        assert('is_array($settings)');

        if (!is_array($settings) || empty($settings)) {
            $errors = array('invalid_syntax');
        } else {
            $errors = array();
            if (!$this->_spValidationOnly) {
                $idpErrors = $this->checkIdPSettings($settings);
                $errors = array_merge($idpErrors, $errors);
            }
            $spErrors = $this->checkSPSettings($settings);
            $errors = array_merge($spErrors, $errors);

            $compressErrors = $this->checkCompressionSettings($settings);
            $errors = array_merge($compressErrors, $errors);
        }

        return $errors;
    }
824469
public function resolve(array $settings = [])
    {
        return [
            'driver'                => 'oci8',
            'host'                  => Arr::get($settings, 'host'),
            'dbname'                => Arr::get($settings, 'database'),
            'servicename'           => Arr::get($settings, 'service_name'),
            'service'               => Arr::get($settings, 'service'),
            'user'                  => Arr::get($settings, 'username'),
            'password'              => Arr::get($settings, 'password'),
            'charset'               => Arr::get($settings, 'charset'),
            'port'                  => Arr::get($settings, 'port'),
            'prefix'                => Arr::get($settings, 'prefix'),
            'defaultTableOptions'   => Arr::get($settings, 'defaultTableOptions', []),
            'persistent'            => Arr::get($settings, 'persistent'),
        ];
    }
755809
public function setToolSettings($settings = array())
    {

        $url = $this->getSetting('custom_system_setting_url');
        $service = new Service\ToolSettings($this, $url);
        $response = $service->set($settings);

        return $response;

    }
408015
function setSetting($setting)
    {
        if (!is_string($setting) && !is_array($setting) && !$setting instanceof \Traversable)
            throw new \InvalidArgumentException(sprintf(
                'Config must be array, Traversable or string as service represent these both; given: (%s).'
                , \Poirot\Std\flatten($setting)
            ));

        $this->setting = $setting;
        return $this;
    }
283203
private static function validateFilters($filters, $settings)
    {
        if (!is_array($filters)) {
            $filters = [$filters];
        }

        // Each fitler.
        foreach ($filters as $index => &$filter) {

            // Check this item.
            $filter = self::validateFilterItem($filter, $settings);

            // Remove if invalid.
            if (empty($filter)) {
                unset($filters[$index]);
            }
        }

        return $filters;
    }
701209
public function checkCompressionSettings($settings)
    {
        $errors = array();

        if (isset($settings['compress'])) {
            if (!is_array($settings['compress'])) {
                $errors[] = "invalid_syntax";
            } else if (isset($settings['compress']['requests'])
                && $settings['compress']['requests'] !== true
                && $settings['compress']['requests'] !== false
            ) {
                $errors[] = "'compress'=>'requests' values must be true or false.";
            } else if (isset($settings['compress']['responses'])
                && $settings['compress']['responses'] !== true
                && $settings['compress']['responses'] !== false
            ) {
                $errors[] = "'compress'=>'responses' values must be true or false.";
            }
        }
        return $errors;
    }
247941
public function setSettings(array $settings): SettingsRepositoryInterface
    {
        $this->parseCompatibleSettings($settings);
        $this->settings = $settings;

        return $this;
    }
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'];
        }
    }
735321
protected static function validateSettings($settings)
    {
        if (!isset($settings['consumerKey']) || !isset($settings['consumerSecret'])) {
            return false;
        }
        $settings['token'] = isset($settings['token']) ? $settings['token'] : null;
        $settings['tokenSecret'] = isset($settings['tokenSecret']) ? $settings['tokenSecret'] : null;

        return $settings;
    }