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') $allIncidents = Incident::with('component', 'updates.incident')
->where('visible', '>=', (int) !Auth::check())->whereBetween('occurred_at', [ ->where('visible', '>=', (int) !Auth::check())->whereBetween('occurred_at', [
$endDate->format('Y-m-d').' 00:00:00', $endDate->format('Y-m-d').' 00:00:00',
$startDate->format('Y-m-d').' 23:59:59', $startDate->format('Y-m-d').' 23:59:59',
])->orderBy('occurred_at', 'desc')->get()->groupBy(function (Incident $incident) { ])->orderBy('occurred_at', 'desc')->get()->groupBy(function (Incident $incident) {
return app(DateFactory::class)->make($incident->occurred_at)->toDateString(); 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 class Component extends Model implements HasPresenter
{ {
use HasTags, use HasTags;
HasMeta, use HasMeta;
SearchableTrait, use SearchableTrait;
SoftDeletes, use SoftDeletes;
SortableTrait, use SortableTrait;
ValidatingTrait; use ValidatingTrait;
/** /**
* List of attributes that have default values. * List of attributes that have default values.

View File

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

View File

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

View File

@ -24,8 +24,8 @@ use McCool\LaravelAutoPresenter\HasPresenter;
*/ */
class IncidentUpdate extends Model implements HasPresenter class IncidentUpdate extends Model implements HasPresenter
{ {
use SortableTrait, ValidatingTrait; use SortableTrait;
use ValidatingTrait;
/** /**
* The attributes that should be casted to native types. * 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 class Metric extends Model implements HasPresenter
{ {
use HasMeta, use HasMeta;
SortableTrait, use SortableTrait;
ValidatingTrait; use ValidatingTrait;
/** /**
* The calculation type of sum. * The calculation type of sum.

View File

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

View File

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

View File

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

View File

@ -92,7 +92,7 @@ class ComponentStatusChangedNotification extends Notification
'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code), 'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code),
'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'), 'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'),
'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code), 'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code),
]); ]);
} }
/** /**
@ -144,11 +144,11 @@ class ComponentStatusChangedNotification extends Notification
->attachment(function ($attachment) use ($content, $notifiable) { ->attachment(function ($attachment) use ($content, $notifiable) {
$attachment->title($content, cachet_route('status-page')) $attachment->title($content, cachet_route('status-page'))
->fields(array_filter([ ->fields(array_filter([
'Component' => $this->component->name, 'Component' => $this->component->name,
'Old Status' => $this->component->human_status, 'Old Status' => $this->component->human_status,
'New Status' => trans("cachet.components.status.{$this->status}"), 'New Status' => trans("cachet.components.status.{$this->status}"),
'Link' => $this->component->link, 'Link' => $this->component->link,
])) ]))
->footer(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)])); ->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])) $attachment->title(trans('notifications.incident.new.slack.title', ['name' => $this->incident->name]))
->timestamp($this->incident->getWrappedObject()->occurred_at) ->timestamp($this->incident->getWrappedObject()->occurred_at)
->fields(array_filter([ ->fields(array_filter([
'ID' => "#{$this->incident->id}", 'ID' => "#{$this->incident->id}",
'Link' => $this->incident->permalink, 'Link' => $this->incident->permalink,
])); ]));
}); });
} }
} }

View File

@ -88,7 +88,7 @@ class IncidentUpdatedNotification extends Notification
'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code), 'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code),
'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'), 'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'),
'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code), 'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code),
]); ]);
} }
/** /**
@ -136,14 +136,14 @@ class IncidentUpdatedNotification extends Notification
->content($content) ->content($content)
->attachment(function ($attachment) use ($content, $notifiable) { ->attachment(function ($attachment) use ($content, $notifiable) {
$attachment->title(trans('notifications.incident.update.slack.title', [ $attachment->title(trans('notifications.incident.update.slack.title', [
'name' => $this->update->incident->name, 'name' => $this->update->incident->name,
'new_status' => $this->update->human_status, 'new_status' => $this->update->human_status,
])) ]))
->timestamp($this->update->getWrappedObject()->created_at) ->timestamp($this->update->getWrappedObject()->created_at)
->fields(array_filter([ ->fields(array_filter([
'ID' => "#{$this->update->id}", 'ID' => "#{$this->update->id}",
'Link' => $this->update->permalink, 'Link' => $this->update->permalink,
])) ]))
->footer(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)])); ->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), 'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code),
'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'), 'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'),
'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code), 'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code),
]); ]);
} }
/** /**
@ -122,9 +122,9 @@ class NewScheduleNotification extends Notification implements ShouldQueue
$attachment->title($content) $attachment->title($content)
->timestamp($this->schedule->getWrappedObject()->scheduled_at) ->timestamp($this->schedule->getWrappedObject()->scheduled_at)
->fields(array_filter([ ->fields(array_filter([
'ID' => "#{$this->schedule->id}", 'ID' => "#{$this->schedule->id}",
'Status' => $this->schedule->human_status, '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` >= DATE_SUB(NOW(), INTERVAL :minutes MINUTE) ".
"AND {$this->getMetricPointsTable()}.`created_at` <= NOW() ". "AND {$this->getMetricPointsTable()}.`created_at` <= NOW() ".
"GROUP BY HOUR({$this->getMetricPointsTable()}.`created_at`), MINUTE({$this->getMetricPointsTable()}.`created_at`) ORDER BY {$this->getMetricPointsTable()}.`created_at`", [ "GROUP BY HOUR({$this->getMetricPointsTable()}.`created_at`), MINUTE({$this->getMetricPointsTable()}.`created_at`) ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
'metricId' => $metric->id, 'metricId' => $metric->id,
'minutes' => $minutes, 'minutes' => $minutes,
]); ]);
return $this->mapResults($metric, $points); return $this->mapResults($metric, $points);
} }
@ -64,9 +64,9 @@ class MySqlRepository extends AbstractMetricRepository implements MetricInterfac
"AND {$this->getMetricPointsTable()}.`created_at` <= NOW() ". "AND {$this->getMetricPointsTable()}.`created_at` <= NOW() ".
"GROUP BY HOUR({$this->getMetricPointsTable()}.`created_at`) ". "GROUP BY HOUR({$this->getMetricPointsTable()}.`created_at`) ".
"ORDER BY {$this->getMetricPointsTable()}.`created_at`", [ "ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
'metricId' => $metric->id, 'metricId' => $metric->id,
'hour' => $hour, 'hour' => $hour,
]); ]);
return $this->mapResults($metric, $points); 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` >= DATE_SUB(NOW(), INTERVAL :day DAY) ".
"AND {$this->getMetricPointsTable()}.`created_at` <= NOW() ". "AND {$this->getMetricPointsTable()}.`created_at` <= NOW() ".
"GROUP BY DATE({$this->getMetricPointsTable()}.`created_at`) ORDER BY {$this->getMetricPointsTable()}.`created_at`", [ "GROUP BY DATE({$this->getMetricPointsTable()}.`created_at`) ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
'metricId' => $metric->id, 'metricId' => $metric->id,
'day' => $day, 'day' => $day,
]); ]);
return $this->mapResults($metric, $points); return $this->mapResults($metric, $points);
} }

View File

@ -39,8 +39,8 @@ class PgSqlRepository extends AbstractMetricRepository implements MetricInterfac
"AND {$this->getMetricPointsTable()}.created_at <= NOW() ". "AND {$this->getMetricPointsTable()}.created_at <= NOW() ".
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:MI') ". "GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:MI') ".
"ORDER BY {$this->getMetricPointsTable()}.created_at", [ "ORDER BY {$this->getMetricPointsTable()}.created_at", [
'metricId' => $metric->id, 'metricId' => $metric->id,
]); ]);
return $this->mapResults($metric, $points); return $this->mapResults($metric, $points);
} }
@ -63,8 +63,8 @@ class PgSqlRepository extends AbstractMetricRepository implements MetricInterfac
"AND {$this->getMetricPointsTable()}.created_at <= NOW() ". "AND {$this->getMetricPointsTable()}.created_at <= NOW() ".
"GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:00') ". "GROUP BY to_char({$this->getMetricPointsTable()}.created_at, 'HH24:00') ".
"ORDER BY {$this->getMetricPointsTable()}.created_at", [ "ORDER BY {$this->getMetricPointsTable()}.created_at", [
'metricId' => $metric->id, 'metricId' => $metric->id,
]); ]);
return $this->mapResults($metric, $points); return $this->mapResults($metric, $points);
} }
@ -87,8 +87,8 @@ class PgSqlRepository extends AbstractMetricRepository implements MetricInterfac
"AND {$this->getMetricPointsTable()}.created_at <= DATE(NOW()) ". "AND {$this->getMetricPointsTable()}.created_at <= DATE(NOW()) ".
"GROUP BY DATE({$this->getMetricPointsTable()}.created_at) ". "GROUP BY DATE({$this->getMetricPointsTable()}.created_at) ".
"ORDER BY DATE({$this->getMetricPointsTable()}.created_at)", [ "ORDER BY DATE({$this->getMetricPointsTable()}.created_at)", [
'metricId' => $metric->id, 'metricId' => $metric->id,
]); ]);
return $this->mapResults($metric, $points); 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') ". "AND {$this->getMetricPointsTable()}.`created_at` <= datetime('now', 'localtime') ".
"GROUP BY strftime('%H', {$this->getMetricPointsTable()}.`created_at`), strftime('%M', {$this->getMetricPointsTable()}.`created_at`) ". "GROUP BY strftime('%H', {$this->getMetricPointsTable()}.`created_at`), strftime('%M', {$this->getMetricPointsTable()}.`created_at`) ".
"ORDER BY {$this->getMetricPointsTable()}.`created_at`", [ "ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
'metricId' => $metric->id, 'metricId' => $metric->id,
]); ]);
return $this->mapResults($metric, $points); 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', '-{$hour} hours') ".
"AND {$this->getMetricPointsTable()}.`created_at` <= datetime('now', 'localtime') ". "AND {$this->getMetricPointsTable()}.`created_at` <= datetime('now', 'localtime') ".
"GROUP BY strftime('%H', {$this->getMetricPointsTable()}.`created_at`) ORDER BY {$this->getMetricPointsTable()}.`created_at`", [ "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); return $this->mapResults($metric, $points);
} }
@ -87,8 +87,8 @@ class SqliteRepository extends AbstractMetricRepository implements MetricInterfa
"AND {$this->getMetricPointsTable()}.`created_at` <= datetime('now', 'localtime') ". "AND {$this->getMetricPointsTable()}.`created_at` <= datetime('now', 'localtime') ".
"GROUP BY DATE({$this->getMetricPointsTable()}.`created_at`) ". "GROUP BY DATE({$this->getMetricPointsTable()}.`created_at`) ".
"ORDER BY {$this->getMetricPointsTable()}.`created_at`", [ "ORDER BY {$this->getMetricPointsTable()}.`created_at`", [
'metricId' => $metric->id, 'metricId' => $metric->id,
]); ]);
return $this->mapResults($metric, $points); return $this->mapResults($metric, $points);
} }

View File

@ -31,7 +31,7 @@ return [
| |
*/ */
'is_docker' => env('DOCKER', false), 'is_docker' => env('DOCKER', false),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -44,6 +44,6 @@ return [
| |
*/ */
'beacon' => env('CACHET_BEACON', true), 'beacon' => env('CACHET_BEACON', true),
]; ];

View File

@ -23,7 +23,7 @@ return [
| |
*/ */
'github' => [ 'github' => [
'token' => env('GITHUB_TOKEN'), 'token' => env('GITHUB_TOKEN'),
], ],

View File

@ -55,7 +55,7 @@ return [
| |
*/ */
'automatic_localization' => false, 'automatic_localization' => false,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -79,7 +79,7 @@ return [
'enable_external_dependencies' => true, 'enable_external_dependencies' => true,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Show the timezone | Show the timezone
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -90,7 +90,7 @@ return [
'show_timezone' => false, 'show_timezone' => false,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Skip subscriber verifications | Skip subscriber verifications
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -101,7 +101,7 @@ return [
'skip_subscriber_verification' => false, 'skip_subscriber_verification' => false,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Only disrupted days | Only disrupted days
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -30,13 +30,13 @@ return [
* To trust one or more specific proxies that connect * To trust one or more specific proxies that connect
* directly to your server, use an array of IP addresses: * directly to your server, use an array of IP addresses:
*/ */
// 'proxies' => ['192.168.1.1'], // 'proxies' => ['192.168.1.1'],
/* /*
* Or, to trust all proxies that connect * Or, to trust all proxies that connect
* directly to your server, use a "*" * directly to your server, use a "*"
*/ */
// 'proxies' => '*', // 'proxies' => '*',
/* /*
* Which headers to use to detect proxy related data (For, Host, Proto, Port) * Which headers to use to detect proxy related data (For, Host, Proto, Port)

View File

@ -104,15 +104,15 @@ $factory->define(Schedule::class, function ($faker) {
$factory->define(Setting::class, function ($faker) { $factory->define(Setting::class, function ($faker) {
return [ return [
'name' => 'app_name', 'name' => 'app_name',
'value' => 'Cachet Test Demo', 'value' => 'Cachet Test Demo',
]; ];
}); });
$factory->define(Setting::class, function ($faker) { $factory->define(Setting::class, function ($faker) {
return [ return [
'name' => 'app_refresh_rate', 'name' => 'app_refresh_rate',
'value' => '0', 'value' => '0',
]; ];
}); });

View File

@ -24,8 +24,8 @@ use MailThief\Testing\InteractsWithMail;
*/ */
class ComponentStatusWasChangedEventTest extends AbstractComponentEventTestCase class ComponentStatusWasChangedEventTest extends AbstractComponentEventTestCase
{ {
use DatabaseMigrations, InteractsWithMail; use DatabaseMigrations;
use InteractsWithMail;
public function testComponentUpdateEmailWasSent() public function testComponentUpdateEmailWasSent()
{ {
$user = factory('CachetHQ\Cachet\Models\User')->create(); $user = factory('CachetHQ\Cachet\Models\User')->create();