StreamableRepositoryInterface.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\Repository;
  12. use Composer\Package\AliasPackage;
  13. use Composer\Package\PackageInterface;
  14. /**
  15. * @author Jordi Boggiano <j.boggiano@seld.be>
  16. */
  17. interface StreamableRepositoryInterface extends RepositoryInterface
  18. {
  19. /**
  20. * Return partial package data without loading them all to save on memory
  21. *
  22. * The function must return an array of package arrays.
  23. *
  24. * The package array must contain the following fields:
  25. * - name: package name (normalized/lowercased)
  26. * - repo: reference to the repository instance
  27. * - version: normalized version
  28. * - replace: array of package name => version constraint, optional
  29. * - provide: array of package name => version constraint, optional
  30. * - alias: pretty alias that this package should be aliased to, optional
  31. * - alias_normalized: normalized alias that this package should be aliased to, optional
  32. *
  33. * Any additional information can be returned and will be sent back
  34. * into loadPackage/loadAliasPackage for completing the package loading
  35. * when it's needed.
  36. *
  37. * @return array
  38. */
  39. public function getMinimalPackages();
  40. /**
  41. * Loads a package from minimal info of the package
  42. *
  43. * @param array $data the minimal info as was returned by getMinimalPackage
  44. * @return PackageInterface
  45. */
  46. public function loadPackage(array $data);
  47. /**
  48. * Loads an alias package from minimal info of the package
  49. *
  50. * @param array $data the minimal info as was returned by getMinimalPackage
  51. * @param PackageInterface $aliasOf the package which this alias is an alias of
  52. * @return AliasPackage
  53. */
  54. public function loadAliasPackage(array $data, PackageInterface $aliasOf);
  55. }