InstallerInterface.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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\Installer;
  12. use Composer\Package\PackageInterface;
  13. use Composer\Repository\InstalledRepositoryInterface;
  14. use InvalidArgumentException;
  15. /**
  16. * Interface for the package installation manager.
  17. *
  18. * @author Konstantin Kudryashov <ever.zet@gmail.com>
  19. * @author Jordi Boggiano <j.boggiano@seld.be>
  20. */
  21. interface InstallerInterface
  22. {
  23. /**
  24. * Decides if the installer supports the given type
  25. *
  26. * @param string $packageType
  27. * @return bool
  28. */
  29. public function supports($packageType);
  30. /**
  31. * Checks that provided package is installed.
  32. *
  33. * @param InstalledRepositoryInterface $repo repository in which to check
  34. * @param PackageInterface $package package instance
  35. *
  36. * @return bool
  37. */
  38. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  39. /**
  40. * Installs specific package.
  41. *
  42. * @param InstalledRepositoryInterface $repo repository in which to check
  43. * @param PackageInterface $package package instance
  44. */
  45. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  46. /**
  47. * Updates specific package.
  48. *
  49. * @param InstalledRepositoryInterface $repo repository in which to check
  50. * @param PackageInterface $initial already installed package version
  51. * @param PackageInterface $target updated version
  52. *
  53. * @throws InvalidArgumentException if $initial package is not installed
  54. */
  55. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  56. /**
  57. * Uninstalls specific package.
  58. *
  59. * @param InstalledRepositoryInterface $repo repository in which to check
  60. * @param PackageInterface $package package instance
  61. */
  62. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  63. /**
  64. * Returns the installation path of a package
  65. *
  66. * @param PackageInterface $package
  67. * @return string path
  68. */
  69. public function getInstallPath(PackageInterface $package);
  70. }