VcsDriverInterface.php 2.5 KB

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