Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
[ci skip] [skip ci]
  • Loading branch information
joelbutcher authored and StyleCIBot committed Oct 23, 2023
1 parent c3caf17 commit de9473b
Show file tree
Hide file tree
Showing 83 changed files with 477 additions and 469 deletions.
4 changes: 2 additions & 2 deletions config/filament.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

return [
'middleware' => ['web'],
'prompt' => 'Or Login Via',
'providers' => [
'prompt' => 'Or Login Via',
'providers' => [
// Providers::github(),
],
'component' => 'socialstream::components.socialstream',
Expand Down
4 changes: 2 additions & 2 deletions config/socialstream.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

return [
'middleware' => ['web'],
'prompt' => 'Or Login Via',
'providers' => [
'prompt' => 'Or Login Via',
'providers' => [
// Providers::github(),
],
'features' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class() extends Migration {
/**
* Run the migrations.
*/
Expand Down
3 changes: 1 addition & 2 deletions database/migrations/2014_10_12_000000_create_users_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class() extends Migration {
/**
* Run the migrations.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class() extends Migration {
/**
* Run the migrations.
*/
Expand Down
25 changes: 13 additions & 12 deletions src/Actions/Auth/Breeze/Blade/AuthenticateOAuthCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
$account = Socialstream::findConnectedAccountForProviderAndId($provider, $providerAccount->getId());

// Authenticated...
if (! is_null($user = auth()->user())) {
if (!is_null($user = auth()->user())) {
return $this->alreadyAuthenticated($user, $account, $provider, $providerAccount);
}

Expand All @@ -56,8 +56,8 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
return $this->register($provider, $providerAccount);
}

if (! Features::hasCreateAccountOnFirstLoginFeatures() && ! $account) {
$messageBag = new MessageBag;
if (!Features::hasCreateAccountOnFirstLoginFeatures() && !$account) {
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('An account with this :Provider sign in was not found. Please register or try a different sign in method.', ['provider' => Providers::name($provider)])
Expand All @@ -68,9 +68,9 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
);
}

if (Features::hasCreateAccountOnFirstLoginFeatures() && ! $account) {
if (Features::hasCreateAccountOnFirstLoginFeatures() && !$account) {
if (Socialstream::newUserModel()->where('email', $providerAccount->getEmail())->exists()) {
$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('An account with that email address already exists. Please login to connect your :Provider account.', ['provider' => Providers::name($provider)])
Expand Down Expand Up @@ -99,11 +99,12 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
protected function alreadyAuthenticated(Authenticatable $user, ?ConnectedAccount $account, string $provider, ProviderUser $providerAccount): RedirectResponse
{
// Connect the account to the user.
if (! $account) {
if (!$account) {
$this->createsConnectedAccounts->create($user, $provider, $providerAccount);

return redirect()->route('profile.edit')->with(
'status', __('You have successfully connected :Provider to your account.', ['provider' => Providers::name($provider)])
'status',
__('You have successfully connected :Provider to your account.', ['provider' => Providers::name($provider)])
);
}

Expand All @@ -126,14 +127,14 @@ protected function alreadyRegistered(Authenticatable $user, ?ConnectedAccount $a
{
if (Features::hasLoginOnRegistrationFeatures()) {
// The user exists, but they're not registered with the given provider.
if (! $account) {
if (!$account) {
$this->createsConnectedAccounts->create($user, $provider, $providerAccount);
}

return $this->login($user);
}

$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add('socialstream', __('An account with that :Provider sign in already exists, please login.', ['provider' => Providers::name($provider)]));

return redirect()->route('login')->withErrors($messageBag);
Expand All @@ -144,8 +145,8 @@ protected function alreadyRegistered(Authenticatable $user, ?ConnectedAccount $a
*/
protected function register(string $provider, ProviderUser $providerAccount): RedirectResponse
{
if (! $providerAccount->getEmail()) {
$messageBag = new MessageBag;
if (!$providerAccount->getEmail()) {
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('No email address is associated with this :Provider account. Please try a different account.', ['provider' => Providers::name($provider)])
Expand All @@ -155,7 +156,7 @@ protected function register(string $provider, ProviderUser $providerAccount): Re
}

if (Socialstream::newUserModel()->where('email', $providerAccount->getEmail())->exists()) {
$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('An account with that email address already exists. Please login to connect your :Provider account.', ['provider' => Providers::name($provider)])
Expand Down
4 changes: 2 additions & 2 deletions src/Actions/Auth/Breeze/HandleOAuthCallbackErrors.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class HandleOAuthCallbackErrors implements HandlesOAuthCallbackErrors
*/
public function handle(Request $request): ?RedirectResponse
{
if (! $request->has('error')) {
if (!$request->has('error')) {
return null;
}

$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add('socialstream', $request->get('error_description'));

return auth()->check()
Expand Down
33 changes: 17 additions & 16 deletions src/Actions/Auth/Breeze/Livewire/AuthenticateOAuthCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
$account = Socialstream::findConnectedAccountForProviderAndId($provider, $providerAccount->getId());

// Authenticated...
if (! is_null($user = auth()->user())) {
if (!is_null($user = auth()->user())) {
return $this->alreadyAuthenticated($user, $account, $provider, $providerAccount);
}

Expand All @@ -56,8 +56,8 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
return $this->register($provider, $providerAccount);
}

if (! Features::hasCreateAccountOnFirstLoginFeatures() && ! $account) {
$messageBag = new MessageBag;
if (!Features::hasCreateAccountOnFirstLoginFeatures() && !$account) {
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('An account with this :Provider sign in was not found. Please register or try a different sign in method.', ['provider' => Providers::name($provider)])
Expand All @@ -68,9 +68,9 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
);
}

if (Features::hasCreateAccountOnFirstLoginFeatures() && ! $account) {
if (Features::hasCreateAccountOnFirstLoginFeatures() && !$account) {
if (Socialstream::newUserModel()->where('email', $providerAccount->getEmail())->exists()) {
$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('An account with that email address already exists. Please login to connect your :Provider account.', ['provider' => Providers::name($provider)])
Expand All @@ -86,8 +86,8 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
return $this->login($user);
}

if (! Features::hasCreateAccountOnFirstLoginFeatures() && ! $account) {
$messageBag = new MessageBag;
if (!Features::hasCreateAccountOnFirstLoginFeatures() && !$account) {
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('An account with this :Provider sign in was not found. Please register or try a different sign in method.', ['provider' => Providers::name($provider)])
Expand All @@ -98,9 +98,9 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
);
}

if (Features::hasCreateAccountOnFirstLoginFeatures() && ! $account) {
if (Features::hasCreateAccountOnFirstLoginFeatures() && !$account) {
if (Socialstream::newUserModel()->where('email', $providerAccount->getEmail())->exists()) {
$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('An account with that email address already exists. Please login to connect your :Provider account.', ['provider' => Providers::name($provider)])
Expand Down Expand Up @@ -129,11 +129,12 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
protected function alreadyAuthenticated(Authenticatable $user, ?ConnectedAccount $account, string $provider, ProviderUser $providerAccount): RedirectResponse
{
// Connect the account to the user.
if (! $account) {
if (!$account) {
$this->createsConnectedAccounts->create($user, $provider, $providerAccount);

return redirect()->route('profile')->with(
'status', __('You have successfully connected :Provider to your account.', ['provider' => Providers::name($provider)])
'status',
__('You have successfully connected :Provider to your account.', ['provider' => Providers::name($provider)])
);
}

Expand All @@ -156,14 +157,14 @@ protected function alreadyRegistered(Authenticatable $user, ?ConnectedAccount $a
{
if (Features::hasLoginOnRegistrationFeatures()) {
// The user exists, but they're not registered with the given provider.
if (! $account) {
if (!$account) {
$this->createsConnectedAccounts->create($user, $provider, $providerAccount);
}

return $this->login($user);
}

$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add('socialstream', __('An account with that :Provider sign in already exists, please login.', ['provider' => Providers::name($provider)]));

return redirect()->route('login')->withErrors($messageBag);
Expand All @@ -174,8 +175,8 @@ protected function alreadyRegistered(Authenticatable $user, ?ConnectedAccount $a
*/
protected function register(string $provider, ProviderUser $providerAccount): RedirectResponse
{
if (! $providerAccount->getEmail()) {
$messageBag = new MessageBag;
if (!$providerAccount->getEmail()) {
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('No email address is associated with this :Provider account. Please try a different account.', ['provider' => Providers::name($provider)])
Expand All @@ -185,7 +186,7 @@ protected function register(string $provider, ProviderUser $providerAccount): Re
}

if (Socialstream::newUserModel()->where('email', $providerAccount->getEmail())->exists()) {
$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('An account with that email address already exists. Please login to connect your :Provider account.', ['provider' => Providers::name($provider)])
Expand Down
2 changes: 1 addition & 1 deletion src/Actions/Auth/Filament/AuthenticateOAuthCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
{
$user = auth()->user();

if (! $user) {
if (!$user) {
$user = Socialstream::newUserModel()->where('email', $providerAccount->getEmail())->first()
?? $this->createsUser->create($provider, $providerAccount);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Actions/Auth/Filament/HandleOAuthCallbackErrors.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class HandleOAuthCallbackErrors implements HandlesOAuthCallbackErrors
*/
public function handle(Request $request): ?RedirectResponse
{
if (! $request->has('error')) {
if (!$request->has('error')) {
return null;
}

$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add('socialstream', $request->get('error_description'));

return auth()->check()
Expand Down
24 changes: 12 additions & 12 deletions src/Actions/Auth/Jetstream/AuthenticateOAuthCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
$account = Socialstream::findConnectedAccountForProviderAndId($provider, $providerAccount->getId());

// Authenticated...
if (! is_null($user = auth()->user())) {
if (!is_null($user = auth()->user())) {
return $this->alreadyAuthenticated($user, $account, $provider, $providerAccount);
}

// Registration...
$previousUrl = session()->get('socialstream.previous_url');

if (
FortifyFeatures::enabled(FortifyFeatures::registration()) && ! $account &&
FortifyFeatures::enabled(FortifyFeatures::registration()) && !$account &&
(
$previousUrl === route('register') ||
(Features::hasCreateAccountOnFirstLoginFeatures() && $previousUrl === route('login'))
Expand All @@ -61,8 +61,8 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
return $this->register($provider, $providerAccount);
}

if (! Features::hasCreateAccountOnFirstLoginFeatures() && ! $account) {
$messageBag = new MessageBag;
if (!Features::hasCreateAccountOnFirstLoginFeatures() && !$account) {
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('An account with this :Provider sign in was not found. Please register or try a different sign in method.', ['provider' => Providers::name($provider)])
Expand All @@ -73,9 +73,9 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
);
}

if (Features::hasCreateAccountOnFirstLoginFeatures() && ! $account) {
if (Features::hasCreateAccountOnFirstLoginFeatures() && !$account) {
if (Socialstream::newUserModel()->where('email', $providerAccount->getEmail())->exists()) {
$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('An account with that email address already exists. Please login to connect your :Provider account.', ['provider' => Providers::name($provider)])
Expand Down Expand Up @@ -104,7 +104,7 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R
protected function alreadyAuthenticated(Authenticatable $user, ?ConnectedAccount $account, string $provider, ProviderUser $providerAccount): RedirectResponse
{
// Connect the account to the user.
if (! $account) {
if (!$account) {
$this->createsConnectedAccounts->create($user, $provider, $providerAccount);

return redirect()->route('profile.show')->banner(
Expand All @@ -131,14 +131,14 @@ protected function alreadyRegistered(Authenticatable $user, ?ConnectedAccount $a
{
if (Features::hasLoginOnRegistrationFeatures()) {
// The user exists, but they're not registered with the given provider.
if (! $account) {
if (!$account) {
$this->createsConnectedAccounts->create($user, $provider, $providerAccount);
}

return $this->login($user);
}

$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add('socialstream', __('An account with that :Provider sign in already exists, please login.', ['provider' => Providers::buttonLabel($provider)]));

return redirect()->route('login')->withErrors($messageBag);
Expand All @@ -149,8 +149,8 @@ protected function alreadyRegistered(Authenticatable $user, ?ConnectedAccount $a
*/
protected function register(string $provider, ProviderUser $providerAccount): RedirectResponse|LoginResponse
{
if (! $providerAccount->getEmail()) {
$messageBag = new MessageBag;
if (!$providerAccount->getEmail()) {
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('No email address is associated with this :Provider account. Please try a different account.', ['provider' => Providers::buttonLabel($provider)])
Expand All @@ -160,7 +160,7 @@ protected function register(string $provider, ProviderUser $providerAccount): Re
}

if (Socialstream::newUserModel()->where('email', $providerAccount->getEmail())->exists()) {
$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add(
'socialstream',
__('An account with that email address already exists. Please login to connect your :Provider account.', ['provider' => Providers::buttonLabel($provider)])
Expand Down
4 changes: 2 additions & 2 deletions src/Actions/Auth/Jetstream/HandleOAuthCallbackErrors.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class HandleOAuthCallbackErrors implements HandlesOAuthCallbackErrors
*/
public function handle(Request $request): ?RedirectResponse
{
if (! $request->has('error')) {
if (!$request->has('error')) {
return null;
}

$messageBag = new MessageBag;
$messageBag = new MessageBag();
$messageBag->add('socialstream', $request->get('error_description'));

return auth()->check()
Expand Down
Loading

0 comments on commit de9473b

Please sign in to comment.