Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static analysis clean up #8827

Merged
merged 2 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 27 additions & 26 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@

namespace App\Http\Controllers\Auth;

use Google_Client;
use App\DataMapper\Analytics\LoginFailure;
use App\DataMapper\Analytics\LoginSuccess;
use App\Events\User\UserLoggedIn;
use App\Http\Controllers\BaseController;
use App\Http\Requests\Login\LoginRequest;
use App\Jobs\Account\CreateAccount;
use App\Jobs\Company\CreateCompanyToken;
use App\Libraries\MultiDB;
use App\Libraries\OAuth\OAuth;
use App\Libraries\OAuth\Providers\Google;
use App\Models\Account;
use App\Models\CompanyToken;
use App\Models\CompanyUser;
use App\Models\User;
use App\Transformers\CompanyUserTransformer;
use App\Utils\Ninja;
use App\Models\Account;
use App\Libraries\MultiDB;
use App\Utils\Traits\User\LoginCache;
use App\Utils\Traits\UserSessionAttributes;
use App\Utils\TruthSource;
use Microsoft\Graph\Model;
use App\Models\CompanyUser;
use App\Models\CompanyToken;
use Illuminate\Http\Request;
use App\Libraries\OAuth\OAuth;
use App\Events\User\UserLoggedIn;
use Google_Client;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\JsonResponse;
use PragmaRX\Google2FA\Google2FA;
use App\Jobs\Account\CreateAccount;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Utils\Traits\User\LoginCache;
use Illuminate\Support\Facades\Cache;
use Turbo124\Beacon\Facades\LightLogs;
use App\Http\Controllers\BaseController;
use App\Jobs\Company\CreateCompanyToken;
use Illuminate\Support\Facades\Response;
use Laravel\Socialite\Facades\Socialite;
use App\Http\Requests\Login\LoginRequest;
use App\Libraries\OAuth\Providers\Google;
use Illuminate\Database\Eloquent\Builder;
use App\DataMapper\Analytics\LoginFailure;
use App\DataMapper\Analytics\LoginSuccess;
use App\Utils\Traits\UserSessionAttributes;
use App\Transformers\CompanyUserTransformer;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Microsoft\Graph\Model;
use PragmaRX\Google2FA\Google2FA;
use Turbo124\Beacon\Facades\LightLogs;

class LoginController extends BaseController
{
Expand Down Expand Up @@ -418,7 +418,7 @@ private function handleMicrosoftOauth()
->setReturnType(Model\User::class)
->execute();

nlog($user);
nlog($user);

if ($user) {
$account = request()->input('account');
Expand Down Expand Up @@ -641,8 +641,9 @@ public function redirectToProvider(string $provider)
$parameters = ['response_type' => 'code', 'redirect_uri' => config('ninja.app_url') . "/auth/microsoft"];
}

if(request()->hasHeader('X-REACT') || request()->query('react'))
if(request()->hasHeader('X-REACT') || request()->query('react')) {
Cache::put("react_redir:".auth()->user()?->account->key, 'true', 300);
}

if (request()->has('code')) {
return $this->handleProviderCallback($provider);
Expand Down Expand Up @@ -699,7 +700,7 @@ public function handleProviderCallback(string $provider)
$request_from_react = Cache::pull("react_redir:".auth()->user()?->account?->key);

// if($request_from_react)
$redirect_url = config('ninja.react_url')."/#/settings/user_details/connect";
$redirect_url = config('ninja.react_url')."/#/settings/user_details/connect";

return redirect($redirect_url);
}
Expand Down
5 changes: 3 additions & 2 deletions app/Jobs/Cron/UpdateCalculatedFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,16 @@ private function calculateDuration($project): int

$project->tasks->each(function ($task) use (&$duration) {


foreach(json_decode($task->time_log) as $log){
if(is_iterable($task->time_log)) {
foreach(json_decode($task->time_log) as $log) {

$start_time = $log[0];
$end_time = $log[1] == 0 ? time() : $log[1];

$duration += $end_time - $start_time;

}
}

});

Expand Down
1 change: 1 addition & 0 deletions app/PaymentDrivers/Stripe/ACH.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ public function paymentIntentTokenBilling($amount, $description, $cgt, $client_p

switch ($e) {
case $e instanceof CardException:
/** @var CardException $e */
$data['status'] = $e->getHttpStatus();
$data['error_type'] = $e->getError()->type;
$data['error_code'] = $e->getError()->code;
Expand Down
4 changes: 3 additions & 1 deletion app/PaymentDrivers/Stripe/Alipay.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public function paymentResponse(PaymentResponseRequest $request)
return $this->processSuccesfulRedirect($pi);
}

if ($pi->status == 'requires_source_action') {
/** @phpstan-ignore-next-line */
if ($pi->status == 'requires_source_action' && $pi->next_action->alipay_handle_redirect) {
/** @phpstan-ignore-next-line */
return redirect($pi->next_action->alipay_handle_redirect->url);
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/PaymentDrivers/Stripe/ImportCustomers.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private function addCustomer(Customer $customer)
$client->address2 = $customer->address->line2 ? $customer->address->line2 : '';
$client->city = $customer->address->city ? $customer->address->city : '';
$client->state = $customer->address->state ? $customer->address->state : '';
$client->phone = $customer->address->phone ? $customer->phone : '';
$client->phone = $customer->phone ?? '';

if ($customer->address->country) {
$country = Country::query()->where('iso_3166_2', $customer->address->country)->first();
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ parameters:
universalObjectCratesClasses:
- App\DataMapper\Tax\RuleInterface
- App\DataMapper\FeesAndLimits
- \Postmark\Models\DynamicResponseModel
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- '#Array has 2 duplicate keys with value#'
Expand Down