src/Downloader.php
public function getRecipes(array $operations): array
    {
        $paths = [];
        $chunk = '';
        foreach ($operations as $i => $operation) {
            $o = 'i';
            if ($operation instanceof UpdateOperation) {
                $package = $operation->getTargetPackage();
                $o = 'u';
            } else {
                $package = $operation->getPackage();
                if ($operation instanceof UninstallOperation) {
                    $o = 'r';
                }
            }

            $version = $package->getPrettyVersion();
            if (0 === strpos($version, 'dev-') && isset($package->getExtra()['branch-alias'])) {
                $branchAliases = $package->getExtra()['branch-alias'];
                if (
                    (isset($branchAliases[$version]) && $alias = $branchAliases[$version]) ||
                    (isset($branchAliases['dev-master']) && $alias = $branchAliases['dev-master'])
                ) {
                    $version = $alias;
                }
            }

            // FIXME: getNames() can return n names
            $name = str_replace('/', ',', $package->getNames()[0]);
            $path = sprintf('%s,%s%s', $name, $o, $version);
            if ($date = $package->getReleaseDate()) {
                $path .= ','.$date->format('U');
            }
            if (\strlen($chunk) + \strlen($path) > self::$MAX_LENGTH) {
                $paths[] = ['/p/'.$chunk];
                $chunk = $path;
            } elseif ($chunk) {
                $chunk .= ';'.$path;
            } else {
                $chunk = $path;
            }
        }
        if ($chunk) {
            $paths[] = ['/p/'.$chunk];
        }

        if (null !== $this->endpoint && self::$DEFAULT_ENDPOINT !== $this->endpoint) {
            $this->io->writeError('<warning>Using "'.$this->endpoint.'" as the Symfony endpoint</warning>');
        }

        $bodies = [];
        $this->rfs->download($paths, function ($path) use (&$bodies) {
            if ($body = $this->get($path, [], false)->getBody()) {
                $bodies[] = $body;
            }
        });

        $data = [];
        foreach ($bodies as $body) {
            foreach ($body['manifests'] as $name => $manifest) {
                $data['manifests'][$name] = $manifest;
            }
            foreach ($body['locks'] ?? [] as $name => $lock) {
                $data['locks'][$name] = $lock;
            }
        }

        return $data;
    }
public function getRecipes(array $operations): array
    {
        $paths = [];
        $chunk = '';
        foreach ($operations as $i => $operation) {
            $o = 'i';
            if ($operation instanceof UpdateOperation) {
                $package = $operation->getTargetPackage();
                $o = 'u';
            } else {
                $package = $operation->getPackage();
                if ($operation instanceof UninstallOperation) {
                    $o = 'r';
                }
            }

            $version = $package->getPrettyVersion();
            if (0 === strpos($version, 'dev-') && isset($package->getExtra()['branch-alias'])) {
                $branchAliases = $package->getExtra()['branch-alias'];
                if (
                    (isset($branchAliases[$version]) && $alias = $branchAliases[$version]) ||
                    (isset($branchAliases['dev-master']) && $alias = $branchAliases['dev-master'])
                ) {
                    $version = $alias;
                }
            }

            // FIXME: getNames() can return n names
            $name = str_replace('/', ',', $package->getNames()[0]);
            $path = sprintf('%s,%s%s', $name, $o, $version);
            if ($date = $package->getReleaseDate()) {
                $path .= ','.$date->format('U');
            }
            if (\strlen($chunk) + \strlen($path) > self::$MAX_LENGTH) {
                $paths[] = ['/p/'.$chunk];
                $chunk = $path;
            } elseif ($chunk) {
                $chunk .= ';'.$path;
            } else {
                $chunk = $path;
            }
        }
        if ($chunk) {
            $paths[] = ['/p/'.$chunk];
        }

        if (null !== $this->endpoint && self::$DEFAULT_ENDPOINT !== $this->endpoint) {
            $this->io->writeError('<warning>Using "'.$this->endpoint.'" as the Symfony endpoint</warning>');
        }

        $bodies = [];
        $this->rfs->download($paths, function ($path) use (&$bodies) {
            if ($body = $this->get($path, [], false)->getBody()) {
                $bodies[] = $body;
            }
        });

        $data = [];
        foreach ($bodies as $body) {
            foreach ($body['manifests'] as $name => $manifest) {
                $data['manifests'][$name] = $manifest;
            }
            foreach ($body['locks'] ?? [] as $name => $lock) {
                $data['locks'][$name] = $lock;
            }
        }

        return $data;
    }
public function getRecipes ( array $ operations ) : array { $ paths = [ ] ; $ chunk = '' ; foreach ( $ operations as $ i => $ operation ) { $ o = 'i' ; if ( $ operation instanceof UpdateOperation ) { $ package = $ operation -> getTargetPackage ( ) ; $ o = 'u' ; } else { $ package = $ operation -> getPackage ( ) ; if ( $ operation instanceof UninstallOperation ) { $ o = 'r' ; } } $ version = $ package -> getPrettyVersion ( ) ; if ( 0 === strpos ( $ version , 'dev-' ) && isset ( $ package -> getExtra ( ) [ 'branch-alias' ] ) ) { $ branchAliases = $ package -> getExtra ( ) [ 'branch-alias' ] ; if ( ( isset ( $ branchAliases [ $ version ] ) && $ alias = $ branchAliases [ $ version ] ) || ( isset ( $ branchAliases [ 'dev-master' ] ) && $ alias = $ branchAliases [ 'dev-master' ] ) ) { $ version = $ alias ; } } // FIXME: getNames() can return n names $ name = str_replace ( '/' , ',' , $ package -> getNames ( ) [ 0 ] ) ; $ path = sprintf ( '%s,%s%s' , $ name , $ o , $ version ) ; if ( $ date = $ package -> getReleaseDate ( ) ) { $ path .= ',' . $ date -> format ( 'U' ) ; } if ( \ strlen ( $ chunk ) + \ strlen ( $ path ) > self :: $ MAX_LENGTH ) { $ paths [ ] = [ '/p/' . $ chunk ] ; $ chunk = $ path ; } elseif ( $ chunk ) { $ chunk .= ';' . $ path ; } else { $ chunk = $ path ; } } if ( $ chunk ) { $ paths [ ] = [ '/p/' . $ chunk ] ; } if ( null !== $ this -> endpoint && self :: $ DEFAULT_ENDPOINT !== $ this -> endpoint ) { $ this -> io -> writeError ( '<warning>Using "' . $ this -> endpoint . '" as the Symfony endpoint</warning>' ) ; } $ bodies = [ ] ; $ this -> rfs -> download ( $ paths , function ( $ path ) use ( & $ bodies ) { if ( $ body = $ this -> get ( $ path , [ ] , false ) -> getBody ( ) ) { $ bodies [ ] = $ body ; } } ) ; $ data = [ ] ; foreach ( $ bodies as $ body ) { foreach ( $ body [ 'manifests' ] as $ name => $ manifest ) { $ data [ 'manifests' ] [ $ name ] = $ manifest ; } foreach ( $ body [ 'locks' ] ?? [ ] as $ name => $ lock ) { $ data [ 'locks' ] [ $ name ] = $ lock ; } } return $ data ; }
Downloads recipes.

@param OperationInterface[] $operations
Downloads recipes .