@param string $pathname Configuration file pathname

@return array
@throws \Darvin\AdminBundle\Metadata\Configuration\ConfigurationException
422299
public function load($pathname)
    {
        if (empty($pathname)) {
            throw new ConfigurationException('Configuration file pathname cannot be empty.');
        }

        $config = $this->getMergedConfig($pathname);

        return $this->processConfiguration($config, $pathname);
    }
1226775
public static function mapFileNameToClassName($fileName)
    {
        $matches = [];
        if (preg_match(static::MIGRATION_FILE_NAME_PATTERN, $fileName, $matches)) {
            $fileName = $matches[1];
        }

        return str_replace(' ', '', ucwords(str_replace('_', ' ', $fileName)));
    }
1271238
public static function resolve($fileName) {
        $path = array();
        foreach(explode('/', $fileName) as $part) {
            if (empty($part) || $part === '.') continue;
            if ($part !== '..')
                array_push($path, $part);
            else if (count($path) > 0)
                array_pop($path);
            else
                throw new PathException("can not resolve path \"$fileName\"");
        }
        return implode('/', $path);
    }
1353449
public static function getConfigFile($filename)
    {
        $filename = addslashes($filename);
        if (is_file($filename)) {
            $data = str_replace("\\", "\\\\", file_get_contents($filename));
            $json = json_decode($data, true);

            if (empty($json)) {
                throw new \Exception("Config file has a json parse error, $filename");
            }

        } else {
            throw new \Exception("Config file not found, $filename");
        }
        
        return $json;
    }
144625
public static function getFilenames($pathname, $extension = null) {

        // Check if the directory exists.
        if (false === file_exists($pathname)) {
            throw new FileNotFoundException($pathname);
        }

        // Initialize the filenames.
        $filenames = [];

        // Open the directory.
        if (false !== ($directory = opendir($pathname))) {

            // Initialize the offset.
            $offset = strlen($extension);

            // Read the directory.
            while (($file = readdir($directory)) !== false) {

                // Determines if the file should be added.
                if (false === in_array($file, [".", ".."]) && ((null === $extension) || 0 === substr_compare($file, $extension, -$offset))) {
                    $filenames[] = $file;
                }
            }

            // Close the directory.
            closedir($directory);
        }

        // Return the filenames.
        return $filenames;
    }
161656
private function getDirs($fileName)
    {
        if (is_file($fileName)) {
            return [];
        }

        $currentDir = getcwd();

        if (is_dir($fileName)) {
            $currentDir = $fileName;
        }

        $dirs[] = $currentDir;
        if (is_dir($currentDir.'/conf')) {
            $dirs[] = $currentDir.'/conf';
        }
        if (is_dir($currentDir.'/config')) {
            $dirs[] = $currentDir.'/config';
        }

        return $dirs;
    }
104157
protected function getTargetPath($pathname)
    {
        $filesystem      = new Filesystem();
        $templatesFolder = $this->getConfigKey('Folders', 'templates');
        $folderDiff      = '/' . $filesystem->findShortestPath(
                SetupHelper::getRootFolder(),
                $templatesFolder
            );

        return (string)$this->removeTemplateExtension(str_replace($folderDiff, '', $pathname));
    }
1220869
protected function mergeFileContent(string $pathAndFilename, array $configuration): array
    {
        if (!is_file($pathAndFilename)) {
            return $configuration;
        }

        try {
            $yaml = file_get_contents($pathAndFilename);
            if ($this->usePhpYamlExtension) {
                $loadedConfiguration = @yaml_parse($yaml);
                if ($loadedConfiguration === false) {
                    throw new ParseErrorException('A parse error occurred while parsing file "' . $pathAndFilename . '".', 1391894094);
                }
            } else {
                $loadedConfiguration = Yaml::parse($yaml);
            }
            unset($yaml);

            if (is_array($loadedConfiguration)) {
                $configuration = Arrays::arrayMergeRecursiveOverrule($configuration, $loadedConfiguration);
            }
        } catch (Exception $exception) {
            throw new ParseErrorException('A parse error occurred while parsing file "' . $pathAndFilename . '". Error message: ' . $exception->getMessage(), 1232014321);
        }

        return $configuration;
    }
45652
public static function getFileNameWithoutExtension($fileName)
    {
        $matches = [];

        if (is_string($fileName) && (bool)preg_match('|(.+)\.(.+)|', $fileName, $matches)) {
            return $matches[1];
        }

        return '';
    }
527743
public function getConfigArray($name)
    {
        $result = array_get($this->getConfig(), $name, []);

        if (is_string($result)) {
            $fileName = File::symbolizePath($result);

            if (File::isLocalPath($fileName)) {
                $path = $fileName;
            }
            else {
                $path = $this->getPath().'/'.$result;
            }

            if (!File::exists($path)) {
                throw new ApplicationException('Path does not exist: '.$path);
            }

            $result = Yaml::parseFile($path);
        }

        return (array) $result;
    }
648395
protected function getConfigurationFiles($path)
    {
        $files = [];

        foreach (Finder::create()->files()->name('*.php')->in($path) as $file) {
            $directory = $this->getNestedDirectory($file, $path);
            $files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath();
        }

        ksort($files, SORT_NATURAL);

        return $files;
    }
214633
public function getSDPFilesConfig($serverName, $vhostName)
    {
        list($response) = $this->getSDPFilesConfigWithHttpInfo($serverName, $vhostName);
        return $response;
    }
1150293
protected function getContentType($filename)
    {
        $extension = pathinfo($filename, PATHINFO_EXTENSION);
        $contentType = Psr7\mimetype_from_extension($extension);

        return ['contentType' => $contentType];
    }
441792
public static function getTypeFromFileName(string $fileName): string
    {
        $fileExtension = strtolower(Miscellaneous::getFileExtension($fileName));

        // Oops, incorrect type/extension of configuration file
        if (false === (new static())->isCorrectType($fileExtension)) {
            throw UnknownConfigurationFileTypeException::createException($fileExtension);
        }

        return $fileExtension;
    }
1327583
public function directories($directoryName)
    {
        if (!$this->isDir($directoryName)) {
            throw new FileNotFoundException('Directory not found in the path [ ' . $directoryName . ' ].');
        }

        $iterator = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($directoryName,
                RecursiveDirectoryIterator::CURRENT_AS_FILEINFO)
        );

        $directories = [];

        foreach($iterator as $file) {
            if($file->isDir()) {
                if( !(substr($file,-2) === '..')) {
                    $directories[] = trim($file,'.');
                }
            }
        }

        array_shift($directories);

        return $directories;
    }
12856
private function processConfiguration(array $config, $pathname)
    {
        $processor = new Processor();

        try {
            return $this->parameterBag->resolveValue($processor->processConfiguration(new Configuration(), $config));
        } catch (InvalidConfigurationException $ex) {
            throw new ConfigurationException(
                sprintf('Configuration file "%s" is invalid: "%s".', $pathname, $ex->getMessage())
            );
        }
    }
540830
public static function split($fileName)
    {
        $ext = pathinfo($fileName);
        return [
            $ext['dirname'],
            $ext['filename'],
            empty($ext['extension']) ? '' : $ext['extension']
        ];
    }