VcsDriverInterface.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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\Vcs;
  12. use Composer\Config;
  13. use Composer\IO\IOInterface;
  14. /**
  15. * @author Jordi Boggiano <j.boggiano@seld.be>
  16. */
  17. interface VcsDriverInterface
  18. {
  19. /**
  20. * Initializes the driver (git clone, svn checkout, fetch info etc)
  21. */
  22. public function initialize();
  23. /**
  24. * Return the composer.json file information
  25. *
  26. * @param string $identifier Any identifier to a specific branch/tag/commit
  27. * @return array containing all infos from the composer.json file
  28. */
  29. public function getComposerInformation($identifier);
  30. /**
  31. * Return the root identifier (trunk, master, default/tip ..)
  32. *
  33. * @return string Identifier
  34. */
  35. public function getRootIdentifier();
  36. /**
  37. * Return list of branches in the repository
  38. *
  39. * @return array Branch names as keys, identifiers as values
  40. */
  41. public function getBranches();
  42. /**
  43. * Return list of tags in the repository
  44. *
  45. * @return array Tag names as keys, identifiers as values
  46. */
  47. public function getTags();
  48. /**
  49. * @param string $identifier Any identifier to a specific branch/tag/commit
  50. * @return array With type, url reference and shasum keys.
  51. */
  52. public function getDist($identifier);
  53. /**
  54. * @param string $identifier Any identifier to a specific branch/tag/commit
  55. * @return array With type, url and reference keys.
  56. */
  57. public function getSource($identifier);
  58. /**
  59. * Return the URL of the repository
  60. *
  61. * @return string
  62. */
  63. public function getUrl();
  64. /**
  65. * Return true if the repository has a composer file for a given identifier,
  66. * false otherwise.
  67. *
  68. * @param string $identifier Any identifier to a specific branch/tag/commit
  69. * @return boolean Whether the repository has a composer file for a given identifier.
  70. */
  71. public function hasComposerFile($identifier);
  72. /**
  73. * Performs any cleanup necessary as the driver is not longer needed
  74. *
  75. */
  76. public function cleanup();
  77. /**
  78. * Checks if this driver can handle a given url
  79. *
  80. * @param IOInterface $io IO instance
  81. * @param Config $config current $config
  82. * @param string $url URL to validate/check
  83. * @param bool $deep unless true, only shallow checks (url matching typically) should be done
  84. * @return bool
  85. */
  86. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  87. }