Apply fixes from StyleCI

This commit is contained in:
James Brooks
2020-02-27 09:44:35 +00:00
committed by StyleCI Bot
parent 4435526b0e
commit 5ff2289eeb
22 changed files with 89 additions and 88 deletions

View File

@@ -98,9 +98,9 @@ class StatusPageController extends AbstractApiController
$allIncidents = Incident::with('component', 'updates.incident')
->where('visible', '>=', (int) !Auth::check())->whereBetween('occurred_at', [
$endDate->format('Y-m-d').' 00:00:00',
$startDate->format('Y-m-d').' 23:59:59',
])->orderBy('occurred_at', 'desc')->get()->groupBy(function (Incident $incident) {
$endDate->format('Y-m-d').' 00:00:00',
$startDate->format('Y-m-d').' 23:59:59',
])->orderBy('occurred_at', 'desc')->get()->groupBy(function (Incident $incident) {
return app(DateFactory::class)->make($incident->occurred_at)->toDateString();
});

View File

@@ -24,12 +24,12 @@ use McCool\LaravelAutoPresenter\HasPresenter;
class Component extends Model implements HasPresenter
{
use HasTags,
HasMeta,
SearchableTrait,
SoftDeletes,
SortableTrait,
ValidatingTrait;
use HasTags;
use HasMeta;
use SearchableTrait;
use SoftDeletes;
use SortableTrait;
use ValidatingTrait;
/**
* List of attributes that have default values.

View File

@@ -27,8 +27,9 @@ use McCool\LaravelAutoPresenter\HasPresenter;
*/
class ComponentGroup extends Model implements HasPresenter
{
use SearchableTrait, SortableTrait, ValidatingTrait;
use SearchableTrait;
use SortableTrait;
use ValidatingTrait;
/**
* Viewable only authenticated users.
*

View File

@@ -31,12 +31,12 @@ use McCool\LaravelAutoPresenter\HasPresenter;
*/
class Incident extends Model implements HasPresenter
{
use HasMeta,
HasTags,
SearchableTrait,
SoftDeletes,
SortableTrait,
ValidatingTrait;
use HasMeta;
use HasTags;
use SearchableTrait;
use SoftDeletes;
use SortableTrait;
use ValidatingTrait;
/**
* Status for incident being investigated.

View File

@@ -24,8 +24,8 @@ use McCool\LaravelAutoPresenter\HasPresenter;
*/
class IncidentUpdate extends Model implements HasPresenter
{
use SortableTrait, ValidatingTrait;
use SortableTrait;
use ValidatingTrait;
/**
* The attributes that should be casted to native types.
*

View File

@@ -23,9 +23,9 @@ use McCool\LaravelAutoPresenter\HasPresenter;
class Metric extends Model implements HasPresenter
{
use HasMeta,
SortableTrait,
ValidatingTrait;
use HasMeta;
use SortableTrait;
use ValidatingTrait;
/**
* The calculation type of sum.

View File

@@ -24,11 +24,11 @@ use McCool\LaravelAutoPresenter\HasPresenter;
class Schedule extends Model implements HasPresenter
{
use HasMeta,
SearchableTrait,
SoftDeletes,
SortableTrait,
ValidatingTrait;
use HasMeta;
use SearchableTrait;
use SoftDeletes;
use SortableTrait;
use ValidatingTrait;
/**
* The upcoming status.

View File

@@ -29,9 +29,9 @@ use McCool\LaravelAutoPresenter\HasPresenter;
*/
class Subscriber extends Model implements HasPresenter
{
use HasMeta,
Notifiable,
ValidatingTrait;
use HasMeta;
use Notifiable;
use ValidatingTrait;
/**
* The attributes that should be casted to native types.

View File

@@ -26,8 +26,8 @@ use Illuminate\Support\Str;
*/
class User extends Authenticatable
{
use Notifiable, ValidatingTrait;
use Notifiable;
use ValidatingTrait;
/**
* The admin level of user.
*

View File

@@ -92,7 +92,7 @@ class ComponentStatusChangedNotification extends Notification
'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code),
'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'),
'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code),
]);
]);
}
/**
@@ -144,11 +144,11 @@ class ComponentStatusChangedNotification extends Notification
->attachment(function ($attachment) use ($content, $notifiable) {
$attachment->title($content, cachet_route('status-page'))
->fields(array_filter([
'Component' => $this->component->name,
'Old Status' => $this->component->human_status,
'New Status' => trans("cachet.components.status.{$this->status}"),
'Link' => $this->component->link,
]))
'Component' => $this->component->name,
'Old Status' => $this->component->human_status,
'New Status' => trans("cachet.components.status.{$this->status}"),
'Link' => $this->component->link,
]))
->footer(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
});
}

View File

@@ -131,9 +131,9 @@ class NewIncidentNotification extends Notification
$attachment->title(trans('notifications.incident.new.slack.title', ['name' => $this->incident->name]))
->timestamp($this->incident->getWrappedObject()->occurred_at)
->fields(array_filter([
'ID' => "#{$this->incident->id}",
'Link' => $this->incident->permalink,
]));
'ID' => "#{$this->incident->id}",
'Link' => $this->incident->permalink,
]));
});
}
}

View File

@@ -88,7 +88,7 @@ class IncidentUpdatedNotification extends Notification
'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code),
'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'),
'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code),
]);
]);
}
/**
@@ -136,14 +136,14 @@ class IncidentUpdatedNotification extends Notification
->content($content)
->attachment(function ($attachment) use ($content, $notifiable) {
$attachment->title(trans('notifications.incident.update.slack.title', [
'name' => $this->update->incident->name,
'new_status' => $this->update->human_status,
]))
'name' => $this->update->incident->name,
'new_status' => $this->update->human_status,
]))
->timestamp($this->update->getWrappedObject()->created_at)
->fields(array_filter([
'ID' => "#{$this->update->id}",
'Link' => $this->update->permalink,
]))
'ID' => "#{$this->update->id}",
'Link' => $this->update->permalink,
]))
->footer(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
});
}

View File

@@ -82,7 +82,7 @@ class NewScheduleNotification extends Notification implements ShouldQueue
'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code),
'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'),
'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code),
]);
]);
}
/**
@@ -122,9 +122,9 @@ class NewScheduleNotification extends Notification implements ShouldQueue
$attachment->title($content)
->timestamp($this->schedule->getWrappedObject()->scheduled_at)
->fields(array_filter([
'ID' => "#{$this->schedule->id}",
'Status' => $this->schedule->human_status,
]));
'ID' => "#{$this->schedule->id}",
'Status' => $this->schedule->human_status,
]));
});
}
}

View File

@@ -39,9 +39,9 @@ class MySqlRepository extends AbstractMetricRepository implements MetricInterfac
"AND {$this->getMetricPointsTable()}.`created_at` >= DATE_SUB(NOW(), INTERVAL :minutes MINUTE) ".
"AND {$this->getMetricPointsTable()}.`created_at` <= NOW() ".
"GROUP BY HOUR({$this->getMetricPointsTable()}.`created_at`), MINUTE({$this->getMetricPointsTable()}.`created_at`) ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
'metricId' => $metric->id,
'minutes' => $minutes,
]);
'metricId' => $metric->id,
'minutes' => $minutes,
]);
return $this->mapResults($metric, $points);
}
@@ -64,9 +64,9 @@ class MySqlRepository extends AbstractMetricRepository implements MetricInterfac
"AND {$this->getMetricPointsTable()}.`created_at` <= NOW() ".
"GROUP BY HOUR({$this->getMetricPointsTable()}.`created_at`) ".
"ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
'metricId' => $metric->id,
'hour' => $hour,
]);
'metricId' => $metric->id,
'hour' => $hour,
]);
return $this->mapResults($metric, $points);
}
@@ -88,9 +88,9 @@ class MySqlRepository extends AbstractMetricRepository implements MetricInterfac
"AND {$this->getMetricPointsTable()}.`created_at` >= DATE_SUB(NOW(), INTERVAL :day DAY) ".
"AND {$this->getMetricPointsTable()}.`created_at` <= NOW() ".
"GROUP BY DATE({$this->getMetricPointsTable()}.`created_at`) ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
'metricId' => $metric->id,
'day' => $day,
]);
'metricId' => $metric->id,
'day' => $day,
]);
return $this->mapResults($metric, $points);
}

View File

@@ -39,8 +39,8 @@ class PgSqlRepository extends AbstractMetricRepository implements MetricInterfac
"AND {$this->getMetricPointsTable()}.created_at <= NOW() ".
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:MI') ".
"ORDER BY {$this->getMetricPointsTable()}.created_at", [
'metricId' => $metric->id,
]);
'metricId' => $metric->id,
]);
return $this->mapResults($metric, $points);
}
@@ -63,8 +63,8 @@ class PgSqlRepository extends AbstractMetricRepository implements MetricInterfac
"AND {$this->getMetricPointsTable()}.created_at <= NOW() ".
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:00') ".
"ORDER BY {$this->getMetricPointsTable()}.created_at", [
'metricId' => $metric->id,
]);
'metricId' => $metric->id,
]);
return $this->mapResults($metric, $points);
}
@@ -87,8 +87,8 @@ class PgSqlRepository extends AbstractMetricRepository implements MetricInterfac
"AND {$this->getMetricPointsTable()}.created_at <= DATE(NOW()) ".
"GROUP BY DATE({$this->getMetricPointsTable()}.created_at) ".
"ORDER BY DATE({$this->getMetricPointsTable()}.created_at)", [
'metricId' => $metric->id,
]);
'metricId' => $metric->id,
]);
return $this->mapResults($metric, $points);
}

View File

@@ -40,8 +40,8 @@ class SqliteRepository extends AbstractMetricRepository implements MetricInterfa
"AND {$this->getMetricPointsTable()}.`created_at` <= datetime('now', 'localtime') ".
"GROUP BY strftime('%H', {$this->getMetricPointsTable()}.`created_at`), strftime('%M', {$this->getMetricPointsTable()}.`created_at`) ".
"ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
'metricId' => $metric->id,
]);
'metricId' => $metric->id,
]);
return $this->mapResults($metric, $points);
}
@@ -63,8 +63,8 @@ class SqliteRepository extends AbstractMetricRepository implements MetricInterfa
"AND {$this->getMetricPointsTable()}.`created_at` >= datetime('now', 'localtime', '-{$hour} hours') ".
"AND {$this->getMetricPointsTable()}.`created_at` <= datetime('now', 'localtime') ".
"GROUP BY strftime('%H', {$this->getMetricPointsTable()}.`created_at`) ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
'metricId' => $metric->id,
]);
'metricId' => $metric->id,
]);
return $this->mapResults($metric, $points);
}
@@ -87,8 +87,8 @@ class SqliteRepository extends AbstractMetricRepository implements MetricInterfa
"AND {$this->getMetricPointsTable()}.`created_at` <= datetime('now', 'localtime') ".
"GROUP BY DATE({$this->getMetricPointsTable()}.`created_at`) ".
"ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
'metricId' => $metric->id,
]);
'metricId' => $metric->id,
]);
return $this->mapResults($metric, $points);
}