Skip to content

Commit

Permalink
Issue #60: Rename event.
Browse files Browse the repository at this point in the history
  • Loading branch information
ademarco committed Oct 20, 2017
1 parent c93d4d8 commit 68183c5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
use Symfony\Component\EventDispatcher\Event;

/**
* Class SentNotificationResponseEvent
* Class SentResponseEvent
*
* @package EC\Poetry\Events\NotificationHandler
*/
class SentNotificationResponseEvent extends Event
class SentResponseEvent extends Event
{
const NAME = 'poetry.notification_handler.sent_notification_response';
const NAME = 'poetry.notification_handler.sent_response';

/**
* @var string
*/
private $message;

/**
* SentNotificationResponseEvent constructor.
* SentResponseEvent constructor.
*
* @param string $message
*/
Expand Down
6 changes: 3 additions & 3 deletions src/NotificationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace EC\Poetry;

use EC\Poetry\Events\NotificationHandler\ReceivedNotificationEvent;
use EC\Poetry\Events\NotificationHandler\SentNotificationResponseEvent;
use EC\Poetry\Events\NotificationHandler\SentResponseEvent;
use EC\Poetry\Events\ParseNotificationEvent;
use EC\Poetry\Exceptions\Notifications\CannotAuthenticateException;
use EC\Poetry\Exceptions\ParsingException;
Expand Down Expand Up @@ -87,8 +87,8 @@ public function handle($username, $password, $xml)
$response = $this->getErrorStatus($exception->getMessage(), $event->getMessage());
}
finally {
$event = new SentNotificationResponseEvent($response);
$this->eventDispatcher->dispatch(SentNotificationResponseEvent::NAME, $event);
$event = new SentResponseEvent($response);
$this->eventDispatcher->dispatch(SentResponseEvent::NAME, $event);

return $response;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Services/LoggerSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use EC\Poetry\Events\ExceptionEvent;
use EC\Poetry\Events\NotificationEventInterface;
use EC\Poetry\Events\NotificationHandler\ReceivedNotificationEvent;
use EC\Poetry\Events\NotificationHandler\SentNotificationResponseEvent;
use EC\Poetry\Events\NotificationHandler\SentResponseEvent;
use EC\Poetry\Events\Notifications\StatusUpdatedEvent;
use EC\Poetry\Events\Notifications\TranslationReceivedEvent;
use EC\Poetry\Events\ParseNotificationEvent;
Expand Down Expand Up @@ -65,7 +65,7 @@ public static function getSubscribedEvents()
ClientRequestEvent::NAME => 'onClientRequestEvent',
ClientResponseEvent::NAME => 'onClientResponseEvent',
ReceivedNotificationEvent::NAME => 'onReceivedNotificationEvent',
SentNotificationResponseEvent::NAME => 'onSentNotificationResponseEvent',
SentResponseEvent::NAME => 'onSentNotificationResponseEvent',
ExceptionEvent::NAME => 'onExceptionEvent',
];
}
Expand Down Expand Up @@ -120,11 +120,11 @@ public function onReceivedNotificationEvent(ReceivedNotificationEvent $event)
}

/**
* @param \EC\Poetry\Events\NotificationHandler\SentNotificationResponseEvent $event
* @param \EC\Poetry\Events\NotificationHandler\SentResponseEvent $event
*/
public function onSentNotificationResponseEvent(SentNotificationResponseEvent $event)
public function onSentNotificationResponseEvent(SentResponseEvent $event)
{
$this->logInfo(SentNotificationResponseEvent::NAME, ['message' => $event->getMessage()]);
$this->logInfo(SentResponseEvent::NAME, ['message' => $event->getMessage()]);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/src/NotificationHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ public function loggingCycleDataProvider()
'poetry.notification_handler.received_notification',
'poetry.notification.parse',
'poetry.notification.status_updated',
'poetry.notification_handler.sent_notification_response',
'poetry.notification_handler.sent_response',
],
],
[
LogLevel::INFO,
[
'poetry.notification_handler.received_notification',
'poetry.notification.status_updated',
'poetry.notification_handler.sent_notification_response',
'poetry.notification_handler.sent_response',
],
],
];
Expand Down

0 comments on commit 68183c5

Please sign in to comment.