Loads the xml file, substitutes params

@param string $file
@param array $params
@return string
5819
protected static function renderXML($file, $params)
    {
        // check if already loaded
        if (empty(static::$xml[$file])) {
            // load if file not loaded
            static::$xml[$file] = file_get_contents(__DIR__ . '/xml/'.$file.'.xml');
        }

        // build the search and replace arrays
        $search = [];
        $replace = [];

        foreach ($params as $key => $value) {
            $search[] = ':'.$key;
            $replace[] = $value;
        }

        // return the rendered file
        return str_replace($search, $replace, static::$xml[$file]);
    }
262383
protected function loadMappingFile($file)
    {
        $result     = [];
        $xmlElement = simplexml_load_file($file);

        if (isset($xmlElement->entity)) {
            foreach ($xmlElement->entity as $entityElement) {
                $entityName          = (string) $entityElement['name'];
                $result[$entityName] = $entityElement;
            }
        }

        return $result;
    }
957936
public function load($file)
    {
        $resource = new ZipFileResource($file);

        $package = $resource->getXML('META-INF/container.xml');

        if (!$opfFile = (string) $package->rootfiles->rootfile['full-path']) {
            $ns = $package->getNamespaces();
            foreach ($ns as $key => $value) {
                $package->registerXPathNamespace($key, $value);
                $items = $package->xpath('//'. $key .':rootfile/@full-path');
                $opfFile = (string) $items[0]['full-path'];
            }
        }

        $data = $resource->get($opfFile);

        // all files referenced in the OPF are relative to it's directory
        if ('.' !== $dir = dirname($opfFile)) {
            $resource->setDirectory($dir);
        }

        $opfResource = new OpfResource($data, $resource);
        $package = $opfResource->bind();
        
        $package->opfDirectory = dirname($opfFile);
        
        if ($package->navigation->src->href) {
            $ncx = $resource->get($package->navigation->src->href);
            $ncxResource = new NcxResource($ncx);
            $package = $ncxResource->bind($package);
        }
        
        return $package;
    }
1066891
public function loadFromFile(string $file, array $options = []): Dom
    {
        return $this->loadStr(file_get_contents($file), $options);
    }
1251984
protected function loadConfigFile($file)
    {
        $path = $this->getConfigPath() . '/' . $file;

        if (file_exists($path)) {
            $config = include $path;
            return is_array($config) ? $config : null;
        }

        return null;
    }
533705
protected function parseFile($file)
    {
        try {
            $dom = XmlUtils::loadFile($file, __DIR__ . static::SCHEME_PATH);
        } catch (\InvalidArgumentException $e) {
            throw new \InvalidArgumentException(sprintf('Unable to parse file "%s".', $file), $e->getCode(), $e);
        }

        return $dom;
    }
232968
protected function loadFile($file)
    {
        if (!class_exists('zxf\Symfony\Component\Yaml\Parser')) {
            throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.');
        }

        if (!stream_is_local($file)) {
            throw new InvalidArgumentException(sprintf('This is not a local file "%s".', $file));
        }

        if (!file_exists($file)) {
            throw new InvalidArgumentException(sprintf('The file "%s" does not exist.', $file));
        }

        if (null === $this->yamlParser) {
            $this->yamlParser = new YamlParser();
        }

        $prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use ($file, &$prevErrorHandler) {
            $message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$file.'"$0', $message) : $message;

            return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false;
        });

        try {
            $configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
        } catch (ParseException $e) {
            throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e);
        } finally {
            restore_error_handler();
        }

        return $this->validate($configuration, $file);
    }
602816
private function parseFile($file)
    {
        try {
            $dom = XmlUtils::loadFile($file, __DIR__.'/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd');
        } catch (\Exception $e) {
            throw new MappingException($e->getMessage(), $e->getCode(), $e);
        }

        return simplexml_import_dom($dom);
    }
1258586
private function loadFile ($file)
	{
		if (!isset ($this->files[$file]))
		{
			$filename = $this->folder . $file . '.php';

			// First load these
			if (file_exists ($filename))
			{
				$this->files[$file] = include ($filename);
			}

			// Now overload with environment values
			if (isset ($this->environment))
			{
				$filename = $this->folder . $this->environment . '/' . $file . '.php';
				if (file_exists ($filename))
				{
					$this->merge ($file, include ($filename));
				}
			}

		}
	}
152402
public static function loadFromFile(string $file): Dom
    {
        $dom       = new Dom;
        self::$dom = $dom;

        return $dom->loadFromFile($file);
    }
901175
public function fromFile($file)
    {
        /** @var \DOMDocument $xmlDomDocument */
        if (!$xmlDomDocument = XmlUtils::loadFile($file, __DIR__ . '/../xsd/enums.xsd')) {
            throw new \RuntimeException(sprintf(
                'Invalid enums xml file "%s".',
                $file
            ));
        }

        /** @var array $xmlData */
        if (!$xmlData = XmlUtils::convertDomElementToArray($xmlDomDocument->firstChild)) {
            throw new \RuntimeException('Invalid enum DOM object.');
        }

        $namespace = $xmlData['enums']['namespace'];

        $filePath = substr($file, 0, -strlen(basename($file)) - 1);
        $enumsPath = str_replace(':', '/', $namespace);

        // invalid enum file location
        if (substr($filePath, -strlen($enumsPath)) !== $enumsPath) {
            throw new \RuntimeException(sprintf(
                'Invalid enums xml directory "%s". Expected sub-directory "%s".',
                $filePath,
                $enumsPath
            ));
        }

        // get language options
        $languages = [];
        foreach ($xmlData['enums'] as $key => $value) {
            if (substr($key, -8) == '-options') {
                $languages[$key] = $value;
            }
        }

        $enums = [];

        if (isset($xmlData['enums']['enum'])) {
            $xmlData['enums']['enum'] = $this->fixArray($xmlData['enums']['enum'], 'name');

            foreach ($xmlData['enums']['enum'] as $enum) {
                $enumId = EnumId::fromString(sprintf('%s:%s', $namespace, $enum['name']));

                // duplicate schema
                if (array_key_exists($enumId->toString(), $enums)) {
                    throw new \RuntimeException(sprintf(
                        'Duplicate enum "%s" in file "%s".',
                        $enumId->toString(),
                        $file
                    ));
                }

                $enums[] = $this->parse(array_merge($enum, $languages, ['namespace' => $namespace]));
            }
        }

        return $enums;
    }
933208
public final function loadFile($file) {
        $f = $this->getPath($file);
        if (is_file($f) && is_readable($f)) {
            return @file_get_contents($f);
        }

        return false;
    }
1022305
private function loadDocument($file)
    {
        $data = trim(@file_get_contents($file));

        if (empty($data)) {
            throw new \InvalidArgumentException(sprintf('The XML mapping file "%s" is not valid.', $file));
        }

        $internalErrors = libxml_use_internal_errors();
        $disableEntities = libxml_disable_entity_loader();

        $this->setLibXmlState(true, true);

        $document = new \DOMDocument();
        $document->validateOnParse = true;

        if (!@$document->loadXML($data, LIBXML_NONET | LIBXML_COMPACT)) {
            throw $this->createException($file, $internalErrors, $disableEntities);
        }

        $document->normalizeDocument();

        if (!@$document->schemaValidateSource(file_get_contents(__DIR__.'/../Resource/mapping.xsd'))) {
            throw $this->createException($file, $internalErrors, $disableEntities);
        }

        foreach ($document->childNodes as $child) {
            if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
                throw new \InvalidArgumentException('The document type is not allowed.');
            }
        }

        $this->setLibXmlState($internalErrors, $disableEntities);

        return $document;
    }
222572
public function loadConfig($file)
    {
        $config;

        switch (pathinfo($file, PATHINFO_EXTENSION)) {
        case 'json':
            $config = json_decode(file_get_contents($file));
            break;
        case 'php':
            $config = include $file;
            break;
        default:
            return $this;
        }

        $this->doCallback('configurationLoaded', array($config, $this));
        
        return $config;
    }
1110034
public function load(string $file)
    {
        $this->data = Yaml::parse(file_get_contents($file));
        $this->filename = basename($file);
    }
326706
public function load($file)
    {
        if (!is_readable($file)) {
            throw new ConfigurationException(sprintf("Cannot read configuration file: %s", $file));
        }

        try {
            $config = Yaml::parse(file_get_contents($file));
        } catch (ParseException $e) {
            throw new ConfigurationException('Error in configuration file: %s', $e->getMessage());
        }

        return $this->loadFromArray($config);
    }
1115574
protected function tryLoad($file)
    {
        try {
            return XmlUtils::loadFile($file, __DIR__ . static::SCHEMA_LOCATION);
        } catch (\InvalidArgumentException $e) {
            throw new InvalidWebspaceException(
                sprintf(
                    'Could not parse webspace XML file "%s"',
                    $file
                ),
                null,
                $e
            );
        }
    }