Getter accessor to have all values contain into a config file

@param string $filename The filename config to read

@return mixed
197783
public function getConfigByFilename(string $filename)
    {
        if (!isset($this->config[$filename])) {
            throw new Exception(
                'The file '.$filename.' has not been found',
                $this::ERR_FILE_NOT_FOUND
            );
        }
        
        return $this->config[$filename];
    }
97527
public function getParams($filename = "")
    {

        if (empty($filename)) {
            return $this->namespace;
        } elseif (!empty($filename) && isset($this->namespace[$filename])) {
            return $this->namespace[$filename];
        } else {
            return array(); //if the params don't exists;
        }
    }
129911
public function getFileContents($filename)
    {
        if ($contents = file_get_contents($filename)) {
            if (preg_match('/<body ?.*?>(.+)<\/body>/s', $contents, $matches)) {
                return $matches[1];
            } else { // it's not HTML, so output it as plain text
                return $contents;
            }
        }
        return FALSE;
    }
744950
public static function load( $fileName )
	{
		if( !file_exists( $fileName ) )
			throw new Exception( 'File "'.$fileName.'" is not existing.' );

		$reader	= new FS_File_Reader( $fileName );
		$lines	= $reader->readArray();
		
		$list	= array();
		foreach( $lines as $line )
		{
			$line = trim( $line );
			if( !$line )
				continue;
			if( preg_match( self::$commentPattern, $line ) )
				continue;
					
			if( preg_match( self::$sectionPattern, $line ) )
			{
				$section = substr( $line, 1, -1 );
				if( !isset( $list[$section] ) )
					$list[$section]	= array();
			}
			else if( $section )
				$list[$section][]	= $line;
		}
		return $list;
	}
45652
public static function getFileNameWithoutExtension($fileName)
    {
        $matches = [];

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

        return '';
    }
165666
protected function readData($fileName)
    {
        $client   = new Client([ 'defaults' => [ 'timeout' => $this->getConfiguration()->getTimeout() ] ]);
        $response = $client->get($fileName);

        return $response->getBody();
    }
1158051
public function get($filename)
    {
        $filename = $this->path($filename);

        if (!(is_file($filename) && stream_is_local($filename))) {
            return null;
        }

        return file_get_contents($filename);
    }
604007
protected function getFullPath($fileName)
    {
        if (!is_string($fileName)) {
            throw new \InvalidArgumentException('the given path is invalid');
        }

        $fileName = trim($fileName);

        if (realpath($fileName) && !(basename($fileName) === $fileName)) {
            return realpath($fileName);
        }

        $fullName = implode(DIRECTORY_SEPARATOR, array($this->configurationFileDir, $fileName));

        if (file_exists($fullName)) {
            return realpath($fullName);
        }

        throw new \InvalidArgumentException('The specified path \'' . $fullName . '\' does not exist');
    }
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;
    }
46651
protected function getFile($filename)
    {
        try {
            $file = $this->client->repos()->contents()->show($this->raw['owner']['login'], $this->raw['name'], $filename);
            if ('base64' === $file['encoding']) {
                return base64_decode($file['content'], true);
            }
        } catch (\Exception $e) {
            //file not found
        }
    }
906463
public function getFileData($fileName)
    {
        if (!in_array($fileName, $this->files, true))
            return false;

        return $this->archive->getFileData($fileName);
    }
354525
public function get($filename)
    {
        if ($this->exists($filename) && $this->isFile($filename)) {
            return file_get_contents($filename);
        }

        throw new FileNotFoundException('File not found in the path [ ' . $filename . ' ].');
    }
1339629
public function readdata($filename) {

        // Find if we are importing a .txt file.
        if (strtolower(pathinfo($filename, PATHINFO_EXTENSION)) == 'txt') {
            if (!is_readable($filename)) {
                $this->error(get_string('filenotreadable', 'error'));
                return false;
            }
            return file($filename);
        }
        // We are importing a zip file.
        // Create name for temporary directory.
        $this->tempdir = make_request_directory();
        if (is_readable($filename)) {
            if (!copy($filename, $this->tempdir . '/webct.zip')) {
                $this->error(get_string('cannotcopybackup', 'question'));
                fulldelete($this->tempdir);
                return false;
            }
            $packer = get_file_packer('application/zip');
            if ($packer->extract_to_pathname($this->tempdir . '/webct.zip', $this->tempdir, null, null, true)) {
                $dir = $this->tempdir;
                if ((($handle = opendir($dir))) == false) {
                    // The directory could not be opened.
                    fulldelete($this->tempdir);
                    return false;
                }
                // Create arrays to store files and directories.
                $dirfiles = array();
                $dirsubdirs = array();
                $slash = '/';

                // Loop through all directory entries, and construct two temporary arrays containing files and sub directories.
                while (false !== ($entry = readdir($handle))) {
                    if (is_dir($dir. $slash .$entry) && $entry != '..' && $entry != '.') {
                        $dirsubdirs[] = $dir. $slash .$entry;
                    } else if ($entry != '..' && $entry != '.') {
                        $dirfiles[] = $dir. $slash .$entry;
                    }
                }
                if ((($handle = opendir($dirsubdirs[0]))) == false) {
                    // The directory could not be opened.
                    fulldelete($this->tempdir);
                    return false;
                }
                while (false !== ($entry = readdir($handle))) {
                    if (is_dir($dirsubdirs[0]. $slash .$entry) && $entry != '..' && $entry != '.') {
                        $dirsubdirs[] = $dirsubdirs[0]. $slash .$entry;
                    } else if ($entry != '..' && $entry != '.') {
                        $dirfiles[] = $dirsubdirs[0]. $slash .$entry;
                    }
                }
                return file($dirfiles[1]);
            } else {
                $this->error(get_string('cannotunzip', 'question'));
                fulldelete($this->tempdir);
            }
        } else {
            $this->error(get_string('cannotreaduploadfile', 'error'));
            fulldelete($this->tempdir);
        }
        return false;
    }
620889
protected function loadConfiguration($fileName) {
        if (!is_file($fileName)) throw new StrutsConfigException('Configuration file not found: "'.$fileName.'"');

        // TODO: what about checking the search result?
        $content = file_get_contents($fileName);
        $search  = '<!DOCTYPE struts-config SYSTEM "struts-config.dtd">';
        $offset  = strpos($content, $search);
        $dtd     = str_replace('\\', '/', __DIR__.'/dtd/struts-config.dtd');
        $replace = '<!DOCTYPE struts-config SYSTEM "file:///'.$dtd.'">';
        $content = substr_replace($content, $replace, $offset, strlen($search));

        // Konfiguration parsen und validieren
        return new \SimpleXMLElement($content, LIBXML_DTDVALID|LIBXML_NONET);
    }
175395
public static function fromFile(string $filename = ''): self
    {
        if (!\file_exists($filename)) {
            throw new \Exception($filename.' does not exist');
        }
        $contents = \file_get_contents($filename);
        if (!\is_string($contents)) {
            throw new \Exception('Could not read file contents');
        }
        return self::fromData($contents);
    }
866003
public function getFile( $fileName )
	{
		if( !$this->numFiles )
			return NULL;
		foreach( $this->files as $key => $information )
			if( $information['name'] == $fileName )
				return $information;
	}
989559
public function get_config_json( $filename ) {
		if ( isset( $this->loaded[ $filename ] ) ) {
			return $this->loaded[ $filename ];
		}

		$config = $this->path . 'config/' . $filename . '.json';

		if ( ! file_exists( $config ) ) {
			return null;
		}

		$contents = file_get_contents( $config );

		if ( false === $contents ) {
			return null;
		}

		return $this->loaded[ $filename ] = json_decode( $contents, true );
	}