Event.php 2.0 KB

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