Create the configuration loader based the current shell environment variables.

@param string $configFilename
@param Version $version
@return ConfigurationLoader
@codeCoverageIgnore
326907
public static function fromEnv($configFilename, Version $version)
    {
        if (null === $configFilename) {
            $configFilename = getenv('ZFILE') ? getenv('ZFILE') : 'z.yml';
        }

        return new self(
            $configFilename,
            new PathDefaultFileLocator('ZPATH', array(getcwd(), getenv('HOME') . '/.config/z')),
            new FileLoader(
                new PathDefaultFileLocator(
                    'ZPLUGINPATH',
                    array(ZPREFIX . '/vendor/zicht/z-plugins/', getcwd())
                ),
                $version
            )
        );
    }
1193947
private function getConfigFile($configFile, $environment = 'default')
    {
        // Normalize config file
        $configFile = $configFile ?: 'config';

        // Check if there is an environment-specific config file
        $envConfigFile = $this->app->getConfigPath() . DIRECTORY_SEPARATOR . $configFile . '-' . $environment . '.php';
        if (!is_file($envConfigFile)) {
            $envConfigFile = $this->app->getConfigPath() . DIRECTORY_SEPARATOR . $configFile . '.php';
        }

        return $envConfigFile;
    }
539816
public static function FromFile($Parent, $File, $Name = 'Configuration') {
      $LoadedFromCache = FALSE; $UseCache = FALSE;
      if ($Parent && $Parent->Caching()) {
         $FileKey = sprintf(Gdn_Configuration::CONFIG_FILE_CACHE_KEY, $File);
         if (Gdn::Cache()->Type() == Gdn_Cache::CACHE_TYPE_MEMORY && Gdn::Cache()->ActiveEnabled()) {
            $UseCache = TRUE;
            $CachedConfigData = Gdn::Cache()->Get($FileKey,array(
                Gdn_Cache::FEATURE_NOPREFIX => TRUE
            ));
            $LoadedFromCache = ($CachedConfigData !== Gdn_Cache::CACHEOP_FAILURE);
         }
      }
      
      // If we're not loading config from cache, check that the file exists
      if (!$LoadedFromCache && !file_exists($File))
         return FALSE;
         
      // Define the variable properly.
      $$Name = NULL;
      
      // If we're not loading config from cache, directly include the conf file
      if ($LoadedFromCache)
         $$Name = $CachedConfigData;
      
      if (is_null($$Name) || !is_array($$Name)) {
         $LoadedFromCache = FALSE;
         // Include the file.
         require($File);
      }
      
      // Make sure the config variable is here and is an array.
      if (!is_array($$Name))
         $$Name = array();
      
      // We're caching, using the cache, and this data was not loaded from cache.
      // Write it there now.
      if ($Parent && $Parent->Caching() && $UseCache && !$LoadedFromCache) {
         Gdn::Cache()->Store($FileKey, $$Name, array(
             Gdn_Cache::FEATURE_NOPREFIX => TRUE
         ));
      }
      
      return new Gdn_ConfigurationSource($Parent, 'file', $File, $Name, $$Name);
   }
692235
public function load(ContainerBuilder $container, array $config)
    {
        $definition = new Definition('jarnaiz\\JUnitFormatter\\Formatter\\JUnitFormatter');

        if (!$filename = \getenv(self::ENV_FILENAME)) {
            $filename = $config['filename'];
        }

        if (!$outputDir = \getenv(self::ENV_OUTPUTDIR)) {
            $outputDir = $config['outputDir'];
        }

        $definition->addArgument($filename);
        $definition->addArgument($outputDir);

        $container->setDefinition('junit.formatter', $definition)
            ->addTag('output.formatter');
    }
821412
public function containsVersionOfFile($file, $version)
    {
        $f = $this->findVersionOfFile($file, $version);
        return  $f != null;
    }
65249
public function loadConfig($configFile = 'config.user.php', $configPath = 'app/config') {
        $completePath = ROOT . DS . $configPath . DS . $configFile;

        if (!file_exists($completePath)) {
            throw new ConfigException("Specified config file does not exist: " . $completePath);
        }

        include($completePath);

        if (isset($pffConfig) && is_array($pffConfig)) {
            $this->_config = array_merge($this->_config, $pffConfig);
        } else {
            throw new ConfigException("Failed to load configuration file!
                                            The file seems to be corrupted: " . $completePath);
        }
    }
478006
public function activate($versionNumber, $oldVersionNumber = '')
    {
        // Configuration values
        $configurationManager = $this->framework->getInstance('\\Zepi\\Core\\Utils\\Manager\\ConfigurationManager');
        $configurationManager->addSettingIfNotSet('environment', 'DEV');
        $configurationManager->saveConfigurationFile();
    }
431426
public static function initializeWithDefaultsIn(ConfigLocation $configLocation, ConfigWriter $configWriter)
    {
        $env = Environment::setUp();

        $instance = new self(['processing' => array_merge(
            $env->getConfig()->toArray(),
            [
                "connectors" => [],
                "js_ticker" => ['enabled' => false, 'interval' => 3],
            ]
        )], $configLocation);

        $configFilePath = $configLocation->toString() . DIRECTORY_SEPARATOR . self::$configFileName;

        if (file_exists($configFilePath)) {
            throw new \RuntimeException("Processing config already exists: " . $configFilePath);
        }

        $configWriter->writeNewConfigToDirectory($instance->toArray(), $configFilePath);

        $instance->recordThat(ProcessingConfigFileWasCreated::in($configLocation, self::$configFileName));

        return $instance;
    }
932325
public static function load(string $filename): ConfigInterface
    {
        if (!file_exists($filename)) {
            throw new \RuntimeException(sprintf('Expected config in %s, but the file does not exist.', $filename), 1);
        }
        // Try to determine the realpath of the file, if possible.
        $filename = realpath($filename) ?: $filename;
        try {
            $config = require $filename;
        } catch (Exception $e) {
            throw new \RuntimeException(sprintf('There was an error loading config from %s. Message: %s', $filename, $e->getMessage()), 1, $e);
        }
        if (1 === $config) {
            throw new \RuntimeException(sprintf('No configuration was returned from %s.', $filename), 1);
        }
        if (!$config instanceof ConfigInterface) {
            throw new \RuntimeException(sprintf('Configuration returned from %s is not an instance of %s.', $filename, ConfigInterface::class), 1);
        }
        if ('' === $config->getDocroot()) {
            $config->setDocroot(dirname($filename));
        }
        if ('' === $config->getCachePrefix()) {
            $config->setCachePrefix(md5($filename));
        }

        return $config;
    }
1172658
public static function initByVersion( string $version, array $customSettings = [] )
	{
		self::setSettings([
			self::SET_VERSION  => $version,
			self::SET_ENDPOINT => self::getCdnUrl(),
		]);

		if (!empty($customSettings))
			self::setSettings($customSettings);

		self::$initialized = true;
	}
755531
public function loadConfigFile($file, $env = null)
    {
        $file = str_replace('%env%', $env ?: $this->name, $file);
        $config = $this->getFileConfig($file);
        if ($config) {
            $this->wei->setConfig($config);
        }
        return $this;
    }
1226981
public function toggleBreakpoint($environment, $version)
    {
        $migrations = $this->getMigrations($environment);
        $this->getMigrations($environment);
        $env = $this->getEnvironment($environment);
        $versions = $env->getVersionLog();

        if (empty($versions) || empty($migrations)) {
            return;
        }

        if ($version === null) {
            $lastVersion = end($versions);
            $version = $lastVersion['version'];
        }

        if (0 != $version && !isset($migrations[$version])) {
            $this->output->writeln(sprintf(
                '<comment>warning</comment> %s is not a valid version',
                $version
            ));

            return;
        }

        $env->getAdapter()->toggleBreakpoint($migrations[$version]);

        $versions = $env->getVersionLog();

        $this->getOutput()->writeln(
            ' Breakpoint ' . ($versions[$version]['breakpoint'] ? 'set' : 'cleared') .
            ' for <info>' . $version . '</info>' .
            ' <comment>' . $migrations[$version]->getName() . '</comment>'
        );
    }
904550
public function loadFieldData( VersionInfo $versionInfo, Field $field )
    {
        $connection = $this->getConnection();

        $query = $connection->createSelectQuery();
        $query
            ->selectDistinct( "*" )
            ->from( $connection->quoteTable( self::TABLE ) )
            ->where(
                $query->expr->lAnd(
                    $query->expr->eq(
                        $connection->quoteColumn( "objectattribute_id" ),
                        $query->bindValue( $field->id, null, PDO::PARAM_INT )
                    ),
                    $query->expr->eq(
                        $connection->quoteColumn( "objectattribute_version" ),
                        $query->bindValue( $versionInfo->versionNo, null, PDO::PARAM_INT )
                    )
                )
            );
        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll( PDO::FETCH_ASSOC );
    }
888976
private function getConfigurationLoader() {
    if (!array_key_exists($this->format, self::getConfigurationLoaders())) {
      throw new LoadException("configuration loader for format key $this->format could not be found");
    }

    $loaderClass = self::getConfigurationLoaders()[$this->format];
    $loader = new $loaderClass($this->filename);

    return $loader;
  }
971129
protected function _generateMigrationFile($version, $contentUp = "", $contentDown = "")
    {
        $classVersion = preg_replace('/[^0-9A-Za-z]/', '', $version);
        $className = 'Migration_' . $classVersion;
        $classData = "<?php

use Phalcon\Migrations\MigrationScript as Migration;

class " . $className . " extends Migration\n" .
            "{\n\n" .
            "\tpublic function up()\n" .
            "\t{\n" . $contentUp .
            "\n\t}" .
            "\n\n" .
            "\tpublic function down()\n" .
            "\t{\n" . $contentDown .
            "\n\t}" .
            "\n}\n";
        $classData = str_replace("\t", "    ", $classData);

        file_put_contents($this->migrationsDir . '/' . $version . '.php', $classData);

        return $classData;
    }
144762
public function getVariation(
        Field $field,
        VersionInfo $versionInfo,
        $variationName,
        array $parameters = []
    ) {
        /** @var \eZ\Publish\SPI\Variation\Values\ImageVariation $variation */
        $variation = $this->aliasGenerator->getVariation(
            $field,
            $versionInfo,
            $variationName,
            $parameters
        );

        if (null === $variation->width || null === $variation->height) {
            $variationBinaryFile = $this->getVariationBinaryFile($field->value->id, $variationName);
            $image = $this->imagine->load($this->ioService->getFileContents($variationBinaryFile));
            $dimensions = $image->getSize();

            return new ImageVariation(
                [
                    'name' => $variation->name,
                    'fileName' => $variation->fileName,
                    'dirPath' => $variation->dirPath,
                    'uri' => $variation->uri,
                    'imageId' => $variation->imageId,
                    'width' => $dimensions->getWidth(),
                    'height' => $dimensions->getHeight(),
                    'fileSize' => $variationBinaryFile->size,
                    'mimeType' => $this->ioService->getMimeType($variationBinaryFile->id),
                    'lastModified' => $variationBinaryFile->mtime,
                ]
            );
        }

        return $variation;
    }
683777
protected function concatFiles($files = Array(), $version = '')
    {

        if ($files[0] == 'sb' && strstr(\sb\Gateway::$agent, 'MSIE')) {

            array_unshift($files, 'js1_5');
        }

        $root = $this->toolkit_root;

        $binary = preg_match("~\.(swf|gif|png)$~", $files[0], $match);

        if ($binary) {
            if ($match[1] == 'swf') {
                header("Content-type: application/x-shockwave-flash");
            } elseif ($match[1] == 'gif' || $match[1] == 'png') {
                header("Content-type: image/" . $match[1]);
            }
        } else {
            $this->addJavascriptHeaders();
            echo '//v ' . date('m/d/Y H:i:s') . "\n";
        }

        if ($this->cache_enable) {
            $cache = isset(\App::$cache) ? \App::$cache : new Cache_FileSystem();
            $key = '/toolkit/' . md5(implode(",", $files));

            $data = $cache->fetch($key);
            if ($data) {
                echo $data;
                return true;
            }
        }

        $surebert = $this->default_files;
        $this->loaded_files = Array();
        foreach ($files as $file) {
            if ($binary) {
                $surebert[] = $file;
            } else {

                $surebert[] = str_replace('.', '/', $file) . '.js';
            }
        }
        ob_start();

        foreach ($surebert as $file) {
            echo $this->grabFile($file, $root);
        }

        $js = ob_get_clean();

        if (isset($this->request->get['manifest'])) {
            $m = $this->request->get['manifest'];
            if ($m == 'js') {
                return json_encode($this->loaded_files);
            } else {
                return print_r($this->loaded_files, 1);
            }
        }
        if ($this->cache_enable) {
            $cache->store($key, $js);
        }

        return $js;
    }