Rename Bus Add to Create

This commit is contained in:
James Brooks
2017-03-18 09:30:36 +00:00
parent 7d27c61abe
commit a55575656d
34 changed files with 163 additions and 116 deletions

View File

@@ -11,7 +11,12 @@
namespace CachetHQ\Cachet\Bus\Commands\Component; namespace CachetHQ\Cachet\Bus\Commands\Component;
final class AddComponentCommand /**
* This is the create component command class.
*
* @author James Brooks <james@alt-three.com>
*/
final class CreateComponentCommand
{ {
/** /**
* The component name. * The component name.

View File

@@ -12,11 +12,11 @@
namespace CachetHQ\Cachet\Bus\Commands\ComponentGroup; namespace CachetHQ\Cachet\Bus\Commands\ComponentGroup;
/** /**
* This is the add component group command. * This is the create component group command.
* *
* @author James Brooks <james@alt-three.com> * @author James Brooks <james@alt-three.com>
*/ */
final class AddComponentGroupCommand final class CreateComponentGroupCommand
{ {
/** /**
* The component group name. * The component group name.

View File

@@ -11,7 +11,13 @@
namespace CachetHQ\Cachet\Bus\Commands\Metric; namespace CachetHQ\Cachet\Bus\Commands\Metric;
final class AddMetricCommand /**
* This is the create metric command class.
*
* @author Joseph Cohen <joe@alt-three.com>
* @author James Brooks <james@alt-three.com>
*/
final class CreateMetricCommand
{ {
/** /**
* The metric name. * The metric name.

View File

@@ -13,7 +13,13 @@ namespace CachetHQ\Cachet\Bus\Commands\Metric;
use CachetHQ\Cachet\Models\Metric; use CachetHQ\Cachet\Models\Metric;
final class AddMetricPointCommand /**
* This is the create metric point command class.
*
* @author Joseph Cohen <joe@alt-three.com>
* @author James Brooks <james@alt-three.com>
*/
final class CreateMetricPointCommand
{ {
/** /**
* The metric to add. * The metric to add.

View File

@@ -12,11 +12,11 @@
namespace CachetHQ\Cachet\Bus\Commands\User; namespace CachetHQ\Cachet\Bus\Commands\User;
/** /**
* This is the add user command. * This is the create user command.
* *
* @author James Brooks <james@alt-three.com> * @author James Brooks <james@alt-three.com>
*/ */
final class AddUserCommand final class CreateUserCommand
{ {
/** /**
* The user username. * The user username.

View File

@@ -15,7 +15,12 @@ use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
final class ComponentWasAddedEvent implements ActionInterface, ComponentEventInterface /**
* This is the component was created event class.
*
* @author James Brooks <james@alt-three.com>
*/
final class ComponentWasCreatedEvent implements ActionInterface, ComponentEventInterface
{ {
/** /**
* The user who added the component. * The user who added the component.

View File

@@ -15,7 +15,12 @@ use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\ComponentGroup; use CachetHQ\Cachet\Models\ComponentGroup;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
final class ComponentGroupWasAddedEvent implements ActionInterface, ComponentGroupEventInterface /**
* This is the component group was created event class.
*
* @author James Brooks <james@alt-three.com>
*/
final class ComponentGroupWasCreatedEvent implements ActionInterface, ComponentGroupEventInterface
{ {
/** /**
* The user who added the component group. * The user who added the component group.

View File

@@ -15,7 +15,12 @@ use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\MetricPoint; use CachetHQ\Cachet\Models\MetricPoint;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
final class MetricPointWasAddedEvent implements ActionInterface, MetricEventInterface /**
* This is the metric point was created event class.
*
* @author James Brooks <james@alt-three.com>
*/
final class MetricPointWasCreatedEvent implements ActionInterface, MetricEventInterface
{ {
/** /**
* The user who added the metric point. * The user who added the metric point.

View File

@@ -15,7 +15,12 @@ use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\Metric; use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
final class MetricWasAddedEvent implements ActionInterface, MetricEventInterface /**
* This is the metric was created event class.
*
* @author James Brooks <james@alt-three.com>
*/
final class MetricWasCreatedEvent implements ActionInterface, MetricEventInterface
{ {
/** /**
* The user who added the metric. * The user who added the metric.

View File

@@ -14,7 +14,12 @@ namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
final class UserWasAddedEvent implements ActionInterface, UserEventInterface /**
* This is the user was created event class.
*
* @author James Brooks <james@alt-three.com>
*/
final class UserWasCreatedEvent implements ActionInterface, UserEventInterface
{ {
/** /**
* The user that has been added. * The user that has been added.

View File

@@ -11,12 +11,17 @@
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Component; namespace CachetHQ\Cachet\Bus\Handlers\Commands\Component;
use CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand; use CachetHQ\Cachet\Bus\Commands\Component\CreateComponentCommand;
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasAddedEvent; use CachetHQ\Cachet\Bus\Events\Component\ComponentWasCreatedEvent;
use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\Component;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
class AddComponentCommandHandler /**
* This is the add component command handler class.
*
* @author James Brooks <james@alt-three.com>
*/
class CreateComponentCommandHandler
{ {
/** /**
* The authentication guard instance. * The authentication guard instance.
@@ -40,15 +45,15 @@ class AddComponentCommandHandler
/** /**
* Handle the add component command. * 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 * @return \CachetHQ\Cachet\Models\Component
*/ */
public function handle(AddComponentCommand $command) public function handle(CreateComponentCommand $command)
{ {
$component = Component::create($this->filter($command)); $component = Component::create($this->filter($command));
event(new ComponentWasAddedEvent($this->auth->user(), $component)); event(new ComponentWasCreatedEvent($this->auth->user(), $component));
return $component; return $component;
} }
@@ -56,11 +61,11 @@ class AddComponentCommandHandler
/** /**
* Filter the command data. * Filter the command data.
* *
* @param \CachetHQ\Cachet\Bus\Commands\Incident\AddComponentCommand $command * @param \CachetHQ\Cachet\Bus\Commands\Incident\CreateComponentCommand $command
* *
* @return array * @return array
*/ */
protected function filter(AddComponentCommand $command) protected function filter(CreateComponentCommand $command)
{ {
$params = [ $params = [
'name' => $command->name, 'name' => $command->name,

View File

@@ -11,12 +11,12 @@
namespace CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup; namespace CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand; use CachetHQ\Cachet\Bus\Commands\ComponentGroup\CreateComponentGroupCommand;
use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasAddedEvent; use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasCreatedEvent;
use CachetHQ\Cachet\Models\ComponentGroup; use CachetHQ\Cachet\Models\ComponentGroup;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
class AddComponentGroupCommandHandler class CreateComponentGroupCommandHandler
{ {
/** /**
* The authentication guard instance. * The authentication guard instance.
@@ -26,7 +26,7 @@ class AddComponentGroupCommandHandler
protected $auth; 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 * @param \Illuminate\Contracts\Auth\Guard $auth
* *
@@ -38,13 +38,13 @@ class AddComponentGroupCommandHandler
} }
/** /**
* 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 * @return \CachetHQ\Cachet\Models\ComponentGroup
*/ */
public function handle(AddComponentGroupCommand $command) public function handle(CreateComponentGroupCommand $command)
{ {
$group = ComponentGroup::create([ $group = ComponentGroup::create([
'name' => $command->name, 'name' => $command->name,
@@ -53,7 +53,7 @@ class AddComponentGroupCommandHandler
'visible' => $command->visible, 'visible' => $command->visible,
]); ]);
event(new ComponentGroupWasAddedEvent($this->auth->user(), $group)); event(new ComponentGroupWasCreatedEvent($this->auth->user(), $group));
return $group; return $group;
} }

View File

@@ -11,12 +11,12 @@
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Metric; namespace CachetHQ\Cachet\Bus\Handlers\Commands\Metric;
use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricCommand; use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricCommand;
use CachetHQ\Cachet\Bus\Events\Metric\MetricWasAddedEvent; use CachetHQ\Cachet\Bus\Events\Metric\MetricWasCreatedEvent;
use CachetHQ\Cachet\Models\Metric; use CachetHQ\Cachet\Models\Metric;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
class AddMetricCommandHandler class CreateMetricCommandHandler
{ {
/** /**
* The authentication guard instance. * The authentication guard instance.
@@ -40,11 +40,11 @@ class AddMetricCommandHandler
/** /**
* Handle the add metric command. * Handle the add metric command.
* *
* @param \CachetHQ\Cachet\Bus\Commands\Metric\AddMetricCommand $command * @param \CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricCommand $command
* *
* @return \CachetHQ\Cachet\Models\Metric * @return \CachetHQ\Cachet\Models\Metric
*/ */
public function handle(AddMetricCommand $command) public function handle(CreateMetricCommand $command)
{ {
$metric = Metric::create([ $metric = Metric::create([
'name' => $command->name, 'name' => $command->name,
@@ -60,7 +60,7 @@ class AddMetricCommandHandler
'visible' => $command->visible, 'visible' => $command->visible,
]); ]);
event(new MetricWasAddedEvent($this->auth->user(), $metric)); event(new MetricWasCreatedEvent($this->auth->user(), $metric));
return $metric; return $metric;
} }

View File

@@ -11,14 +11,14 @@
namespace CachetHQ\Cachet\Bus\Handlers\Commands\Metric; namespace CachetHQ\Cachet\Bus\Handlers\Commands\Metric;
use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricPointCommand; use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricPointCommand;
use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasAddedEvent; use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasCreatedEvent;
use CachetHQ\Cachet\Models\MetricPoint; use CachetHQ\Cachet\Models\MetricPoint;
use CachetHQ\Cachet\Services\Dates\DateFactory; use CachetHQ\Cachet\Services\Dates\DateFactory;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
class AddMetricPointCommandHandler class CreateMetricPointCommandHandler
{ {
/** /**
* The authentication guard instance. * The authentication guard instance.
@@ -51,11 +51,11 @@ class AddMetricPointCommandHandler
/** /**
* Handle the add metric point command. * Handle the add metric point command.
* *
* @param \CachetHQ\Cachet\Bus\Commands\Metric\AddMetricPointCommand $command * @param \CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricPointCommand $command
* *
* @return \CachetHQ\Cachet\Models\MetricPoint * @return \CachetHQ\Cachet\Models\MetricPoint
*/ */
public function handle(AddMetricPointCommand $command) public function handle(CreateMetricPointCommand $command)
{ {
$metric = $command->metric; $metric = $command->metric;
$createdAt = $command->created_at; $createdAt = $command->created_at;
@@ -65,7 +65,7 @@ class AddMetricPointCommandHandler
$point->increment('counter', 1); $point->increment('counter', 1);
event(new MetricPointWasAddedEvent($this->auth->user(), $point)); event(new MetricPointWasCreatedEvent($this->auth->user(), $point));
return $point; return $point;
} }
@@ -73,11 +73,11 @@ class AddMetricPointCommandHandler
/** /**
* Find or create a metric point. * Find or create a metric point.
* *
* @param \CachetHQ\Cachet\Bus\Commands\Metric\AddMetricPointCommand $command * @param \CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricPointCommand $command
* *
* @return \CachetHQ\Cachet\Models\MetricPoint * @return \CachetHQ\Cachet\Models\MetricPoint
*/ */
protected function findOrCreatePoint(AddMetricPointCommand $command) protected function findOrCreatePoint(CreateMetricPointCommand $command)
{ {
$buffer = Carbon::now()->subMinutes($command->metric->threshold); $buffer = Carbon::now()->subMinutes($command->metric->threshold);

View File

@@ -11,25 +11,25 @@
namespace CachetHQ\Cachet\Bus\Handlers\Commands\User; namespace CachetHQ\Cachet\Bus\Handlers\Commands\User;
use CachetHQ\Cachet\Bus\Commands\User\AddUserCommand; use CachetHQ\Cachet\Bus\Commands\User\CreateUserCommand;
use CachetHQ\Cachet\Bus\Events\User\UserWasAddedEvent; use CachetHQ\Cachet\Bus\Events\User\UserWasCreatedEvent;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
/** /**
* This is the add user command handler. * This is the create user command handler.
* *
* @author James Brooks <james@alt-three.com> * @author James Brooks <james@alt-three.com>
*/ */
class AddUserCommandHandler class CreateUserCommandHandler
{ {
/** /**
* Handle the add user command. * Handle the add user command.
* *
* @param \CachetHQ\Cachet\Bus\Commands\User\AddUserCommand $command * @param \CachetHQ\Cachet\Bus\Commands\User\CreateUserCommand $command
* *
* @return \CachetHQ\Cachet\Models\User * @return \CachetHQ\Cachet\Models\User
*/ */
public function handle(AddUserCommand $command) public function handle(CreateUserCommand $command)
{ {
$user = User::create([ $user = User::create([
'username' => $command->username, 'username' => $command->username,
@@ -38,7 +38,7 @@ class AddUserCommandHandler
'level' => $command->level, 'level' => $command->level,
]); ]);
event(new UserWasAddedEvent($user)); event(new UserWasCreatedEvent($user));
return $user; return $user;
} }

View File

@@ -12,7 +12,7 @@
namespace CachetHQ\Cachet\Bus\Handlers\Commands\User; namespace CachetHQ\Cachet\Bus\Handlers\Commands\User;
use CachetHQ\Cachet\Bus\Commands\User\SignupUserCommand; use CachetHQ\Cachet\Bus\Commands\User\SignupUserCommand;
use CachetHQ\Cachet\Bus\Events\User\UserWasAddedEvent; use CachetHQ\Cachet\Bus\Events\User\UserWasCreatedEvent;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
class SignupUserCommandHandler class SignupUserCommandHandler
@@ -33,7 +33,7 @@ class SignupUserCommandHandler
'level' => User::LEVEL_USER, 'level' => User::LEVEL_USER,
]); ]);
event(new UserWasAddedEvent($user)); event(new UserWasCreatedEvent($user));
return $user; return $user;
} }

View File

@@ -30,7 +30,7 @@ class EventServiceProvider extends ServiceProvider
'CachetHQ\Cachet\Bus\Events\Beacon\BeaconWasSentEvent' => [ 'CachetHQ\Cachet\Bus\Events\Beacon\BeaconWasSentEvent' => [
// //
], ],
'CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasAddedEvent' => [ 'CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasCreatedEvent' => [
// //
], ],
'CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasRemovedEvent' => [ 'CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasRemovedEvent' => [
@@ -42,7 +42,7 @@ class EventServiceProvider extends ServiceProvider
'CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasChangedEvent' => [ 'CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasChangedEvent' => [
'CachetHQ\Cachet\Bus\Handlers\Events\Component\SendComponentUpdateEmailNotificationHandler', 'CachetHQ\Cachet\Bus\Handlers\Events\Component\SendComponentUpdateEmailNotificationHandler',
], ],
'CachetHQ\Cachet\Bus\Events\Component\ComponentWasAddedEvent' => [ 'CachetHQ\Cachet\Bus\Events\Component\ComponentWasCreatedEvent' => [
// //
], ],
'CachetHQ\Cachet\Bus\Events\Component\ComponentWasRemovedEvent' => [ 'CachetHQ\Cachet\Bus\Events\Component\ComponentWasRemovedEvent' => [
@@ -75,7 +75,7 @@ class EventServiceProvider extends ServiceProvider
'CachetHQ\Cachet\Bus\Events\Invite\InviteWasClaimedEvent' => [ 'CachetHQ\Cachet\Bus\Events\Invite\InviteWasClaimedEvent' => [
// //
], ],
'CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasAddedEvent' => [ 'CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasCreatedEvent' => [
// //
], ],
'CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasRemovedEvent' => [ 'CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasRemovedEvent' => [
@@ -84,7 +84,7 @@ class EventServiceProvider extends ServiceProvider
'CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasUpdatedEvent' => [ 'CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasUpdatedEvent' => [
// //
], ],
'CachetHQ\Cachet\Bus\Events\Metric\MetricWasAddedEvent' => [ 'CachetHQ\Cachet\Bus\Events\Metric\MetricWasCreatedEvent' => [
// //
], ],
'CachetHQ\Cachet\Bus\Events\Metric\MetricWasRemovedEvent' => [ 'CachetHQ\Cachet\Bus\Events\Metric\MetricWasRemovedEvent' => [
@@ -150,7 +150,7 @@ class EventServiceProvider extends ServiceProvider
'CachetHQ\Cachet\Bus\Events\User\UserRegeneratedApiTokenEvent' => [ 'CachetHQ\Cachet\Bus\Events\User\UserRegeneratedApiTokenEvent' => [
// //
], ],
'CachetHQ\Cachet\Bus\Events\User\UserWasAddedEvent' => [ 'CachetHQ\Cachet\Bus\Events\User\UserWasCreatedEvent' => [
// //
], ],
'CachetHQ\Cachet\Bus\Events\User\UserWasInvitedEvent' => [ 'CachetHQ\Cachet\Bus\Events\User\UserWasInvitedEvent' => [

View File

@@ -11,7 +11,7 @@
namespace CachetHQ\Cachet\Http\Controllers\Api; namespace CachetHQ\Cachet\Http\Controllers\Api;
use CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand; use CachetHQ\Cachet\Bus\Commands\Component\CreateComponentCommand;
use CachetHQ\Cachet\Bus\Commands\Component\RemoveComponentCommand; use CachetHQ\Cachet\Bus\Commands\Component\RemoveComponentCommand;
use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand; use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand;
use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\Component;
@@ -70,7 +70,7 @@ class ComponentController extends AbstractApiController
public function postComponents() public function postComponents()
{ {
try { try {
$component = dispatch(new AddComponentCommand( $component = dispatch(new CreateComponentCommand(
Binput::get('name'), Binput::get('name'),
Binput::get('description'), Binput::get('description'),
Binput::get('status'), Binput::get('status'),

View File

@@ -11,7 +11,7 @@
namespace CachetHQ\Cachet\Http\Controllers\Api; namespace CachetHQ\Cachet\Http\Controllers\Api;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand; use CachetHQ\Cachet\Bus\Commands\ComponentGroup\CreateComponentGroupCommand;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\RemoveComponentGroupCommand; use CachetHQ\Cachet\Bus\Commands\ComponentGroup\RemoveComponentGroupCommand;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\UpdateComponentGroupCommand; use CachetHQ\Cachet\Bus\Commands\ComponentGroup\UpdateComponentGroupCommand;
use CachetHQ\Cachet\Models\ComponentGroup; use CachetHQ\Cachet\Models\ComponentGroup;
@@ -92,7 +92,7 @@ class ComponentGroupController extends AbstractApiController
public function postGroups() public function postGroups()
{ {
try { try {
$group = dispatch(new AddComponentGroupCommand( $group = dispatch(new CreateComponentGroupCommand(
Binput::get('name'), Binput::get('name'),
Binput::get('order', 0), Binput::get('order', 0),
Binput::get('collapsed', 0), Binput::get('collapsed', 0),

View File

@@ -11,7 +11,7 @@
namespace CachetHQ\Cachet\Http\Controllers\Api; namespace CachetHQ\Cachet\Http\Controllers\Api;
use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricCommand; use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricCommand;
use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricCommand; use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricCommand;
use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricCommand; use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricCommand;
use CachetHQ\Cachet\Models\Metric; use CachetHQ\Cachet\Models\Metric;
@@ -76,7 +76,7 @@ class MetricController extends AbstractApiController
public function postMetrics() public function postMetrics()
{ {
try { try {
$metric = dispatch(new AddMetricCommand( $metric = dispatch(new CreateMetricCommand(
Binput::get('name'), Binput::get('name'),
Binput::get('suffix'), Binput::get('suffix'),
Binput::get('description'), Binput::get('description'),

View File

@@ -11,7 +11,7 @@
namespace CachetHQ\Cachet\Http\Controllers\Api; namespace CachetHQ\Cachet\Http\Controllers\Api;
use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricPointCommand; use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricPointCommand;
use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricPointCommand; use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricPointCommand;
use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricPointCommand; use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricPointCommand;
use CachetHQ\Cachet\Models\Metric; use CachetHQ\Cachet\Models\Metric;
@@ -45,7 +45,7 @@ class MetricPointController extends AbstractApiController
public function postMetricPoints(Metric $metric) public function postMetricPoints(Metric $metric)
{ {
try { try {
$metricPoint = dispatch(new AddMetricPointCommand( $metricPoint = dispatch(new CreateMetricPointCommand(
$metric, $metric,
Binput::get('value'), Binput::get('value'),
Binput::get('timestamp') Binput::get('timestamp')

View File

@@ -12,10 +12,10 @@
namespace CachetHQ\Cachet\Http\Controllers\Dashboard; namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
use AltThree\Validator\ValidationException; use AltThree\Validator\ValidationException;
use CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand; use CachetHQ\Cachet\Bus\Commands\Component\CreateComponentCommand;
use CachetHQ\Cachet\Bus\Commands\Component\RemoveComponentCommand; use CachetHQ\Cachet\Bus\Commands\Component\RemoveComponentCommand;
use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand; use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand; use CachetHQ\Cachet\Bus\Commands\ComponentGroup\CreateComponentGroupCommand;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\RemoveComponentGroupCommand; use CachetHQ\Cachet\Bus\Commands\ComponentGroup\RemoveComponentGroupCommand;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\UpdateComponentGroupCommand; use CachetHQ\Cachet\Bus\Commands\ComponentGroup\UpdateComponentGroupCommand;
use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\Component;
@@ -182,7 +182,7 @@ class ComponentController extends Controller
$tags = array_pull($componentData, 'tags'); $tags = array_pull($componentData, 'tags');
try { try {
$component = dispatch(new AddComponentCommand( $component = dispatch(new CreateComponentCommand(
$componentData['name'], $componentData['name'],
$componentData['description'], $componentData['description'],
$componentData['status'], $componentData['status'],
@@ -276,7 +276,7 @@ class ComponentController extends Controller
public function postAddComponentGroup() public function postAddComponentGroup()
{ {
try { try {
$group = dispatch(new AddComponentGroupCommand( $group = dispatch(new CreateComponentGroupCommand(
Binput::get('name'), Binput::get('name'),
Binput::get('order', 0), Binput::get('order', 0),
Binput::get('collapsed'), Binput::get('collapsed'),

View File

@@ -12,7 +12,7 @@
namespace CachetHQ\Cachet\Http\Controllers\Dashboard; namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
use AltThree\Validator\ValidationException; use AltThree\Validator\ValidationException;
use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricCommand; use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricCommand;
use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricCommand; use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricCommand;
use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricCommand; use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricCommand;
use CachetHQ\Cachet\Models\Metric; use CachetHQ\Cachet\Models\Metric;
@@ -70,7 +70,7 @@ class MetricController extends Controller
$metricData = Binput::get('metric'); $metricData = Binput::get('metric');
try { try {
dispatch(new AddMetricCommand( dispatch(new CreateMetricCommand(
$metricData['name'], $metricData['name'],
$metricData['suffix'], $metricData['suffix'],
$metricData['description'], $metricData['description'],

View File

@@ -12,7 +12,7 @@
namespace CachetHQ\Cachet\Http\Controllers\Dashboard; namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
use AltThree\Validator\ValidationException; use AltThree\Validator\ValidationException;
use CachetHQ\Cachet\Bus\Commands\User\AddUserCommand; use CachetHQ\Cachet\Bus\Commands\User\CreateUserCommand;
use CachetHQ\Cachet\Bus\Commands\User\InviteUserCommand; use CachetHQ\Cachet\Bus\Commands\User\InviteUserCommand;
use CachetHQ\Cachet\Bus\Commands\User\RemoveUserCommand; use CachetHQ\Cachet\Bus\Commands\User\RemoveUserCommand;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
@@ -80,7 +80,7 @@ class TeamController extends Controller
public function postAddUser() public function postAddUser()
{ {
try { try {
dispatch(new AddUserCommand( dispatch(new CreateUserCommand(
Binput::get('username'), Binput::get('username'),
Binput::get('password'), Binput::get('password'),
Binput::get('email'), Binput::get('email'),

View File

@@ -12,17 +12,17 @@
namespace CachetHQ\Tests\Cachet\Bus\Commands\Component; namespace CachetHQ\Tests\Cachet\Bus\Commands\Component;
use AltThree\TestBench\CommandTrait; use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand; use CachetHQ\Cachet\Bus\Commands\Component\CreateComponentCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Component\AddComponentCommandHandler; use CachetHQ\Cachet\Bus\Handlers\Commands\Component\CreateComponentCommandHandler;
use CachetHQ\Tests\Cachet\AbstractTestCase; use CachetHQ\Tests\Cachet\AbstractTestCase;
/** /**
* This is the add component command test class. * This is the create component command test class.
* *
* @author James Brooks <james@alt-three.com> * @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com> * @author Graham Campbell <graham@alt-three.com>
*/ */
class AddComponentCommandTest extends AbstractTestCase class CreateComponentCommandTest extends AbstractTestCase
{ {
use CommandTrait; use CommandTrait;
@@ -38,7 +38,7 @@ class AddComponentCommandTest extends AbstractTestCase
'enabled' => true, 'enabled' => true,
'meta' => null, 'meta' => null,
]; ];
$object = new AddComponentCommand( $object = new CreateComponentCommand(
$params['name'], $params['name'],
$params['description'], $params['description'],
$params['status'], $params['status'],
@@ -59,6 +59,6 @@ class AddComponentCommandTest extends AbstractTestCase
protected function getHandlerClass() protected function getHandlerClass()
{ {
return AddComponentCommandHandler::class; return CreateComponentCommandHandler::class;
} }
} }

View File

@@ -12,18 +12,18 @@
namespace CachetHQ\Tests\Cachet\Bus\Commands\ComponentGroup; namespace CachetHQ\Tests\Cachet\Bus\Commands\ComponentGroup;
use AltThree\TestBench\CommandTrait; use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand; use CachetHQ\Cachet\Bus\Commands\ComponentGroup\CreateComponentGroupCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup\AddComponentGroupCommandHandler; use CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup\CreateComponentGroupCommandHandler;
use CachetHQ\Cachet\Models\ComponentGroup; use CachetHQ\Cachet\Models\ComponentGroup;
use CachetHQ\Tests\Cachet\AbstractTestCase; use CachetHQ\Tests\Cachet\AbstractTestCase;
/** /**
* This is the add component group command test class. * This is the create component group command test class.
* *
* @author James Brooks <james@alt-three.com> * @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com> * @author Graham Campbell <graham@alt-three.com>
*/ */
class AddComponentGroupCommandTest extends AbstractTestCase class CreateComponentGroupCommandTest extends AbstractTestCase
{ {
use CommandTrait; use CommandTrait;
@@ -36,7 +36,7 @@ class AddComponentGroupCommandTest extends AbstractTestCase
'visible' => ComponentGroup::VISIBLE_AUTHENTICATED, 'visible' => ComponentGroup::VISIBLE_AUTHENTICATED,
]; ];
$object = new AddComponentGroupCommand( $object = new CreateComponentGroupCommand(
$params['name'], $params['name'],
$params['order'], $params['order'],
$params['collapsed'], $params['collapsed'],
@@ -53,6 +53,6 @@ class AddComponentGroupCommandTest extends AbstractTestCase
protected function getHandlerClass() protected function getHandlerClass()
{ {
return AddComponentGroupCommandHandler::class; return CreateComponentGroupCommandHandler::class;
} }
} }

View File

@@ -12,17 +12,17 @@
namespace CachetHQ\Tests\Cachet\Bus\Commands\Metric; namespace CachetHQ\Tests\Cachet\Bus\Commands\Metric;
use AltThree\TestBench\CommandTrait; use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricCommand; use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\AddMetricCommandHandler; use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\CreateMetricCommandHandler;
use CachetHQ\Tests\Cachet\AbstractTestCase; use CachetHQ\Tests\Cachet\AbstractTestCase;
/** /**
* This is the add metric command test class. * This is the create metric command test class.
* *
* @author James Brooks <james@alt-three.com> * @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com> * @author Graham Campbell <graham@alt-three.com>
*/ */
class AddMetricCommandTest extends AbstractTestCase class CreateMetricCommandTest extends AbstractTestCase
{ {
use CommandTrait; use CommandTrait;
@@ -42,7 +42,7 @@ class AddMetricCommandTest extends AbstractTestCase
'visible' => 1, 'visible' => 1,
]; ];
$object = new AddMetricCommand( $object = new CreateMetricCommand(
$params['name'], $params['name'],
$params['suffix'], $params['suffix'],
$params['description'], $params['description'],
@@ -66,6 +66,6 @@ class AddMetricCommandTest extends AbstractTestCase
protected function getHandlerClass() protected function getHandlerClass()
{ {
return AddMetricCommandHandler::class; return CreateMetricCommandHandler::class;
} }
} }

View File

@@ -12,25 +12,25 @@
namespace CachetHQ\Tests\Cachet\Bus\Commands\Metric; namespace CachetHQ\Tests\Cachet\Bus\Commands\Metric;
use AltThree\TestBench\CommandTrait; use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricPointCommand; use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricPointCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\AddMetricPointCommandHandler; use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\CreateMetricPointCommandHandler;
use CachetHQ\Cachet\Models\Metric; use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Tests\Cachet\AbstractTestCase; use CachetHQ\Tests\Cachet\AbstractTestCase;
/** /**
* This is the add metric point command test class. * This is the create metric point command test class.
* *
* @author James Brooks <james@alt-three.com> * @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com> * @author Graham Campbell <graham@alt-three.com>
*/ */
class AddMetricPointCommandTest extends AbstractTestCase class CreateMetricPointCommandTest extends AbstractTestCase
{ {
use CommandTrait; use CommandTrait;
protected function getObjectAndParams() protected function getObjectAndParams()
{ {
$params = ['metric' => new Metric(), 'value' => 1, 'created_at' => '2020-12-30 12:00:00']; $params = ['metric' => new Metric(), 'value' => 1, 'created_at' => '2020-12-30 12:00:00'];
$object = new AddMetricPointCommand($params['metric'], $params['value'], $params['created_at']); $object = new CreateMetricPointCommand($params['metric'], $params['value'], $params['created_at']);
return compact('params', 'object'); return compact('params', 'object');
} }
@@ -42,6 +42,6 @@ class AddMetricPointCommandTest extends AbstractTestCase
protected function getHandlerClass() protected function getHandlerClass()
{ {
return AddMetricPointCommandHandler::class; return CreateMetricPointCommandHandler::class;
} }
} }

View File

@@ -12,8 +12,8 @@
namespace CachetHQ\Tests\Cachet\Bus\Commands\User; namespace CachetHQ\Tests\Cachet\Bus\Commands\User;
use AltThree\TestBench\CommandTrait; use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\User\AddUserCommand; use CachetHQ\Cachet\Bus\Commands\User\CreateUserCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\User\AddUserCommandHandler; use CachetHQ\Cachet\Bus\Handlers\Commands\User\CreateUserCommandHandler;
use CachetHQ\Tests\Cachet\AbstractTestCase; use CachetHQ\Tests\Cachet\AbstractTestCase;
/** /**
@@ -22,7 +22,7 @@ use CachetHQ\Tests\Cachet\AbstractTestCase;
* @author James Brooks <james@alt-three.com> * @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com> * @author Graham Campbell <graham@alt-three.com>
*/ */
class AddUserCommandTest extends AbstractTestCase class CreateUserCommandTest extends AbstractTestCase
{ {
use CommandTrait; use CommandTrait;
@@ -35,7 +35,7 @@ class AddUserCommandTest extends AbstractTestCase
'level' => 1, 'level' => 1,
]; ];
$object = new AddUserCommand( $object = new CreateUserCommand(
$params['username'], $params['username'],
$params['password'], $params['password'],
$params['email'], $params['email'],
@@ -52,6 +52,6 @@ class AddUserCommandTest extends AbstractTestCase
protected function getHandlerClass() protected function getHandlerClass()
{ {
return AddUserCommandHandler::class; return CreateUserCommandHandler::class;
} }
} }

View File

@@ -11,11 +11,11 @@
namespace CachetHQ\Tests\Cachet\Bus\Events\Component; namespace CachetHQ\Tests\Cachet\Bus\Events\Component;
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasAddedEvent; use CachetHQ\Cachet\Bus\Events\Component\ComponentWasCreatedEvent;
use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
class ComponentWasAddedEventTest extends AbstractComponentEventTestCase class ComponentWasCreatedEventTest extends AbstractComponentEventTestCase
{ {
protected function objectHasHandlers() protected function objectHasHandlers()
{ {
@@ -25,7 +25,7 @@ class ComponentWasAddedEventTest extends AbstractComponentEventTestCase
protected function getObjectAndParams() protected function getObjectAndParams()
{ {
$params = ['user' => new User(), 'component' => new Component()]; $params = ['user' => new User(), 'component' => new Component()];
$object = new ComponentWasAddedEvent($params['user'], $params['component']); $object = new ComponentWasCreatedEvent($params['user'], $params['component']);
return compact('params', 'object'); return compact('params', 'object');
} }

View File

@@ -11,11 +11,11 @@
namespace CachetHQ\Tests\Cachet\Bus\Events\ComponentGroup; namespace CachetHQ\Tests\Cachet\Bus\Events\ComponentGroup;
use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasAddedEvent; use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasCreatedEvent;
use CachetHQ\Cachet\Models\ComponentGroup; use CachetHQ\Cachet\Models\ComponentGroup;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
class ComponentGroupWasAddedEventTest extends AbstractComponentGroupEventTestCase class ComponentGroupWasCreatedEventTest extends AbstractComponentGroupEventTestCase
{ {
protected function objectHasHandlers() protected function objectHasHandlers()
{ {
@@ -25,7 +25,7 @@ class ComponentGroupWasAddedEventTest extends AbstractComponentGroupEventTestCas
protected function getObjectAndParams() protected function getObjectAndParams()
{ {
$params = ['user' => new User(), 'group' => new ComponentGroup()]; $params = ['user' => new User(), 'group' => new ComponentGroup()];
$object = new ComponentGroupWasAddedEvent($params['user'], $params['group']); $object = new ComponentGroupWasCreatedEvent($params['user'], $params['group']);
return compact('params', 'object'); return compact('params', 'object');
} }

View File

@@ -11,7 +11,7 @@
namespace CachetHQ\Tests\Cachet\Bus\Events\Metric; namespace CachetHQ\Tests\Cachet\Bus\Events\Metric;
use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasAddedEvent; use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasCreatedEvent;
use CachetHQ\Cachet\Models\MetricPoint; use CachetHQ\Cachet\Models\MetricPoint;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
@@ -20,7 +20,7 @@ use CachetHQ\Cachet\Models\User;
* *
* @author James Brooks <james@alt-three.com> * @author James Brooks <james@alt-three.com>
*/ */
class MetricPointWasAddedEventTest extends AbstractMetricEventTestCase class MetricPointWasCreatedEventTest extends AbstractMetricEventTestCase
{ {
protected function objectHasHandlers() protected function objectHasHandlers()
{ {
@@ -30,7 +30,7 @@ class MetricPointWasAddedEventTest extends AbstractMetricEventTestCase
protected function getObjectAndParams() protected function getObjectAndParams()
{ {
$params = ['user' => new User(), 'metricPoint' => new MetricPoint()]; $params = ['user' => new User(), 'metricPoint' => new MetricPoint()];
$object = new MetricPointWasAddedEvent($params['user'], $params['metricPoint']); $object = new MetricPointWasCreatedEvent($params['user'], $params['metricPoint']);
return compact('params', 'object'); return compact('params', 'object');
} }

View File

@@ -11,11 +11,11 @@
namespace CachetHQ\Tests\Cachet\Bus\Events\Metric; namespace CachetHQ\Tests\Cachet\Bus\Events\Metric;
use CachetHQ\Cachet\Bus\Events\Metric\MetricWasAddedEvent; use CachetHQ\Cachet\Bus\Events\Metric\MetricWasCreatedEvent;
use CachetHQ\Cachet\Models\Metric; use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
class MetricWasAddedEventTest extends AbstractMetricEventTestCase class MetricWasCreatedEventTest extends AbstractMetricEventTestCase
{ {
protected function objectHasHandlers() protected function objectHasHandlers()
{ {
@@ -25,7 +25,7 @@ class MetricWasAddedEventTest extends AbstractMetricEventTestCase
protected function getObjectAndParams() protected function getObjectAndParams()
{ {
$params = ['user' => new User(), 'metric' => new Metric()]; $params = ['user' => new User(), 'metric' => new Metric()];
$object = new MetricWasAddedEvent($params['user'], $params['metric']); $object = new MetricWasCreatedEvent($params['user'], $params['metric']);
return compact('params', 'object'); return compact('params', 'object');
} }

View File

@@ -11,7 +11,7 @@
namespace CachetHQ\Tests\Cachet\Bus\Events\User; namespace CachetHQ\Tests\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\User\UserWasAddedEvent; use CachetHQ\Cachet\Bus\Events\User\UserWasCreatedEvent;
use CachetHQ\Cachet\Models\User; use CachetHQ\Cachet\Models\User;
/** /**
@@ -19,7 +19,7 @@ use CachetHQ\Cachet\Models\User;
* *
* @author Graham Campbell <graham@alt-three.com> * @author Graham Campbell <graham@alt-three.com>
*/ */
class UserWasAddedEventTest extends AbstractUserEventTestCase class UserWasCreatedEventTest extends AbstractUserEventTestCase
{ {
protected function objectHasHandlers() protected function objectHasHandlers()
{ {
@@ -29,7 +29,7 @@ class UserWasAddedEventTest extends AbstractUserEventTestCase
protected function getObjectAndParams() protected function getObjectAndParams()
{ {
$params = ['user' => new User()]; $params = ['user' => new User()];
$object = new UserWasAddedEvent($params['user']); $object = new UserWasCreatedEvent($params['user']);
return compact('params', 'object'); return compact('params', 'object');
} }