Code clean up. Remove some duplicate keys; Remove some unused parameters; Fix some FQCN;

This commit is contained in:
Luis Henrique Mulinari
2017-10-11 21:19:07 +02:00
parent e426eff98c
commit 968bc6a3ce
9 changed files with 12 additions and 17 deletions

View File

@@ -105,7 +105,6 @@ final class CreateMetricCommand
'name' => 'required|string', 'name' => 'required|string',
'suffix' => 'required|string', 'suffix' => 'required|string',
'description' => 'nullable|string', 'description' => 'nullable|string',
'display_chart' => 'nullable|bool',
'default_value' => 'required|int', 'default_value' => 'required|int',
'calc_type' => 'required|int', 'calc_type' => 'required|int',
'display_chart' => 'nullable|int', 'display_chart' => 'nullable|int',

View File

@@ -108,7 +108,6 @@ final class UpdateMetricCommand
'name' => 'nullable|string', 'name' => 'nullable|string',
'suffix' => 'nullable|string', 'suffix' => 'nullable|string',
'description' => 'nullable|string', 'description' => 'nullable|string',
'display_chart' => 'nullable|bool',
'default_value' => 'nullable|numeric', 'default_value' => 'nullable|numeric',
'calc_type' => 'nullable|int|in:0,1', 'calc_type' => 'nullable|int|in:0,1',
'display_chart' => 'nullable|int', 'display_chart' => 'nullable|int',

View File

@@ -56,14 +56,14 @@ class DemoSeederCommand extends Command
/** /**
* The settings repository. * The settings repository.
* *
* @var \CachetHQ\Cache\Settings\Repository * @var \CachetHQ\Cachet\Settings\Repository
*/ */
protected $settings; protected $settings;
/** /**
* Create a new demo seeder command instance. * Create a new demo seeder command instance.
* *
* @param \CachetHQ\Cache\Settings\Repository $settings * @param \CachetHQ\Cachet\Settings\Repository $settings
* *
* @return void * @return void
*/ */

View File

@@ -63,9 +63,6 @@ class EventServiceProvider extends ServiceProvider
'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasCreatedEvent' => [ 'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasCreatedEvent' => [
'CachetHQ\Cachet\Bus\Handlers\Events\Incident\SendIncidentEmailNotificationHandler', 'CachetHQ\Cachet\Bus\Handlers\Events\Incident\SendIncidentEmailNotificationHandler',
], ],
'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasRemovedEvent' => [
//
],
'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasUpdatedEvent' => [ 'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasUpdatedEvent' => [
// //
], ],

View File

@@ -149,7 +149,7 @@ class ComponentController extends Controller
$tags = preg_split('/ ?, ?/', $tags); $tags = preg_split('/ ?, ?/', $tags);
// For every tag, do we need to create it? // 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; return Tag::firstOrCreate(['name' => $taggable])->id;
}, $tags); }, $tags);
@@ -203,7 +203,7 @@ class ComponentController extends Controller
$tags = preg_split('/ ?, ?/', $tags); $tags = preg_split('/ ?, ?/', $tags);
// For every tag, do we need to create it? // 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; return Tag::firstOrCreate(['name' => $taggable])->id;
}, $tags); }, $tags);

View File

@@ -48,7 +48,7 @@ class DashboardController extends Controller
/** /**
* The feed integration. * The feed integration.
* *
* @var \CachetHQ\Cachet\Integrations\Feed * @var \CachetHQ\Cachet\Integrations\Contracts\Feed
*/ */
protected $feed; protected $feed;
@@ -62,7 +62,7 @@ class DashboardController extends Controller
/** /**
* Creates a new dashboard controller instance. * 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 * @param \Illuminate\Contracts\Auth\Guard $guard
* *
* @return void * @return void

View File

@@ -146,7 +146,7 @@ class SubscribeController extends Controller
if ($subscription) { if ($subscription) {
dispatch(new UnsubscribeSubscriptionCommand(Subscription::forSubscriber($subscriber->id)->firstOrFail())); dispatch(new UnsubscribeSubscriptionCommand(Subscription::forSubscriber($subscriber->id)->firstOrFail()));
} else { } else {
dispatch(new UnsubscribeSubscriberCommand($subscriber, $subscription)); dispatch(new UnsubscribeSubscriberCommand($subscriber));
} }
return cachet_redirect('status-page') return cachet_redirect('status-page')

View File

@@ -122,7 +122,7 @@ class NewIncidentNotification extends Notification
return (new SlackMessage()) return (new SlackMessage())
->$status() ->$status()
->content($content) ->content($content)
->attachment(function ($attachment) use ($content, $notifiable) { ->attachment(function ($attachment) use ($notifiable) {
$attachment->title(trans('notifications.incident.new.slack.title', [$this->incident->name])) $attachment->title(trans('notifications.incident.new.slack.title', [$this->incident->name]))
->timestamp($this->incident->getWrappedObject()->occurred_at) ->timestamp($this->incident->getWrappedObject()->occurred_at)
->fields(array_filter([ ->fields(array_filter([

View File

@@ -71,7 +71,7 @@ class MetricRepository
$pointKey = $dateTime->sub(new DateInterval('PT1M'))->format('H:i'); $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; return $key;
}); });
} }
@@ -98,7 +98,7 @@ class MetricRepository
$pointKey = $dateTime->sub(new DateInterval('PT1H'))->format('H:00'); $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; return $key;
}); });
} }
@@ -124,7 +124,7 @@ class MetricRepository
$pointKey = $dateTime->sub(new DateInterval('P1D'))->format('Y-m-d'); $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; return $key;
}); });
} }
@@ -151,7 +151,7 @@ class MetricRepository
$pointKey = $dateTime->sub(new DateInterval('P1D'))->format('Y-m-d'); $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; return $key;
}); });
} }