Adds the image formats from the file at the given path to the given array.

@param string $path
@param array $formats
763267
private function loadFormatsFromFile($path, array &$formats)
    {
        $folder = dirname($path);
        $file = basename($path);

        $locator = new FileLocator($folder);

        $xmlLoader10 = new XmlFormatLoader10($locator);
        $xmlLoader11 = new XmlFormatLoader11($locator);
        $xmlLoader10->setGlobalOptions($this->globalOptions);
        $xmlLoader11->setGlobalOptions($this->globalOptions);

        $resolver = new LoaderResolver([$xmlLoader10, $xmlLoader11]);
        $loader = new DelegatingLoader($resolver);

        $fileFormats = $loader->load($file);
        foreach ($fileFormats as $format) {
            if (array_key_exists($format['key'], $formats) && $formats[$format['key']] !== $format) {
                throw new InvalidArgumentException(
                    sprintf('Media format with key "%s" already exists!', $format['key'])
                );
            }

            $formats[$format['key']] = $format;
        }
    }
27371
protected function applyCustomRegexPatterns($path, array $patterns) {
        foreach ($patterns as $pattern) {
            $path = preg_replace([$pattern->getRegexName()], $pattern->getRegexPattern(), $path);
        }

        return $path;
    }
813751
private function setFilePathCollection($path, array $data)
    {
        $key = \array_flip($this->filePathMapping)[$path];

        $this->filePathCollection[$key] = $data;
    }
20911
public static function addIncludePath(...$path): void
    {
        $paths = explode(PATH_SEPARATOR, get_include_path());

        foreach ($path as $r) {

            if (is_array($r)) {
                foreach ($r as $t) {
                    $paths[] = $t;
                }
            } else {
                $paths[] = $r;
            }
        }

        set_include_path(implode(PATH_SEPARATOR, array_unique($paths)));
    }
1058367
public function save($path, $format)
	{
		switch ($format) {
			case phpGPX::XML_FORMAT:
				$document = $this->toXML();
				$document->save($path);
				break;
			case phpGPX::JSON_FORMAT:
				file_put_contents($path, $this->toJSON());
				break;
			default:
				throw new \RuntimeException("Unsupported file format!");
		};
	}
493664
public static function file($path, $format = '')
	{
		if ($format === '')
		{
			$format = self::getExtension($path);
		}
		$text = file_get_contents($path);
		return self::output($text, $format);
	}
259558
public static function addPath($path)
    {
        if ( ! isset(self::$_configPaths[$path]))
        {
            self::$_configPaths[$path] = $path;
        }
    }
647701
public function setFormat($format, $mimeTypes)
    {
        if (null === static::$formats) {
            static::initializeFormats();
        }

        static::$formats[$format] = \is_array($mimeTypes) ? $mimeTypes : [$mimeTypes];
    }
15052
protected function init(string $path, array $files = [])
    {
        static::$path = $path;
        $this->addConfigFile($files);
        $this->load();
    }
1135916
public function addPath($path)
    {
        // just force to array
        settype($path, 'array');

        // loop through the path directories
        foreach ($path as $dir) {
            // no surrounding spaces allowed!
            $dir = trim($dir);

            // remove trailing slash
            if (substr($dir, -1) == DIRECTORY_SEPARATOR) {
                $dir = substr_replace($dir, '', -1);
            }

            // add to the top of the search dirs
            array_unshift($this->_paths, $dir);
        }
    }
1025835
public function addFolder(string $path)
    {
        if (!\is_dir($path)) {
            throw new \RuntimeException(\sprintf('The path "%s" does not exist or is not a directory.', $path));
        }
        $this->paths[] = $path;
    }
664444
private function addRequestFormats(Request $request, array $formats): void
    {
        foreach ($formats as $format => $mimeTypes) {
            $request->setFormat($format, (array) $mimeTypes);
        }
    }
498272
public static function addPath($path)
    {
        if ( ! isset(self::$_i18nPaths[$path]))
        {
            self::$_i18nPaths[$path] = $path;
        }
    }
590763
public function setPath($path)
    {
        $parts = explode(DS, $path);
        $filename = array_pop($parts);

        // with format.
        if (preg_match('/^(.+?)\.(.+)$/', $filename, $matches)) {
            $filename = $matches[1];
            $format = $matches[2];
            $parts[] = $filename;
            $this->path = join(DS, $parts);
            $this->setParam('format', $format);

        // no format
        } else {
            $this->path = $path;
        }
    }
984415
public function add($path, array $values)
    {
        $get = (array) $this->get($path);
        $this->set($path, $this->arrayMergeRecursiveDistinct($get, $values));
    }
1294527
public function add(string $path, array $values): void
    {
        $get = (array)$this->get($path);
        $this->set($path, $this->arrayMergeRecursiveDistinct($get, $values));
    }
1171972
public static function loadAllFromPath($path, $format, $package = null)
    {
        $config = Ioc::getConfig();

        $locale  = $config['language.locale'] ?: 'en-GB';
        $default = $config['language.default'] ?: 'en-GB';
        $locale  = LanguageNormalize::toLanguageTag($locale);
        $default = LanguageNormalize::toLanguageTag($default);

        $localePath = $path . '/' . $locale;

        $files = [];

        if (is_dir($localePath)) {
            $files = array_merge($files, (array) Folder::files($localePath, false, Folder::PATH_BASENAME));
        }

        $defaultPath = $path . '/' . $default;

        if (is_dir($defaultPath)) {
            $files = array_merge($files, (array) Folder::files($defaultPath, false, Folder::PATH_BASENAME));
        }

        foreach ($files as $file) {
            $ext = File::getExtension($file);

            if (strcasecmp($ext, $format) !== 0) {
                continue;
            }

            static::loadFile(File::stripExtension($file), strtolower($format), $package);
        }
    }