Event.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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\Script;
  12. use Composer\Composer;
  13. use Composer\IO\IOInterface;
  14. /**
  15. * The script event class
  16. *
  17. * @author François Pluchino <francois.pluchino@opendisplay.com>
  18. * @author Nils Adermann <naderman@naderman.de>
  19. */
  20. class Event extends \Composer\EventDispatcher\Event
  21. {
  22. /**
  23. * @var Composer The composer instance
  24. */
  25. private $composer;
  26. /**
  27. * @var IOInterface The IO instance
  28. */
  29. private $io;
  30. /**
  31. * @var boolean Dev mode flag
  32. */
  33. private $devMode;
  34. /**
  35. * Constructor.
  36. *
  37. * @param string $name The event name
  38. * @param Composer $composer The composer object
  39. * @param IOInterface $io The IOInterface object
  40. * @param boolean $devMode Whether or not we are in dev mode
  41. */
  42. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false)
  43. {
  44. parent::__construct($name);
  45. $this->composer = $composer;
  46. $this->io = $io;
  47. $this->devMode = $devMode;
  48. }
  49. /**
  50. * Returns the composer instance.
  51. *
  52. * @return Composer
  53. */
  54. public function getComposer()
  55. {
  56. return $this->composer;
  57. }
  58. /**
  59. * Returns the IO instance.
  60. *
  61. * @return IOInterface
  62. */
  63. public function getIO()
  64. {
  65. return $this->io;
  66. }
  67. /**
  68. * Return the dev mode flag
  69. *
  70. * @return boolean
  71. */
  72. public function isDevMode()
  73. {
  74. return $this->devMode;
  75. }
  76. }