PreFileDownloadEvent.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. use Composer\Composer;
  13. use Composer\IO\IOInterface;
  14. use Composer\EventDispatcher\Event;
  15. use Composer\Util\RemoteFilesystem;
  16. /**
  17. * The pre file download event.
  18. *
  19. * @author Nils Adermann <naderman@naderman.de>
  20. */
  21. class PreFileDownloadEvent extends Event
  22. {
  23. /**
  24. * @var RemoteFilesystem
  25. */
  26. private $rfs;
  27. /**
  28. * @var string
  29. */
  30. private $processedUrl;
  31. /**
  32. * Constructor.
  33. *
  34. * @param string $name The event name
  35. * @param Composer $composer The composer object
  36. * @param IOInterface $io The IOInterface object
  37. * @param boolean $devMode Whether or not we are in dev mode
  38. * @param OperationInterface $operation The operation object
  39. */
  40. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  41. {
  42. parent::__construct($name);
  43. $this->rfs = $rfs;
  44. $this->processedUrl = $processedUrl;
  45. }
  46. /**
  47. * Returns the remote filesystem
  48. *
  49. * @return OperationInterface
  50. */
  51. public function getRemoteFilesystem()
  52. {
  53. return $this->rfs;
  54. }
  55. /**
  56. * Sets the remote filesystem
  57. */
  58. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  59. {
  60. $this->rfs = $rfs;
  61. }
  62. /**
  63. * Retrieves the processed URL this remote filesystem will be used for
  64. *
  65. * @return string
  66. */
  67. public function getProcessedUrl()
  68. {
  69. return $this->processedUrl;
  70. }
  71. }