RepositoryInterface.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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\PackageInterface;
  13. /**
  14. * Repository interface.
  15. *
  16. * @author Nils Adermann <naderman@naderman.de>
  17. * @author Konstantin Kudryashov <ever.zet@gmail.com>
  18. */
  19. interface RepositoryInterface extends \Countable
  20. {
  21. /**
  22. * Checks if specified package registered (installed).
  23. *
  24. * @param PackageInterface $package package instance
  25. *
  26. * @return Boolean
  27. */
  28. function hasPackage(PackageInterface $package);
  29. /**
  30. * Searches for the first match of a package by name and version.
  31. *
  32. * @param string $name package name
  33. * @param string $version package version
  34. *
  35. * @return PackageInterface|null
  36. */
  37. function findPackage($name, $version);
  38. /**
  39. * Searches for all packages matching a name and optionally a version.
  40. *
  41. * @param string $name package name
  42. * @param string $version package version
  43. *
  44. * @return array
  45. */
  46. function findPackages($name, $version = null);
  47. /**
  48. * Returns list of registered packages.
  49. *
  50. * @return array
  51. */
  52. function getPackages();
  53. /**
  54. * @abstract
  55. * @param \Composer\Package\PackageInterface $package
  56. * @return void
  57. */
  58. function removePackage(PackageInterface $package);
  59. }