Capable.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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\Plugin;
  12. /**
  13. * Plugins which need to expose various implementations
  14. * of the Composer Plugin Capabilities must have their
  15. * declared Plugin class implementing this interface.
  16. *
  17. * @api
  18. */
  19. interface Capable
  20. {
  21. /**
  22. * Method by which a Plugin announces its API implementations, through an array
  23. * with a special structure.
  24. *
  25. * The key must be a string, representing a fully qualified class/interface name
  26. * which Composer Plugin API exposes - named "API class".
  27. * The value must be a string as well, representing the fully qualified class name
  28. * of the API class - named "SPI class".
  29. *
  30. * Every SPI must implement their API class.
  31. *
  32. * Every SPI will be passed a single array parameter via their constructor.
  33. *
  34. * Example:
  35. * // API as key, SPI as value
  36. * return array(
  37. * 'Composer\Plugin\Capability\CommandProvider' => 'My\CommandProvider',
  38. * 'Composer\Plugin\Capability\Validator' => 'My\Validator',
  39. * );
  40. *
  41. * @return string[]
  42. */
  43. public function getCapabilities();
  44. }