PackageInterface.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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\Package;
  12. use Composer\DependencyResolver\RelationConstraint\RelationConstraintInterface;
  13. /**
  14. * @author Nils Adermann <naderman@naderman.de>
  15. */
  16. interface PackageInterface
  17. {
  18. /**
  19. * Returns the package's name without version info, thus not a unique identifier
  20. *
  21. * @return string package name
  22. */
  23. function getName();
  24. /**
  25. * Returns a set of names that could refer to this package
  26. *
  27. * No version or release type information should be included in any of the
  28. * names. Provided or replaced package names need to be returned as well.
  29. *
  30. * @return array An array of strings refering to this package
  31. */
  32. function getNames();
  33. /**
  34. * Checks if the package matches the given constraint directly or through
  35. * provided or replaced packages
  36. *
  37. * @param string $name Name of the package to be matched
  38. * @param RelationConstraintInterface $constraint The constraint to verify
  39. * @return bool Whether this package matches the name and constraint
  40. */
  41. function matches($name, RelationConstraintInterface $constraint);
  42. /**
  43. * Returns the package type of this package, e.g. library
  44. *
  45. * @return string The package type
  46. */
  47. function getType();
  48. /**
  49. * Returns the repository type of this package, e.g. git, svn, tar
  50. *
  51. * @return string The repository type
  52. */
  53. function getRepositoryType();
  54. /**
  55. * Returns the repository url of this package, e.g. git://github.com/naderman/composer.git
  56. *
  57. * @return string The repository url
  58. */
  59. function getRepositoryUrl();
  60. /**
  61. * Returns the release type of this package, e.g. stable or beta
  62. *
  63. * @return string The release type
  64. */
  65. function getReleaseType();
  66. /**
  67. * Returns the version of this package
  68. *
  69. * @return string version
  70. */
  71. function getVersion();
  72. /**
  73. * Returns a set of relations to packages which need to be installed before
  74. * this package can be installed
  75. *
  76. * @return array An array of package relations defining required packages
  77. */
  78. function getRequires();
  79. /**
  80. * Returns a set of relations to packages which must not be installed at the
  81. * same time as this package
  82. *
  83. * @return array An array of package relations defining conflicting packages
  84. */
  85. function getConflicts();
  86. /**
  87. * Returns a set of relations to virtual packages that are provided through
  88. * this package
  89. *
  90. * @return array An array of package relations defining provided packages
  91. */
  92. function getProvides();
  93. /**
  94. * Returns a set of relations to packages which can alternatively be
  95. * satisfied by installing this package
  96. *
  97. * @return array An array of package relations defining replaced packages
  98. */
  99. function getReplaces();
  100. /**
  101. * Returns a set of relations to packages which are recommended in
  102. * combination with this package.
  103. *
  104. * @return array An array of package relations defining recommended packages
  105. */
  106. function getRecommends();
  107. /**
  108. * Returns a set of relations to packages which are suggested in combination
  109. * with this package.
  110. *
  111. * @return array An array of package relations defining suggested packages
  112. */
  113. function getSuggests();
  114. /**
  115. * Converts the package into a readable and unique string
  116. *
  117. * @return string
  118. */
  119. function __toString();
  120. }