CompletePackage.php 3.9 KB

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