From 968bc6a3cefaf82979aeab0192f5b755f04361f4 Mon Sep 17 00:00:00 2001 From: Luis Henrique Mulinari Date: Wed, 11 Oct 2017 21:19:07 +0200 Subject: [PATCH] Code clean up. Remove some duplicate keys; Remove some unused parameters; Fix some FQCN; --- app/Bus/Commands/Metric/CreateMetricCommand.php | 1 - app/Bus/Commands/Metric/UpdateMetricCommand.php | 1 - app/Console/Commands/DemoSeederCommand.php | 4 ++-- app/Foundation/Providers/EventServiceProvider.php | 3 --- app/Http/Controllers/Dashboard/ComponentController.php | 4 ++-- app/Http/Controllers/Dashboard/DashboardController.php | 4 ++-- app/Http/Controllers/SubscribeController.php | 2 +- app/Notifications/Incident/NewIncidentNotification.php | 2 +- app/Repositories/Metric/MetricRepository.php | 8 ++++---- 9 files changed, 12 insertions(+), 17 deletions(-) diff --git a/app/Bus/Commands/Metric/CreateMetricCommand.php b/app/Bus/Commands/Metric/CreateMetricCommand.php index 0a1cc82f..01e31ed3 100644 --- a/app/Bus/Commands/Metric/CreateMetricCommand.php +++ b/app/Bus/Commands/Metric/CreateMetricCommand.php @@ -105,7 +105,6 @@ final class CreateMetricCommand 'name' => 'required|string', 'suffix' => 'required|string', 'description' => 'nullable|string', - 'display_chart' => 'nullable|bool', 'default_value' => 'required|int', 'calc_type' => 'required|int', 'display_chart' => 'nullable|int', diff --git a/app/Bus/Commands/Metric/UpdateMetricCommand.php b/app/Bus/Commands/Metric/UpdateMetricCommand.php index aa713408..535837f4 100644 --- a/app/Bus/Commands/Metric/UpdateMetricCommand.php +++ b/app/Bus/Commands/Metric/UpdateMetricCommand.php @@ -108,7 +108,6 @@ final class UpdateMetricCommand 'name' => 'nullable|string', 'suffix' => 'nullable|string', 'description' => 'nullable|string', - 'display_chart' => 'nullable|bool', 'default_value' => 'nullable|numeric', 'calc_type' => 'nullable|int|in:0,1', 'display_chart' => 'nullable|int', diff --git a/app/Console/Commands/DemoSeederCommand.php b/app/Console/Commands/DemoSeederCommand.php index f71847d1..4aeb7300 100644 --- a/app/Console/Commands/DemoSeederCommand.php +++ b/app/Console/Commands/DemoSeederCommand.php @@ -56,14 +56,14 @@ class DemoSeederCommand extends Command /** * The settings repository. * - * @var \CachetHQ\Cache\Settings\Repository + * @var \CachetHQ\Cachet\Settings\Repository */ protected $settings; /** * Create a new demo seeder command instance. * - * @param \CachetHQ\Cache\Settings\Repository $settings + * @param \CachetHQ\Cachet\Settings\Repository $settings * * @return void */ diff --git a/app/Foundation/Providers/EventServiceProvider.php b/app/Foundation/Providers/EventServiceProvider.php index 2543300b..36283d45 100644 --- a/app/Foundation/Providers/EventServiceProvider.php +++ b/app/Foundation/Providers/EventServiceProvider.php @@ -63,9 +63,6 @@ class EventServiceProvider extends ServiceProvider 'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasCreatedEvent' => [ 'CachetHQ\Cachet\Bus\Handlers\Events\Incident\SendIncidentEmailNotificationHandler', ], - 'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasRemovedEvent' => [ - // - ], 'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasUpdatedEvent' => [ // ], diff --git a/app/Http/Controllers/Dashboard/ComponentController.php b/app/Http/Controllers/Dashboard/ComponentController.php index dd991db1..74948d66 100644 --- a/app/Http/Controllers/Dashboard/ComponentController.php +++ b/app/Http/Controllers/Dashboard/ComponentController.php @@ -149,7 +149,7 @@ class ComponentController extends Controller $tags = preg_split('/ ?, ?/', $tags); // For every tag, do we need to create it? - $componentTags = array_map(function ($taggable) use ($component) { + $componentTags = array_map(function ($taggable) { return Tag::firstOrCreate(['name' => $taggable])->id; }, $tags); @@ -203,7 +203,7 @@ class ComponentController extends Controller $tags = preg_split('/ ?, ?/', $tags); // For every tag, do we need to create it? - $componentTags = array_map(function ($taggable) use ($component) { + $componentTags = array_map(function ($taggable) { return Tag::firstOrCreate(['name' => $taggable])->id; }, $tags); diff --git a/app/Http/Controllers/Dashboard/DashboardController.php b/app/Http/Controllers/Dashboard/DashboardController.php index 13f4d2d9..645bc115 100644 --- a/app/Http/Controllers/Dashboard/DashboardController.php +++ b/app/Http/Controllers/Dashboard/DashboardController.php @@ -48,7 +48,7 @@ class DashboardController extends Controller /** * The feed integration. * - * @var \CachetHQ\Cachet\Integrations\Feed + * @var \CachetHQ\Cachet\Integrations\Contracts\Feed */ protected $feed; @@ -62,7 +62,7 @@ class DashboardController extends Controller /** * Creates a new dashboard controller instance. * - * @param \CachetHQ\Cachet\Integrations\Feed $feed + * @param \CachetHQ\Cachet\Integrations\Contracts\Feed $feed * @param \Illuminate\Contracts\Auth\Guard $guard * * @return void diff --git a/app/Http/Controllers/SubscribeController.php b/app/Http/Controllers/SubscribeController.php index d0219843..7ae2cc16 100644 --- a/app/Http/Controllers/SubscribeController.php +++ b/app/Http/Controllers/SubscribeController.php @@ -146,7 +146,7 @@ class SubscribeController extends Controller if ($subscription) { dispatch(new UnsubscribeSubscriptionCommand(Subscription::forSubscriber($subscriber->id)->firstOrFail())); } else { - dispatch(new UnsubscribeSubscriberCommand($subscriber, $subscription)); + dispatch(new UnsubscribeSubscriberCommand($subscriber)); } return cachet_redirect('status-page') diff --git a/app/Notifications/Incident/NewIncidentNotification.php b/app/Notifications/Incident/NewIncidentNotification.php index 0700f792..d92d8b55 100644 --- a/app/Notifications/Incident/NewIncidentNotification.php +++ b/app/Notifications/Incident/NewIncidentNotification.php @@ -122,7 +122,7 @@ class NewIncidentNotification extends Notification return (new SlackMessage()) ->$status() ->content($content) - ->attachment(function ($attachment) use ($content, $notifiable) { + ->attachment(function ($attachment) use ($notifiable) { $attachment->title(trans('notifications.incident.new.slack.title', [$this->incident->name])) ->timestamp($this->incident->getWrappedObject()->occurred_at) ->fields(array_filter([ diff --git a/app/Repositories/Metric/MetricRepository.php b/app/Repositories/Metric/MetricRepository.php index 6f83a184..462b6199 100644 --- a/app/Repositories/Metric/MetricRepository.php +++ b/app/Repositories/Metric/MetricRepository.php @@ -71,7 +71,7 @@ class MetricRepository $pointKey = $dateTime->sub(new DateInterval('PT1M'))->format('H:i'); } - return $points->sortBy(function ($point, $key) use ($points) { + return $points->sortBy(function ($point, $key) { return $key; }); } @@ -98,7 +98,7 @@ class MetricRepository $pointKey = $dateTime->sub(new DateInterval('PT1H'))->format('H:00'); } - return $points->sortBy(function ($point, $key) use ($points) { + return $points->sortBy(function ($point, $key) { return $key; }); } @@ -124,7 +124,7 @@ class MetricRepository $pointKey = $dateTime->sub(new DateInterval('P1D'))->format('Y-m-d'); } - return $points->sortBy(function ($point, $key) use ($points) { + return $points->sortBy(function ($point, $key) { return $key; }); } @@ -151,7 +151,7 @@ class MetricRepository $pointKey = $dateTime->sub(new DateInterval('P1D'))->format('Y-m-d'); } - return $points->sortBy(function ($point, $key) use ($points) { + return $points->sortBy(function ($point, $key) { return $key; }); }