src/Leevel/Option/Option.php
public function set($name, $value = null): void
    {
        if (is_array($name)) {
            foreach ($name as $key => $value) {
                $this->set($key, $value);
            }
        } else {
            $name = $this->parseNamespace($name);
            $namespaces = $name[0];
            $name = $name[1];

            if ('*' === $name) {
                $this->option[$namespaces] = $value;

                return;
            }

            if (!strpos($name, '.')) {
                $this->option[$namespaces][$name] = $value;
            } else {
                $parts = explode('.', $name);
                $max = count($parts) - 1;
                $option = &$this->option[$namespaces];

                for ($i = 0; $i <= $max; $i++) {
                    $part = $parts[$i];

                    if ($i < $max) {
                        if (!isset($option[$part])) {
                            $option[$part] = [];
                        }

                        $option = &$option[$part];
                    } else {
                        $option[$part] = $value;
                    }
                }
            }
        }
    }
public function set($name, $value = null): void
    {
        if (is_array($name)) {
            foreach ($name as $key => $value) {
                $this->set($key, $value);
            }
        } else {
            $name = $this->parseNamespace($name);
            $namespaces = $name[0];
            $name = $name[1];

            if ('*' === $name) {
                $this->option[$namespaces] = $value;

                return;
            }

            if (!strpos($name, '.')) {
                $this->option[$namespaces][$name] = $value;
            } else {
                $parts = explode('.', $name);
                $max = count($parts) - 1;
                $option = &$this->option[$namespaces];

                for ($i = 0; $i <= $max; $i++) {
                    $part = $parts[$i];

                    if ($i < $max) {
                        if (!isset($option[$part])) {
                            $option[$part] = [];
                        }

                        $option = &$option[$part];
                    } else {
                        $option[$part] = $value;
                    }
                }
            }
        }
    }
设置配置.

@param mixed $name
@param mixed $value