1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Static analysis cleanup

This commit is contained in:
David Bomba 2023-08-01 20:30:47 +10:00
parent 11de046b9d
commit 25c67ff7ad
29 changed files with 65 additions and 157 deletions

View File

@ -59,33 +59,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction query()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope()
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereAccountType($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereAmount($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereBankAccountId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereBankIntegrationId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereBankTransactionRuleId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereBaseType($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereCategoryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereCategoryType($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereCompanyId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereCurrencyCode($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereCurrencyId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereExpenseId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereInvoiceIds($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereIsDeleted($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereNinjaCategoryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction wherePaymentId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereStatusId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereTransactionId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction whereVendorId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction withTrashed()
* @method static \Illuminate\Database\Eloquent\Account withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|BankTransaction withoutTrashed()
* @property-read \App\Models\Payment|null $payment
* @mixin \Eloquent
@ -176,7 +150,7 @@ class BankTransaction extends BaseModel
return $this->belongsTo(BankIntegration::class)->withTrashed();
}
public function account()
public function account(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Account::class)->withTrashed();
}

View File

@ -41,7 +41,7 @@ use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundExceptio
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel newQuery($query)
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel query()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude(array $excludeable)
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel withTrashed()
* @method static \Illuminate\Database\Eloquent\BaseModel withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scopeExclude($query)
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel find($value)
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel whereIn($query)
@ -52,7 +52,6 @@ use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundExceptio
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel service()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel orderBy($column, $direction)
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel invitations()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel createInvitations()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel whereHas($query)
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\InvoiceInvitation | \App\Models\CreditInvitation | \App\Models\QuoteInvitation | \App\Models\RecurringInvoiceInvitation> $invitations
* @property-read int|null $invitations_count

View File

@ -237,6 +237,7 @@ class Company extends BaseModel
// const ENTITY_RECURRING_QUOTE = 'recurring_quote';
/** @var CompanyPresenter */
protected $presenter = CompanyPresenter::class;
protected array $tax_coverage_countries = [

View File

@ -76,7 +76,7 @@ class CompanyToken extends BaseModel
return $this->belongsTo(User::class);
}
public function company()
public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Company::class);
}

View File

@ -71,10 +71,10 @@ use App\Events\Invoice\InvoiceReminderWasEmailed;
* @property string|null $custom_value3
* @property string|null $custom_value4
* @property string|null $next_send_date
* @property string|null $custom_surcharge1
* @property string|null $custom_surcharge2
* @property string|null $custom_surcharge3
* @property string|null $custom_surcharge4
* @property float|null $custom_surcharge1
* @property float|null $custom_surcharge2
* @property float|null $custom_surcharge3
* @property float|null $custom_surcharge4
* @property bool $custom_surcharge_tax1
* @property bool $custom_surcharge_tax2
* @property bool $custom_surcharge_tax3
@ -155,7 +155,7 @@ class Invoice extends BaseModel
use MakesReminders;
use ActionsInvoice;
protected $presenter = InvoicePresenter::class;
// protected $presenter = InvoicePresenter::class;
protected $touches = [];
@ -720,6 +720,8 @@ class Invoice extends BaseModel
public function taxTypeString($id)
{
$tax_type = false;
match(intval($id)){
Product::PRODUCT_TYPE_PHYSICAL => $tax_type = ctrans('texts.physical_goods'),
Product::PRODUCT_TYPE_SERVICE => $tax_type = ctrans('texts.services'),
@ -738,6 +740,7 @@ class Invoice extends BaseModel
public function typeIdString($id)
{
$type = '';
match($id) {
'1' => $type = ctrans('texts.product'),
'2' => $type = ctrans('texts.service'),

View File

@ -252,7 +252,7 @@ class Payment extends BaseModel
return $this->belongsTo(Currency::class);
}
public function transaction(): BelongsTo
public function transaction()
{
return $this->belongsTo(BankTransaction::class);
}

View File

@ -17,13 +17,16 @@ use Illuminate\Support\Str;
/**
* Class CompanyPresenter.
* @property \App\DataMapper\CompanySettings $settings
*/
class CompanyPresenter extends EntityPresenter
{
/**
* @return string
*/
public function name()
public function name(): string
{
return $this->settings->name ?: ctrans('texts.untitled_account');
}

View File

@ -16,6 +16,10 @@ use Laracasts\Presenter\Presenter;
/**
* Class EntityPresenter.
*
* @property \App\Models\Company | \App\Models\Client | \App\Models\ClientContact | \App\Models\Vendor | \App\Models\VendorContact $entity
* @property \App\Models\Client $client
* @property \App\Models\Company $company
*/
class EntityPresenter extends Presenter
{

View File

@ -23,6 +23,8 @@ use App\Utils\Traits\MakesDates;
*
* Shortcuts to other presenters are here to facilitate
* a clean UI / UX
*
* @property \App\Models\Invoice $entity
*/
class InvoicePresenter extends EntityPresenter
{

View File

@ -67,7 +67,7 @@ class EntitySentNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -67,7 +67,7 @@ class EntityViewedNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{
@ -103,7 +103,7 @@ class EntityViewedNotification extends Notification
$this->entity_name => $this->entity->number,
]
))
->attachment(function ($attachment) use ($amount) {
->attachment(function ($attachment) {
$attachment->title(ctrans('texts.entity_number_placeholder', ['entity' => ucfirst($this->entity_name), 'entity_number' => $this->entity->number]), $this->invitation->getAdminLink())
->fields([
ctrans('texts.client') => $this->contact->present()->name(),
@ -112,30 +112,30 @@ class EntityViewedNotification extends Notification
});
}
private function buildDataArray()
{
$amount = Number::formatMoney($this->entity->amount, $this->entity->client);
// private function buildDataArray()
// {
// $amount = Number::formatMoney($this->entity->amount, $this->entity->client);
$data = [
'title' => $this->buildSubject(),
'message' => ctrans(
"texts.notification_{$this->entity_name}_viewed",
[
'amount' => $amount,
'client' => $this->contact->present()->name(),
$this->entity_name => $this->entity->number,
]
),
'url' => $this->invitation->getAdminLink(),
'button' => ctrans("texts.view_{$this->entity_name}"),
'signature' => $this->settings->email_signature,
'logo' => $this->company->present()->logo(),
'settings' => $this->settings,
// $data = [
// 'title' => $this->buildSubject(),
// 'message' => ctrans(
// "texts.notification_{$this->entity_name}_viewed",
// [
// 'amount' => $amount,
// 'client' => $this->contact->present()->name(),
// $this->entity_name => $this->entity->number,
// ]
// ),
// 'url' => $this->invitation->getAdminLink(),
// 'button' => ctrans("texts.view_{$this->entity_name}"),
// 'signature' => $this->settings->email_signature,
// 'logo' => $this->company->present()->logo(),
// 'settings' => $this->settings,
];
// ];
return $data;
}
// return $data;
// }
private function buildSubject()
{

View File

@ -57,7 +57,7 @@ class NewPaymentNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -63,7 +63,7 @@ class ClientContactRequestCancellation extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -63,7 +63,7 @@ class ClientContactResetPassword extends Notification
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -57,7 +57,7 @@ class NewAccountCreated extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -42,7 +42,7 @@ class ClientAccountNotFound extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -45,7 +45,7 @@ class DomainFailureNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -45,7 +45,7 @@ class DomainRenewalFailureNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -44,7 +44,7 @@ class EmailBounceNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -44,7 +44,7 @@ class EmailQuotaNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -44,7 +44,7 @@ class GmailCredentialNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -57,7 +57,7 @@ class NewAccountCreated extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -50,7 +50,7 @@ class NewAccountNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -42,7 +42,7 @@ class RenewalFailureNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -45,7 +45,7 @@ class SpamNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -49,7 +49,7 @@ class UserQualityNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -1,78 +0,0 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Notifications\Ninja;
use Illuminate\Bus\Queueable;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
//@deprecated
class VerifyUser extends Notification
{
// use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new notification instance.
*
* @return void
*/
protected $user;
private $company;
public function __construct($user, $company)
{
$this->user = $user;
$this->company = $company;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [''];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*/
public function toMail($notifiable)
{
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
public function toSlack($notifiable)
{
}
}

View File

@ -44,7 +44,7 @@ class WePayFailureNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{

View File

@ -38,7 +38,7 @@ class ResetPasswordNotification extends Notification
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*
*/
public function toMail($notifiable)
{