Salvar arquivo Config.

@param $group
@param string $environment
8191
public function saveConfig($group, $environment = '')
    {
        // Path do arquivo
        $path = config_path();

        // Itens
        $items = config($group, []);

        // Nome do arquivo
        $file = (! $environment || ($environment == 'production'))
            ? "{$path}/{$group}.php"
            : "{$path}/{$environment}/{$group}.php";

        // Salvar arquivo
        $code = '<?php' . "\r\n\r\n";
        $code .= 'return ' . var_export($items, true) . ';';
        $this->put($file, $code);
    }
1035519
public function addConfigGroup(\VinceT\AdminConfigurationBundle\Entity\ConfigGroup $configGroup)
    {
        $this->configGroups[] = $configGroup;

        return $this;
    }
1155537
protected function getEnvironmentEndpoint(?string $group = null): ?string
    {
        $environment = $this->getEnvironment();

        if (\is_null($group) || empty($group)) {
            return static::$endpoints[$environment];
        }

        return static::$endpoints[$environment][$group] ?? null;
    }
588716
public function initEnvironment(Config $config)
    {
        if (isset($config->application) && isset($config->application->environment)) {
            $env = $config->application->environment;
        } else {
            $env = Constants::DEFAULT_ENV;
        }

        if (!defined('APPLICATION_ENV')) {
            define('APPLICATION_ENV', $env);
        }

        $this->getDI()->set('environment', function() use ($env) {
            return $env;
        }, true);
    }
135519
public function insertGroup(Group $group)
    {
        $group->setGuid($this->container->get('claroline.utilities.misc')->generateGuid());
        $this->om->persist($group);
        $this->eventDispatcher->dispatch('log', 'Log\LogGroupCreate', array($group));
        $this->om->flush();
    }
505476
public function setEnvironment($environment = '')
    {
        // Set the application environment
        $environment = ($environment ?: strtolower(getenv('APPLICATION_ENV')));
        $environment = ($environment ?: 'default');

        // Set the application environment
        $this->set('env', $environment);

        return $this;
    }
59259
protected function createConfigGroupForm(ConfigGroup $group = null)
    {
        $formBuilder = $this->createFormBuilder();
        if ($group) {
            $values = $this->container->get('admin.configuration.configvalue_manager')->getRepository()->findByConfigGroupId($group->getId());
            foreach ($values as $configValue) {
                $sub = $this->container->get('form.factory')->createNamedBuilder(
                    str_replace(':', '___', $configValue->getPath()),
                    'admin_configuration_configvalue_'.$configValue->getConfigType()->getFormType(),
                    $configValue
                );
                $formBuilder->add($sub);
            }
        }

        return $formBuilder->getForm();
    }
654259
public function configure(Environment $environment)
    {
        if ($this->debugMode) {
            $environment->enableDebug();
            $environment->enableAutoReload();
        } else {
            $environment->disableDebug();
            $environment->disableAutoReload();
            $environment->setCache($this->cache);
        }

        $this->applicationConfigure($environment);
    }
45898
public function clearGroup($group)
    {
        $key = $this->_config['prefix'] . $group;
        if (isset($this->data[$key])) {
            $this->data[$key]['val'] += 1;
        }

        return true;
    }
570279
public static function getGroupingMode(EnvironmentInterface $environment)
    {
        $sorting = static::getCurrentSorting($environment);

        // If no sorting defined, exit.
        if ((!$sorting)
            || (!$sorting->getCount())
            || $sorting->get(0)->getSortingMode() === GroupAndSortingInformationInterface::SORT_RANDOM
        ) {
            return null;
        }
        $firstSorting = $sorting->get(0);

        // Use the information from the property, if given.
        if ('' !== $firstSorting->getGroupingMode()) {
            $groupMode   = $firstSorting->getGroupingMode();
            $groupLength = $firstSorting->getGroupingLength();
        } else {
            // No sorting? No grouping!
            $groupMode   = GroupAndSortingInformationInterface::GROUP_NONE;
            $groupLength = 0;
        }

        return [
            'mode'     => $groupMode,
            'length'   => $groupLength,
            'property' => $firstSorting->getProperty(),
            'sorting'  => $sorting
        ];
    }
441978
public function deleteServiceGroup($group)
    {
        $filename = $this->getConfigFilename($group);
        $this->getFilesystem()->remove($filename);

        // Unlike normal arrays, unset() will throw errors here if the key
        // doesn't exist.
        if (isset($this[$group])) {
            unset($this[$group]);
        }

        unset($this->removed[$group]);
    }
1286684
public function insertGroup(Group $group)
    {
        $this->om->persist($group);
        $this->eventDispatcher->dispatch('log', 'Log\LogGroupCreate', [$group]);
        $this->om->flush();

        return $group;
    }
871935
protected function globFiles(
        /*# string */ $group,
        /*# string */ $environment
    )/*# : array */ {
        $files = [];
        $group = '' === $group ? '*' : $group;
        foreach ($this->getSearchDirs($environment) as $dir) {
            $file  = $dir . $group . '.' . $this->file_type;
            $files = array_merge($files, glob($file));
        }
        return $files;
    }
1034738
public function run(Environment $environment)
    {
        if ('f' === $this->operation[0]) {
            if ("fopen" === $this->operation) {
                $path = $this->args[0];
                $mode = \str_replace(['b', 't', 'e'], '', $this->args[1]);

                switch ($mode) {
                    case "r":
                    case "r+":
                    case "w":
                    case "w+":
                    case "a":
                    case "a+":
                    case "x":
                    case "x+":
                    case "c":
                    case "c+":
                        break;

                    default:
                        throw new \Error("Invalid file mode");
                }

                $handle = @\fopen($path, $mode . 'be');

                if (!$handle) {
                    $message = 'Could not open the file.';
                    if ($error = \error_get_last()) {
                        $message .= \sprintf(" Errno: %d; %s", $error["type"], $error["message"]);
                    }
                    throw new FilesystemException($message);
                }

                $file = new BlockingHandle($handle, $path, $mode);
                $id = (int) $handle;
                $size = \fstat($handle)["size"];
                $environment->set(self::makeId($id), $file);

                return [$id, $size, $mode];
            }

            if ($this->id === null) {
                throw new FilesystemException("No file ID provided");
            }

            $id = self::makeId($this->id);

            if (!$environment->exists($id)) {
                throw new FilesystemException(\sprintf("No file handle with the ID %d has been opened on the worker", $this->id));
            }

            /** @var \Amp\File\BlockingHandle $file */
            if (!($file = $environment->get($id)) instanceof BlockingHandle) {
                throw new FilesystemException("File storage found in inconsistent state");
            }

            switch ($this->operation) {
                case "fread":
                case "fwrite":
                case "fseek":
                case "ftruncate":
                    return ([$file, \substr($this->operation, 1)])(...$this->args);

                case "fclose":
                    $environment->delete($id);
                    $file->close();
                    return;

                default:
                    throw new \Error('Invalid operation');
            }
        }

        StatCache::clear();

        switch ($this->operation) {
            case "stat":
            case "unlink":
            case "rename":
            case "link":
            case "symlink":
            case "readlink":
            case "lstat":
            case "exists":
            case "mkdir":
            case "scandir":
            case "rmdir":
            case "chmod":
            case "chown":
            case "touch":
            case "get":
            case "put":
                return ([new BlockingDriver, $this->operation])(...$this->args);

            default:
                throw new \Error("Invalid operation");
        }
    }
583852
public function group_for_name($name)
	{
		foreach ($this->_groups as $group) 
		{
			if ($group->has($name)) 
			{
				return $group;
			}
		}
		throw new Exception("Environment variable :name does not belong to any group", array(':name' => $name));
	}
262625
public function setGroup($group, $feature)
    {
        if (!isset($this->_aGroup[$group])) {
            $this->_aGroup[$group] = array();
        }
        if (!in_array($feature, $this->_aGroup[$group])) {
            $this->_aGroup[$group][] = $feature;
        }
        return $this;
    }
1128799
protected function configureAliases(array $group)
    {
        foreach ($group as $name => $dependency)
        {
            $this->alias($name, $dependency);
        }
    }