@param string $cafile

@return array

@private since 1.1.0

TODO (2.0.0): remove argument (unnused in the codebase) and rename this method as an `init*` as is used in the
constructor anymore
500819
protected function getTlsStreamContextDefaults($cafile)
    {
        $ciphers = implode(':', array(
            'ECDHE-RSA-AES128-GCM-SHA256',
            'ECDHE-ECDSA-AES128-GCM-SHA256',
            'ECDHE-RSA-AES256-GCM-SHA384',
            'ECDHE-ECDSA-AES256-GCM-SHA384',
            'DHE-RSA-AES128-GCM-SHA256',
            'DHE-DSS-AES128-GCM-SHA256',
            'kEDH+AESGCM',
            'ECDHE-RSA-AES128-SHA256',
            'ECDHE-ECDSA-AES128-SHA256',
            'ECDHE-RSA-AES128-SHA',
            'ECDHE-ECDSA-AES128-SHA',
            'ECDHE-RSA-AES256-SHA384',
            'ECDHE-ECDSA-AES256-SHA384',
            'ECDHE-RSA-AES256-SHA',
            'ECDHE-ECDSA-AES256-SHA',
            'DHE-RSA-AES128-SHA256',
            'DHE-RSA-AES128-SHA',
            'DHE-DSS-AES128-SHA256',
            'DHE-RSA-AES256-SHA256',
            'DHE-DSS-AES256-SHA',
            'DHE-RSA-AES256-SHA',
            'AES128-GCM-SHA256',
            'AES256-GCM-SHA384',
            'AES128-SHA256',
            'AES256-SHA256',
            'AES128-SHA',
            'AES256-SHA',
            'AES',
            'CAMELLIA',
            'DES-CBC3-SHA',
            '!aNULL',
            '!eNULL',
            '!EXPORT',
            '!DES',
            '!RC4',
            '!MD5',
            '!PSK',
            '!aECDH',
            '!EDH-DSS-DES-CBC3-SHA',
            '!EDH-RSA-DES-CBC3-SHA',
            '!KRB5-DES-CBC3-SHA',
            '!ADH'
        ));

        $options = array(
            'ssl' => array(
                'ciphers' => $ciphers,
                'verify_peer' => true,
                'verify_depth' => 7,
                'SNI_enabled' => true,
            )
        );

        if (!$cafile) {
            $cafile = CaBundle::getSystemCaRootBundlePath();
        }
        if (is_dir($cafile)) {
            $options['ssl']['capath'] = $cafile;
        } elseif ($cafile) {
            $options['ssl']['cafile'] = $cafile;
        } else {
            throw new RuntimeException('A valid cafile could not be located locally.');
        }

        if (version_compare(PHP_VERSION, '5.4.13') >= 0) {
            $options['ssl']['disable_compression'] = true;
        }

        return $options;
    }
287922
public static function getInstance($configFile='config.yml')
    {
        static $instance = null;
        if (null === $instance) {
            $instance = new static();
        }

        $configuration = Yaml::parse(file_get_contents($configFile));
        $instance->setParams($configuration);

        return $instance;
    }
160710
protected function loadConfiguration($configFile = false)
    {
        if ($configFile === false) {
            return;
        }
        echo "\nLoad configuration";

        $configuration = require $configFile;

        foreach ($configuration as $name => $value) {
            if ($this->module->canSetProperty($name) == true) {
                $this->module->$name = $value;
            } else {
                throw new InvalidConfigException("Invalid configuration. Unknown configuration option '{$name}'");
            }
        }
        $this->module->loadComponents();
    }
969635
public static function loadSettings($iniFile)
    {
        if (!file_exists($iniFile)) {
            throw new \Genesis\Exceptions\InvalidArgument(
                'The provided configuration file is invalid or inaccessible!'
            );
        }

        $settings = parse_ini_file($iniFile, true);

        foreach ($settings['Genesis'] as $option => $value) {
            if (array_key_exists($option, self::$vault)) {
                self::$vault[$option] = $value;
            }
        }

        foreach ($settings['Interfaces'] as $option => $value) {
            if (array_key_exists($option, self::$interfaces)) {
                self::$interfaces[$option] = $value;
            }
        }
    }
1150383
public function get($sFilterValue) : array
    {
        if (empty($sFilterValue)) {
            return [];
        }

        $this->sValue = $sFilterValue;
        if (array_key_exists($this->getCacheKey(), $this->arCachedList) && is_array($this->arCachedList[$this->getCacheKey()])) {
            return $this->arCachedList[$this->getCacheKey()];
        }

        $arElementIDList = $this->getIDList();
        $this->arCachedList[$this->getCacheKey()] = $arElementIDList;

        return $arElementIDList;
    }
1027805
private function createConfigFromFile(string $configFile) : Config
    {
        $ini = parse_ini_file($configFile);
        return new Config($ini['token'] ?? '', $ini['provider'] ?? Config::PROVIDER_GITHUB);
    }
14077
public function setOnDiskConfiguration(?string $configFile = null): ConfigurationBuilder
    {
        $this->configFile = $configFile;

        if ($this->configFile) {
            if (file_exists($path = getcwd() . '/' . $this->configFile)) {
                $this->configFile = $path;
            }

            if (!file_exists($this->configFile)) {
                throw new \InvalidArgumentException('The specified config file is not a valid file.');
            }

            $info = pathinfo($this->configFile);

            $fileExt = strtolower($info['extension']);

            switch ($fileExt) {
                case 'xml':
                    $diskConfig = $this->loadXmlFile($this->configFile);
                    break;

                case 'yml':
                case 'yaml':
                    $diskConfig = Yaml::parse(file_get_contents($this->configFile));
                    break;

                default:
                    throw new \InvalidArgumentException(
                        sprintf(
                            'The specified config file should end in .xml or .yml/.yaml. Unrecognized extension [%s]',
                            $fileExt
                        )
                    );
            }

            $this->configParams = array_merge($this->configParams, $diskConfig);
        }

        return $this;
    }
174921
public function actionTemplate($configFile)
    {
        $jsCompressor = VarDumper::export($this->jsCompressor);
        $cssCompressor = VarDumper::export($this->cssCompressor);

        $template = <<<EOD
<?php
/**
 * Configuration file for the "yii asset" console command.
 */

// In the console environment, some path aliases may not exist. Please define these:
// \$this->app->setAlias('@webroot', __DIR__ . '/../web');
// \$this->app->setAlias('@web', '/');

return [
    // Adjust command/callback for JavaScript files compressing:
    'jsCompressor' => {$jsCompressor},
    // Adjust command/callback for CSS files compressing:
    'cssCompressor' => {$cssCompressor},
    // Whether to delete asset source after compression:
    'deleteSource' => false,
    // The list of asset bundles to compress:
    'bundles' => [
        // 'app\assets\AppAsset',
        // \yii\web\YiiAsset::class,
        // \yii\web\JqueryAsset::class,
    ],
    // Asset bundle for compression output:
    'targets' => [
        'all' => [
            '__class' => \yii\web\AssetBundle::class,
            'basePath' => '@webroot/assets',
            'baseUrl' => '@web/assets',
            'js' => 'js/all-{hash}.js',
            'css' => 'css/all-{hash}.css',
        ],
    ],
    // Asset manager configuration:
    'assetManager' => [
        //'basePath' => '@webroot/assets',
        //'baseUrl' => '@web/assets',
    ],
];
EOD;
        if (file_exists($configFile)) {
            if (!$this->confirm("File '{$configFile}' already exists. Do you wish to overwrite it?")) {
                return ExitCode::OK;
            }
        }
        if (!file_put_contents($configFile, $template, LOCK_EX)) {
            throw new Exception("Unable to write template file '{$configFile}'.");
        }

        $this->stdout("Configuration file template created at '{$configFile}'.\n\n", Console::FG_GREEN);
        return ExitCode::OK;
    }
1027840
function findInputFiles( &$inputFiles, &$iniFile )
    {
        $iniFile = __DIR__ . "/../../../";
        if ( $this->RootDir !== false )
            $iniFile .= eZDir::path( array( $this->RootDir, $this->FileName ) );
        else
            $iniFile .= eZDir::path( array( $this->FileName ) );

        $inputFiles = array();

        if ( $this->FileName === 'override.ini' )
        {
            eZExtension::prependExtensionSiteAccesses( false, $this, true, false, false );
        }

        if ( file_exists( $iniFile ) )
            $inputFiles[] = $iniFile;

        // try the same file name with '.append.php' replace with '.append'
        if ( strpos($iniFile, '.append.php') !== false && preg_match('#^(.+.append).php$#i', $iniFile, $matches ) && file_exists( $matches[1] ) )
            $inputFiles[] = $matches[1];

        if ( strpos($iniFile, '.php') === false && file_exists ( $iniFile . '.php' ) )
            $inputFiles[] = $iniFile . '.php';

        if ( $this->DirectAccess )
        {
            if ( file_exists ( $iniFile . '.append' ) )
            {
                // recursion eZDebug::writeStrict( "INI files with *.ini.append suffix is DEPRECATED, use *.ini or *.ini.append.php instead: $iniFile.append", __METHOD__ );
                $inputFiles[] = $iniFile . '.append';
            }

            if ( file_exists ( $iniFile . '.append.php' ) )
                $inputFiles[] = $iniFile . '.append.php';
        }
        else
        {
            $overrideDirs = $this->overrideDirs();
            $fileName = $this->FileName;
            $rootDir = $this->RootDir;
            foreach ( $overrideDirs as $overrideDirItem )
            {
                $overrideDir = $overrideDirItem[0];
                $isGlobal = $overrideDirItem[1];
                if ( $isGlobal )
                    $overrideFile = eZDir::path( array( $overrideDir, $fileName ) );
                 else
                    $overrideFile = eZDir::path( array( $rootDir, $overrideDir, $fileName ) );

                if ( file_exists( $overrideFile . '.php' ) )
                {
                    // recursion eZDebug::writeStrict( "INI files with *.ini.php suffix is DEPRECATED, use *.ini or *.ini.append.php instead: $overrideFile.php", __METHOD__ );
                    $inputFiles[] = $overrideFile . '.php';
                }

                if ( file_exists( $overrideFile ) )
                {
                    $inputFiles[] = $overrideFile;
                }

                if ( file_exists( $overrideFile . '.append.php' ) )
                {
                    $inputFiles[] = $overrideFile . '.append.php';
                }

                if ( file_exists( $overrideFile . '.append' ) )
                {
                    // recursion eZDebug::writeStrict( "INI files with *.ini.append suffix is DEPRECATED, use *.ini or *.ini.append.php instead: $overrideFile.append", __METHOD__ );
                    $inputFiles[] = $overrideFile . '.append';
                }
            }
        }
    }
1288609
public static function getClassesFromFile($file)
    {
        $php = \File::get($file);
        $classes = array();
        $tokens = token_get_all($php);
        $count = count($tokens);
        for ($i = 2; $i < $count; $i++) {
            if ($tokens[$i - 2][0] == T_CLASS
                && $tokens[$i - 1][0] == T_WHITESPACE
                && $tokens[$i][0] == T_STRING
            ) {
                $class_name = $tokens[$i][1];
                $namespace = self::getNamespace($tokens);
                $classes[] = $namespace . "\\" . $class_name;
            }
        }
        return $classes;
    }
25173
public function getResourceUrl($sFile = null)
    {
        if ($sFile) {
            $sValue = $this->getConfig()->getResourceUrl($sFile, $this->isAdmin());
        } elseif (($sValue = $this->getViewConfigParam('basetpldir')) === null) {
            $sValue = $this->getConfig()->getResourceUrl('', $this->isAdmin());
            $this->setViewConfigParam('basetpldir', $sValue);
        }

        return $sValue;
    }
1344147
private static function loadDefinitionsFromFile(string $file): array
    {
        if (!\is_file($file) || !\is_readable($file)) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException(\sprintf('"%s" must be a readable file', $file));
            // @codeCoverageIgnoreEnd
        }

        $definitions = require $file;

        if (!\is_array($definitions)) {
            throw new \RuntimeException(
                \sprintf('Definitions file should return an array. "%s" returned', \gettype($definitions))
            );
        }

        return $definitions;
    }
880916
protected function fetchConfig($configFile)
    {
        if (is_string($configFile) && ! is_readable($configFile)) {
            $configFile = [];
        }

        return ConfigFactory::create($configFile);
    }
174539
private function fileToCodaLines(string $codaFile): array
	{
		return array_map(
			function($line) {
				return mb_convert_encoding($line, "UTF-8", "ISO-8859-1");
			},
			file($codaFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES));
	}
1317522
public function load($csvFile)
    {
        $returnValue = null;

        $csv = new tao_helpers_data_CsvFile($this->options);
        $csv->load($csvFile);
        $this->loadedFile = $csv;
        $returnValue = $this->loadedFile;

        return $returnValue;
    }
50683
private function _parseIni($iniFile)
    {
        $aParsedIni = parse_ini_file($iniFile, true, INI_SCANNER_RAW);
        $tmpArray = array();
        foreach ($aParsedIni as $key=>$value) {
            if (strpos($key, ':') !== false) {
                $sections = explode(':', $key);
                if (count($sections) != 2) {
                    throw new Exception('Malformed section header!');
                }
                $currentSection = trim($sections[0]);
                $parentSection = trim($sections[1]);
                $value = array_merge_recursive(
                    $aParsedIni[$parentSection],
                    $aParsedIni[$key]
                );
                $aParsedIni[$currentSection] = $value;
                unset($aParsedIni[$key]);
                $key = $currentSection;
            }
            if (is_array($value)) {
                foreach ($value as $vk=>$vv) {
                    $newKey = $key.".".$vk;
                    $tmpArray[$newKey] = $vv;
                    if (
                           is_string($vv) &&
                           preg_match_all('/\${([a-zA-Z0-9\.]+)}/', $vv, $match)
                        ) {
                        if (!isset($match[1])) {
                            continue;
                        }
                        $variableKey = $match[1];
                        foreach ($variableKey as &$var) {
                            if (strpos($var, '.') === false) {
                                $var = $key . '.' . $var;
                            }
                        }
                        $this->_varDeps[$newKey] = $variableKey;
                    }
                }
            }
        }
        if (!empty($tmpArray)) {
            $aParsedIni = $tmpArray;
        }
        foreach ($aParsedIni as $key=>$value) {    //extract parsed array keys
            if (array_key_exists($key, $this->_varDeps)) {
                $deps = &$this->_varDeps;
                $value = preg_replace_callback(
                    '/\${([a-zA-Z0-9\.]+)}/',
                    function ($match) use ($key, $aParsedIni, &$deps) {
                        return $aParsedIni[array_shift($deps[$key])];
                    },
                    $value
                );
                $aParsedIni[$key] = $value;
            }
            $this->_tmpValue = $value;//set temporay value to current ini value
            $aXKey = explode($this->_delimiter, $key);    //get ini key segments
            //set object properties recursively based on parsed ini
            $this->_recursiveInit($this->_obj, $aXKey);
        }
    }
926832
public function decryptFile($strFile)
    {
        if (file_exists($strFile)) {
            $strEncryptedData = file_get_contents($strFile);

            return $this->decrypt($strEncryptedData);
        } else {
            throw new Caller('File does not exist: ' . $strFile);
        }
    }