From c7b898d10d8e4eba88a83f021ea0f4138f29ec84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pluchino?= Date: Wed, 25 Jan 2012 17:31:46 +0100 Subject: [PATCH] Remove TriggerEvent setter and adding arguments to the constructor --- src/Composer/Trigger/TriggerDispatcher.php | 6 +-- src/Composer/Trigger/TriggerEvent.php | 44 +++++++--------------- 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/src/Composer/Trigger/TriggerDispatcher.php b/src/Composer/Trigger/TriggerDispatcher.php index a321bb5d4..e63410da5 100644 --- a/src/Composer/Trigger/TriggerDispatcher.php +++ b/src/Composer/Trigger/TriggerDispatcher.php @@ -56,11 +56,7 @@ class TriggerDispatcher */ public function dispatch($eventName) { - $event = new TriggerEvent(); - - $event->setName($eventName); - $event->setComposer($this->composer); - $event->setIO($this->io); + $event = new TriggerEvent($eventName, $this->composer, $this->io); $this->doDispatch($event); } diff --git a/src/Composer/Trigger/TriggerEvent.php b/src/Composer/Trigger/TriggerEvent.php index 1b1a968bb..dce3fa549 100644 --- a/src/Composer/Trigger/TriggerEvent.php +++ b/src/Composer/Trigger/TriggerEvent.php @@ -37,6 +37,20 @@ class TriggerEvent */ private $io; + /** + * Constructor. + * + * @param string $name The event name + * @param Composer $composer The composer objet + * @param IOInterface $io The IOInterface object + */ + public function __construct($name, Composer $composer, IOInterface $io) + { + $this->name = $name; + $this->composer = $composer; + $this->io = $io; + } + /** * Returns the event's name. * @@ -47,16 +61,6 @@ class TriggerEvent return $this->name; } - /** - * Stores the event's name. - * - * @param string $name The event name - */ - public function setName($name) - { - $this->name = $name; - } - /** * Returns the composer instance. * @@ -67,16 +71,6 @@ class TriggerEvent return $this->composer; } - /** - * Stores the composer instance. - * - * @param Composer $composer - */ - public function setComposer(Composer $composer) - { - $this->composer = $composer; - } - /** * Returns the IO instance. * @@ -86,14 +80,4 @@ class TriggerEvent { return $this->io; } - - /** - * Stores the IO instance. - * - * @param IOInterface $io - */ - public function setIO(IOInterface $io) - { - $this->io = $io; - } }