Exemplo n.º 1
0
 protected function resolveLockDependencies(Manager $manager, LockConfigInterface $config, $requiresDevelopmentPackages)
 {
     $resolver = new DependencyResolver($manager);
     foreach ($config->getConstraints() as $constraint) {
         if ($constraint->getDevelopmentPackage() && !$requiresDevelopmentPackages) {
             continue;
         }
         $resolver->resolve($constraint->getName(), $constraint->getVersion(), $constraint->getDevelopmentPackage());
     }
     return $resolver;
 }
Exemplo n.º 2
0
 protected function saveLockFile(OutputInterface $output, DependencyResolver $resolver)
 {
     $output->writeln('');
     $output->writeln('Writing lock file...');
     $data = ['constraints' => []];
     /** @var PackageInterface $package */
     foreach ($resolver->getResolvedDependencies() as $package) {
         $output->writeln(sprintf('<info>%s (%s)</info>', $package->getName(), $package->getVersion()->getPrettyString()));
         $data['constraints'][$package->getName()] = ['development' => $package->getVersion()->getPrettyString(), 'version' => $package->getVersion()->getPrettyString(), 'source' => ['type' => $package->getSource()->getType(), 'url' => $package->getSource()->getUrl(), 'reference' => $package->getSource()->getReference()]];
     }
     file_put_contents('resolver.lock', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n");
 }