Skip to content

Commit

Permalink
Merge pull request #2439 from CachetHQ/cleanup-event-names
Browse files Browse the repository at this point in the history
Cleanup event names
  • Loading branch information
jbrooksuk committed Mar 18, 2017
2 parents 1529720 + c1bd3e4 commit 9bd1e3e
Show file tree
Hide file tree
Showing 51 changed files with 235 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@

namespace CachetHQ\Cachet\Bus\Commands\Component;

final class AddComponentCommand
/**
* This is the create component command class.
*
* @author James Brooks <[email protected]>
*/
final class CreateComponentCommand
{
/**
* The component name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
namespace CachetHQ\Cachet\Bus\Commands\ComponentGroup;

/**
* This is the add component group command.
* This is the create component group command.
*
* @author James Brooks <[email protected]>
*/
final class AddComponentGroupCommand
final class CreateComponentGroupCommand
{
/**
* The component group name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
namespace CachetHQ\Cachet\Bus\Commands\Incident;

/**
* This is the report incident command.
* This is the create incident command.
*
* @author Joseph Cohen <[email protected]>
* @author James Brooks <[email protected]>
*/
final class ReportIncidentCommand
final class CreateIncidentCommand
{
/**
* The incident name.
Expand Down Expand Up @@ -115,7 +115,7 @@ final class ReportIncidentCommand
];

/**
* Create a new report incident command instance.
* Create a new create incident command instance.
*
* @param string $name
* @param int $status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @author James Brooks <[email protected]>
*/
final class ReportIncidentUpdateCommand
final class CreateIncidentUpdateCommand
{
/**
* The incident.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@

namespace CachetHQ\Cachet\Bus\Commands\Metric;

final class AddMetricCommand
/**
* This is the create metric command class.
*
* @author Joseph Cohen <[email protected]>
* @author James Brooks <[email protected]>
*/
final class CreateMetricCommand
{
/**
* The metric name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@

use CachetHQ\Cachet\Models\Metric;

final class AddMetricPointCommand
/**
* This is the create metric point command class.
*
* @author Joseph Cohen <[email protected]>
* @author James Brooks <[email protected]>
*/
final class CreateMetricPointCommand
{
/**
* The metric to add.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
namespace CachetHQ\Cachet\Bus\Commands\User;

/**
* This is the add user command.
* This is the create user command.
*
* @author James Brooks <[email protected]>
*/
final class AddUserCommand
final class CreateUserCommand
{
/**
* The user username.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
use CachetHQ\Cachet\Models\User;

/**
* This is the component status was updated event.
* This is the component status was changed event.
*
* @author James Brooks <[email protected]>
*/
final class ComponentStatusWasUpdatedEvent implements ActionInterface, ComponentEventInterface
final class ComponentStatusWasChangedEvent implements ActionInterface, ComponentEventInterface
{
/**
* The user who updated the component.
* The user who changed the component.
*
* @var \CachetHQ\Cachet\Models\User
*/
public $user;

/**
* The component that was updated.
* The component that was changed.
*
* @var \CachetHQ\Cachet\Models\Component
*/
Expand Down Expand Up @@ -84,7 +84,7 @@ public function __construct(User $user, Component $component, $original_status,
*/
public function __toString()
{
return 'Component status was updated.';
return 'Component status was changed.';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\User;

final class ComponentWasAddedEvent implements ActionInterface, ComponentEventInterface
/**
* This is the component was created event class.
*
* @author James Brooks <[email protected]>
*/
final class ComponentWasCreatedEvent implements ActionInterface, ComponentEventInterface
{
/**
* The user who added the component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
use CachetHQ\Cachet\Models\ComponentGroup;
use CachetHQ\Cachet\Models\User;

final class ComponentGroupWasAddedEvent implements ActionInterface, ComponentGroupEventInterface
/**
* This is the component group was created event class.
*
* @author James Brooks <[email protected]>
*/
final class ComponentGroupWasCreatedEvent implements ActionInterface, ComponentGroupEventInterface
{
/**
* The user who added the component group.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\User;

final class IncidentWasReportedEvent implements ActionInterface, IncidentEventInterface
final class IncidentWasCreatedEvent implements ActionInterface, IncidentEventInterface
{
/**
* The user who reported the event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
use CachetHQ\Cachet\Models\MetricPoint;
use CachetHQ\Cachet\Models\User;

final class MetricPointWasAddedEvent implements ActionInterface, MetricEventInterface
/**
* This is the metric point was created event class.
*
* @author James Brooks <[email protected]>
*/
final class MetricPointWasCreatedEvent implements ActionInterface, MetricEventInterface
{
/**
* The user who added the metric point.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Cachet\Models\User;

final class MetricWasAddedEvent implements ActionInterface, MetricEventInterface
/**
* This is the metric was created event class.
*
* @author James Brooks <[email protected]>
*/
final class MetricWasCreatedEvent implements ActionInterface, MetricEventInterface
{
/**
* The user who added the metric.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\User;

final class UserWasAddedEvent implements ActionInterface, UserEventInterface
/**
* This is the user was created event class.
*
* @author James Brooks <[email protected]>
*/
final class UserWasCreatedEvent implements ActionInterface, UserEventInterface
{
/**
* The user that has been added.
Expand Down Expand Up @@ -42,7 +47,7 @@ public function __construct(User $user)
*/
public function __toString()
{
return 'User was added.';
return 'User was created.';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Bus/Events/User/UserWasInvitedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
final class UserWasInvitedEvent implements UserEventInterface
{
/**
* The invite that has been added.
* The invite that has been created.
*
* @var \CachetHQ\Cachet\Models\Invite
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@

namespace CachetHQ\Cachet\Bus\Handlers\Commands\Component;

use CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand;
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasAddedEvent;
use CachetHQ\Cachet\Bus\Commands\Component\CreateComponentCommand;
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasCreatedEvent;
use CachetHQ\Cachet\Models\Component;
use Illuminate\Contracts\Auth\Guard;

class AddComponentCommandHandler
/**
* This is the add component command handler class.
*
* @author James Brooks <[email protected]>
*/
class CreateComponentCommandHandler
{
/**
* The authentication guard instance.
Expand All @@ -40,27 +45,27 @@ public function __construct(Guard $auth)
/**
* Handle the add component command.
*
* @param \CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand $command
* @param \CachetHQ\Cachet\Bus\Commands\Component\CreateComponentCommand $command
*
* @return \CachetHQ\Cachet\Models\Component
*/
public function handle(AddComponentCommand $command)
public function handle(CreateComponentCommand $command)
{
$component = Component::create($this->filter($command));

event(new ComponentWasAddedEvent($this->auth->user(), $component));
event(new ComponentWasCreatedEvent($this->auth->user(), $component));

return $component;
}

/**
* Filter the command data.
*
* @param \CachetHQ\Cachet\Bus\Commands\Incident\AddComponentCommand $command
* @param \CachetHQ\Cachet\Bus\Commands\Incident\CreateComponentCommand $command
*
* @return array
*/
protected function filter(AddComponentCommand $command)
protected function filter(CreateComponentCommand $command)
{
$params = [
'name' => $command->name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Component;

use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand;
use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasUpdatedEvent;
use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasChangedEvent;
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasUpdatedEvent;
use CachetHQ\Cachet\Models\Component;
use Illuminate\Contracts\Auth\Guard;
Expand Down Expand Up @@ -50,7 +50,7 @@ public function handle(UpdateComponentCommand $command)
$component = $command->component;
$originalStatus = $component->status;

event(new ComponentStatusWasUpdatedEvent($this->auth->user(), $component, $originalStatus, $command->status, $command->silent));
event(new ComponentStatusWasChangedEvent($this->auth->user(), $component, $originalStatus, $command->status, $command->silent));

$component->update($this->filter($command));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

namespace CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup;

use CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand;
use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasAddedEvent;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\CreateComponentGroupCommand;
use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasCreatedEvent;
use CachetHQ\Cachet\Models\ComponentGroup;
use Illuminate\Contracts\Auth\Guard;

class AddComponentGroupCommandHandler
class CreateComponentGroupCommandHandler
{
/**
* The authentication guard instance.
Expand All @@ -26,7 +26,7 @@ class AddComponentGroupCommandHandler
protected $auth;

/**
* Create a new add component group command handler instance.
* Create a new create component group command handler instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
*
Expand All @@ -38,13 +38,13 @@ public function __construct(Guard $auth)
}

/**
* Handle the add component group command.
* Handle the create component group command.
*
* @param \CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand $command
* @param \CachetHQ\Cachet\Bus\Commands\ComponentGroup\CreateComponentGroupCommand $command
*
* @return \CachetHQ\Cachet\Models\ComponentGroup
*/
public function handle(AddComponentGroupCommand $command)
public function handle(CreateComponentGroupCommand $command)
{
$group = ComponentGroup::create([
'name' => $command->name,
Expand All @@ -53,7 +53,7 @@ public function handle(AddComponentGroupCommand $command)
'visible' => $command->visible,
]);

event(new ComponentGroupWasAddedEvent($this->auth->user(), $group));
event(new ComponentGroupWasCreatedEvent($this->auth->user(), $group));

return $group;
}
Expand Down
Loading

0 comments on commit 9bd1e3e

Please sign in to comment.