src/Sulu/Bundle/MediaBundle/DependencyInjection/AbstractImageFormatCompilerPass.php
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;
        }
    }
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;
        }
    }
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 ; } }
Adds the image formats from the file at the given path to the given array.

@param string $path
@param array $formats
Adds the image formats from the file at the given path to the given array .