CompletePackage.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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. /**
  13. * Package containing additional metadata that is not used by the solver
  14. *
  15. * @author Nils Adermann <naderman@naderman.de>
  16. */
  17. class CompletePackage extends Package implements CompletePackageInterface
  18. {
  19. protected $repositories;
  20. protected $license = array();
  21. protected $keywords;
  22. protected $authors;
  23. protected $description;
  24. protected $homepage;
  25. protected $scripts = array();
  26. protected $support = array();
  27. protected $abandoned = false;
  28. /**
  29. * @param array $scripts
  30. */
  31. public function setScripts(array $scripts)
  32. {
  33. $this->scripts = $scripts;
  34. }
  35. /**
  36. * {@inheritDoc}
  37. */
  38. public function getScripts()
  39. {
  40. return $this->scripts;
  41. }
  42. /**
  43. * Set the repositories
  44. *
  45. * @param array $repositories
  46. */
  47. public function setRepositories($repositories)
  48. {
  49. $this->repositories = $repositories;
  50. }
  51. /**
  52. * {@inheritDoc}
  53. */
  54. public function getRepositories()
  55. {
  56. return $this->repositories;
  57. }
  58. /**
  59. * Set the license
  60. *
  61. * @param array $license
  62. */
  63. public function setLicense(array $license)
  64. {
  65. $this->license = $license;
  66. }
  67. /**
  68. * {@inheritDoc}
  69. */
  70. public function getLicense()
  71. {
  72. return $this->license;
  73. }
  74. /**
  75. * Set the keywords
  76. *
  77. * @param array $keywords
  78. */
  79. public function setKeywords(array $keywords)
  80. {
  81. $this->keywords = $keywords;
  82. }
  83. /**
  84. * {@inheritDoc}
  85. */
  86. public function getKeywords()
  87. {
  88. return $this->keywords;
  89. }
  90. /**
  91. * Set the authors
  92. *
  93. * @param array $authors
  94. */
  95. public function setAuthors(array $authors)
  96. {
  97. $this->authors = $authors;
  98. }
  99. /**
  100. * {@inheritDoc}
  101. */
  102. public function getAuthors()
  103. {
  104. return $this->authors;
  105. }
  106. /**
  107. * Set the description
  108. *
  109. * @param string $description
  110. */
  111. public function setDescription($description)
  112. {
  113. $this->description = $description;
  114. }
  115. /**
  116. * {@inheritDoc}
  117. */
  118. public function getDescription()
  119. {
  120. return $this->description;
  121. }
  122. /**
  123. * Set the homepage
  124. *
  125. * @param string $homepage
  126. */
  127. public function setHomepage($homepage)
  128. {
  129. $this->homepage = $homepage;
  130. }
  131. /**
  132. * {@inheritDoc}
  133. */
  134. public function getHomepage()
  135. {
  136. return $this->homepage;
  137. }
  138. /**
  139. * Set the support information
  140. *
  141. * @param array $support
  142. */
  143. public function setSupport(array $support)
  144. {
  145. $this->support = $support;
  146. }
  147. /**
  148. * {@inheritDoc}
  149. */
  150. public function getSupport()
  151. {
  152. return $this->support;
  153. }
  154. /**
  155. * @return bool
  156. */
  157. public function isAbandoned()
  158. {
  159. return (bool) $this->abandoned;
  160. }
  161. /**
  162. * @param bool|string $abandoned
  163. */
  164. public function setAbandoned($abandoned)
  165. {
  166. $this->abandoned = $abandoned;
  167. }
  168. /**
  169. * If the package is abandoned and has a suggested replacement, this method returns it
  170. *
  171. * @return string|null
  172. */
  173. public function getReplacementPackage()
  174. {
  175. return is_string($this->abandoned) ? $this->abandoned : null;
  176. }
  177. }