Static analysis cleanup

This commit is contained in:
David Bomba 2023-07-25 20:04:04 +10:00
parent 8e22cff9ae
commit 90fdfedacb
33 changed files with 115 additions and 153 deletions

View File

@ -37,7 +37,6 @@ class AccountCreated extends GenericCounter
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;

View File

@ -37,7 +37,6 @@ class AccountDeleted extends GenericCounter
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;

View File

@ -37,7 +37,6 @@ class AccountPlatform extends GenericMixedMetric
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;

View File

@ -37,7 +37,6 @@ class AccountSignup extends GenericMixedMetric
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;
@ -61,7 +60,7 @@ class AccountSignup extends GenericMixedMetric
* The counter * The counter
* set to 1. * set to 1.
* *
* @var string * @var int
*/ */
public $int_metric1 = 1; public $int_metric1 = 1;

View File

@ -37,7 +37,6 @@ class BankAccountsCreated extends GenericMixedMetric
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;

View File

@ -37,7 +37,6 @@ class DbQuery extends GenericMixedMetric
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;
@ -57,7 +56,7 @@ class DbQuery extends GenericMixedMetric
* The counter * The counter
* set to 1. * set to 1.
* *
* @var string * @var int
*/ */
public $int_metric1 = 1; public $int_metric1 = 1;

View File

@ -37,7 +37,6 @@ class EmailCount extends GenericMixedMetric
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;

View File

@ -37,7 +37,6 @@ class EmailFailure extends GenericMixedMetric
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;
@ -61,7 +60,6 @@ class EmailFailure extends GenericMixedMetric
* The counter * The counter
* set to 1. * set to 1.
* *
* @var string
*/ */
public $int_metric1 = 1; public $int_metric1 = 1;

View File

@ -37,7 +37,6 @@ class EmailInvoiceFailure extends GenericMixedMetric
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;

View File

@ -37,7 +37,6 @@ class EmailSuccess extends GenericMixedMetric
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;
@ -61,7 +60,6 @@ class EmailSuccess extends GenericMixedMetric
* The counter * The counter
* set to 1. * set to 1.
* *
* @var string
*/ */
public $int_metric1 = 1; public $int_metric1 = 1;

View File

@ -37,7 +37,6 @@ class LivePreview extends GenericCounter
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;

View File

@ -37,7 +37,6 @@ class LoginFailure extends GenericCounter
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;

View File

@ -37,7 +37,6 @@ class LoginSuccess extends GenericCounter
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;

View File

@ -37,7 +37,6 @@ class EmailBounce extends GenericMixedMetric
* *
* date("Y-m-d H:i:s") * date("Y-m-d H:i:s")
* *
* @var \DateTime
*/ */
public $datetime; public $datetime;
@ -67,7 +66,6 @@ class EmailBounce extends GenericMixedMetric
* The counter * The counter
* set to 1. * set to 1.
* *
* @var string
*/ */
public $int_metric1 = 1; public $int_metric1 = 1;

View File

@ -16,13 +16,13 @@ namespace App\DataMapper;
*/ */
class BaseSettings class BaseSettings
{ {
//@deprecated // //@deprecated
public function __construct($obj) // public function __construct($obj)
{ // {
// foreach ($obj as $key => $value) { // // foreach ($obj as $key => $value) {
// $obj->{$key} = $value; // // $obj->{$key} = $value;
// } // // }
} // }
public static function setCasts($obj, $casts) public static function setCasts($obj, $casts)
{ {

View File

@ -47,17 +47,17 @@ class ClientSettings extends BaseSettings
'send_reminders' => 'bool', 'send_reminders' => 'bool',
]; ];
/** // /**
* Cast object values and return entire class // * Cast object values and return entire class
* prevents missing properties from not being returned // * prevents missing properties from not being returned
* and always ensure an up to date class is returned. // * and always ensure an up to date class is returned.
* // *
* @param $obj // * @param $obj
*/ // */
public function __construct($obj) // public function __construct($obj)
{ // {
parent::__construct($obj); // // parent::__construct($obj);
} // }
/** /**
* Default Client Settings scaffold. * Default Client Settings scaffold.
@ -78,8 +78,8 @@ class ClientSettings extends BaseSettings
/** /**
* Merges settings from Company to Client. * Merges settings from Company to Client.
* *
* @param stdClass $company_settings * @param $company_settings
* @param stdClass $client_settings * @param $client_settings
* @return stdClass of merged settings * @return stdClass of merged settings
*/ */
public static function buildClientSettings($company_settings, $client_settings) public static function buildClientSettings($company_settings, $client_settings)

View File

@ -767,18 +767,18 @@ class CompanySettings extends BaseSettings
'purchase_order_design_id', 'purchase_order_design_id',
]; ];
/** // /**
* Cast object values and return entire class // * Cast object values and return entire class
* prevents missing properties from not being returned // * prevents missing properties from not being returned
* and always ensure an up to date class is returned. // * and always ensure an up to date class is returned.
* // *
* @param $obj // * @param $obj
* @deprecated // * @deprecated
*/ // */
public function __construct() // public function __construct()
{ // {
// parent::__construct($obj); // // parent::__construct($obj);
} // }
/** /**
* Provides class defaults on init. * Provides class defaults on init.

View File

@ -34,13 +34,4 @@ class DefaultSettings extends BaseSettings
]; ];
} }
/** }
* @return stdClass
*/
private static function userSettingsObject() : stdClass
{
return (object) [
// 'per_page' => self::$per_page,
];
}
}

View File

@ -24,92 +24,78 @@ class EmailTemplateDefaults
case 'email_template_invoice': case 'email_template_invoice':
return self::emailInvoiceTemplate(); return self::emailInvoiceTemplate();
break;
case 'email_template_quote': case 'email_template_quote':
return self::emailQuoteTemplate(); return self::emailQuoteTemplate();
break;
case 'email_template_credit': case 'email_template_credit':
return self::emailCreditTemplate(); return self::emailCreditTemplate();
break;
case 'email_template_payment': case 'email_template_payment':
return self::emailPaymentTemplate(); return self::emailPaymentTemplate();
break;
case 'email_template_payment_partial': case 'email_template_payment_partial':
return self::emailPaymentPartialTemplate(); return self::emailPaymentPartialTemplate();
break;
case 'email_template_statement': case 'email_template_statement':
return self::emailStatementTemplate(); return self::emailStatementTemplate();
break;
case 'email_template_reminder1': case 'email_template_reminder1':
return self::emailReminder1Template(); return self::emailReminder1Template();
break;
case 'email_template_reminder2': case 'email_template_reminder2':
return self::emailReminder2Template(); return self::emailReminder2Template();
break;
case 'email_template_reminder3': case 'email_template_reminder3':
return self::emailReminder3Template(); return self::emailReminder3Template();
break;
case 'email_template_reminder_endless': case 'email_template_reminder_endless':
return self::emailReminderEndlessTemplate(); return self::emailReminderEndlessTemplate();
break;
case 'email_template_custom1': case 'email_template_custom1':
return self::emailInvoiceTemplate(); return self::emailInvoiceTemplate();
break;
case 'email_template_custom2': case 'email_template_custom2':
return self::emailInvoiceTemplate(); return self::emailInvoiceTemplate();
break;
case 'email_template_custom3': case 'email_template_custom3':
return self::emailInvoiceTemplate(); return self::emailInvoiceTemplate();
case 'email_template_purchase_order': case 'email_template_purchase_order':
return self::emailPurchaseOrderTemplate(); return self::emailPurchaseOrderTemplate();
break;
/* Subject */ /* Subject */
case 'email_subject_purchase_order': case 'email_subject_purchase_order':
return self::emailPurchaseOrderSubject(); return self::emailPurchaseOrderSubject();
case 'email_subject_invoice': case 'email_subject_invoice':
return self::emailInvoiceSubject(); return self::emailInvoiceSubject();
break;
case 'email_subject_quote': case 'email_subject_quote':
return self::emailQuoteSubject(); return self::emailQuoteSubject();
break;
case 'email_subject_credit': case 'email_subject_credit':
return self::emailCreditSubject(); return self::emailCreditSubject();
break;
case 'email_subject_payment': case 'email_subject_payment':
return self::emailPaymentSubject(); return self::emailPaymentSubject();
break;
case 'email_subject_payment_partial': case 'email_subject_payment_partial':
return self::emailPaymentPartialSubject(); return self::emailPaymentPartialSubject();
break;
case 'email_subject_statement': case 'email_subject_statement':
return self::emailStatementSubject(); return self::emailStatementSubject();
break;
case 'email_subject_reminder1': case 'email_subject_reminder1':
return self::emailReminder1Subject(); return self::emailReminder1Subject();
break;
case 'email_subject_reminder2': case 'email_subject_reminder2':
return self::emailReminder2Subject(); return self::emailReminder2Subject();
break;
case 'email_subject_reminder3': case 'email_subject_reminder3':
return self::emailReminder3Subject(); return self::emailReminder3Subject();
break;
case 'email_subject_reminder_endless': case 'email_subject_reminder_endless':
return self::emailReminderEndlessSubject(); return self::emailReminderEndlessSubject();
break;
case 'email_subject_custom1': case 'email_subject_custom1':
return self::emailInvoiceSubject(); return self::emailInvoiceSubject();
break;
case 'email_subject_custom2': case 'email_subject_custom2':
return self::emailInvoiceSubject(); return self::emailInvoiceSubject();
break;
case 'email_subject_custom3': case 'email_subject_custom3':
return self::emailInvoiceSubject(); return self::emailInvoiceSubject();
break;
default: default:
return self::emailInvoiceTemplate(); return self::emailInvoiceTemplate();
break;
} }
} }

View File

@ -141,7 +141,6 @@ class FreeCompanySettings extends BaseSettings
public static $casts = [ public static $casts = [
'portal_design_id' => 'string', 'portal_design_id' => 'string',
'currency_id' => 'string',
'task_number_pattern' => 'string', 'task_number_pattern' => 'string',
'task_number_counter' => 'int', 'task_number_counter' => 'int',
'expense_number_pattern' => 'string', 'expense_number_pattern' => 'string',
@ -191,16 +190,16 @@ class FreeCompanySettings extends BaseSettings
'website' => 'string', 'website' => 'string',
]; ];
/** // /**
* Cast object values and return entire class // * Cast object values and return entire class
* prevents missing properties from not being returned // * prevents missing properties from not being returned
* and always ensure an up to date class is returned. // * and always ensure an up to date class is returned.
* // *
* @param $obj // * @param $obj
*/ // */
public function __construct($obj) // public function __construct($obj)
{ // {
} // }
/** /**
* Provides class defaults on init. * Provides class defaults on init.
@ -223,7 +222,7 @@ class FreeCompanySettings extends BaseSettings
$data->date_format_id = (string) config('ninja.i18n.date_format_id'); $data->date_format_id = (string) config('ninja.i18n.date_format_id');
$data->country_id = (string) config('ninja.i18n.country_id'); $data->country_id = (string) config('ninja.i18n.country_id');
$data->translations = (object) []; $data->translations = (object) [];
$data->pdf_variables = (object) self::getEntityVariableDefaults(); // $data->pdf_variables = (object) self::getEntityVariableDefaults();
return self::setCasts($data, self::$casts); return self::setCasts($data, self::$casts);
} }

View File

@ -197,7 +197,7 @@ class BaseRule implements RuleInterface
} }
/** If we are in a Origin based state, force the company tax here */ /** If we are in a Origin based state, force the company tax here */
if($company->origin_tax_data?->originDestination == 'O' && ($company->tax_data?->seller_subregion == $this->client_subregion)) { if($company->origin_tax_data->originDestination == 'O' && ($company->tax_data?->seller_subregion == $this->client_subregion)) {
$tax_data = $company->origin_tax_data; $tax_data = $company->origin_tax_data;

View File

@ -33859,8 +33859,6 @@ class USStates
'99926' => 'AK', '99926' => 'AK',
'99927' => 'AK', '99927' => 'AK',
'99929' => 'AK', '99929' => 'AK',
'13021' => 'NY',
'13024' => 'NY',
]; ];
public static function get(): array public static function get(): array

View File

@ -30,7 +30,7 @@ class DesignWasCreated
/** /**
* Get the channels the event should broadcast on. * Get the channels the event should broadcast on.
* *
* @return PrivateChannel * @return PrivateChannel|array
*/ */
public function broadcastOn() public function broadcastOn()
{ {

View File

@ -30,7 +30,7 @@ class DesignWasDeleted
/** /**
* Get the channels the event should broadcast on. * Get the channels the event should broadcast on.
* *
* @return PrivateChannel * @return PrivateChannel|array
*/ */
public function broadcastOn() public function broadcastOn()
{ {

View File

@ -30,7 +30,7 @@ class DesignWasRestored
/** /**
* Get the channels the event should broadcast on. * Get the channels the event should broadcast on.
* *
* @return PrivateChannel * @return PrivateChannel|array
*/ */
public function broadcastOn() public function broadcastOn()
{ {

View File

@ -30,7 +30,7 @@ class DesignWasUpdated
/** /**
* Get the channels the event should broadcast on. * Get the channels the event should broadcast on.
* *
* @return PrivateChannel * @return PrivateChannel|array
*/ */
public function broadcastOn() public function broadcastOn()
{ {

View File

@ -17,8 +17,10 @@ use App\Utils\Ninja;
use Sentry\State\Scope; use Sentry\State\Scope;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use InvalidArgumentException;
use Sentry\Laravel\Integration; use Sentry\Laravel\Integration;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Aws\Exception\CredentialsException;
use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\ConnectException;
use Illuminate\Auth\AuthenticationException; use Illuminate\Auth\AuthenticationException;
use League\Flysystem\UnableToCreateDirectory; use League\Flysystem\UnableToCreateDirectory;
@ -34,7 +36,6 @@ use Symfony\Component\Console\Exception\CommandNotFoundException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException; use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
use InvalidArgumentException;
class Handler extends ExceptionHandler class Handler extends ExceptionHandler
{ {
@ -64,7 +65,7 @@ class Handler extends ExceptionHandler
ConnectException::class, ConnectException::class,
RuntimeException::class, RuntimeException::class,
InvalidArgumentException::class, InvalidArgumentException::class,
Aws\Exception\CredentialsException::class, CredentialsException::class,
]; ];
protected $hostedDontReport = [ protected $hostedDontReport = [

View File

@ -14,7 +14,7 @@ namespace App\Exceptions;
use Exception; use Exception;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\JsonResponse;
class PaymentRefundFailed extends Exception class PaymentRefundFailed extends Exception
{ {
@ -32,14 +32,14 @@ class PaymentRefundFailed extends Exception
* Render the exception into an HTTP response. * Render the exception into an HTTP response.
* *
* @param Request $request * @param Request $request
* @return Response * @return JsonResponse
*/ */
public function render($request) public function render($request)
{ {
// $msg = 'Unable to refund the transaction'; // $msg = 'Unable to refund the transaction';
$msg = ctrans('texts.warning_local_refund'); $msg = ctrans('texts.warning_local_refund');
if ($this->getMessage() && strlen($this->getMessage()) >= 1) { if ($this->getMessage() && strlen($this->getMessage()) > 1) {
$msg = $this->getMessage(); $msg = $this->getMessage();
} }

View File

@ -14,7 +14,7 @@ namespace App\Exceptions;
use Exception; use Exception;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\JsonResponse;
class QuoteConversion extends Exception class QuoteConversion extends Exception
{ {
@ -32,7 +32,7 @@ class QuoteConversion extends Exception
* Render the exception into an HTTP response. * Render the exception into an HTTP response.
* *
* @param Request $request * @param Request $request
* @return Response * @return JsonResponse
*/ */
public function render($request) public function render($request)
{ {

View File

@ -14,7 +14,7 @@ namespace App\Exceptions;
use Exception; use Exception;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\JsonResponse;
class YodleeApiException extends Exception class YodleeApiException extends Exception
{ {
@ -32,14 +32,14 @@ class YodleeApiException extends Exception
* Render the exception into an HTTP response. * Render the exception into an HTTP response.
* *
* @param Request $request * @param Request $request
* @return Response * @return JsonResponse
*/ */
public function render($request) public function render($request)
{ {
// $msg = 'Unable to refund the transaction'; // $msg = 'Unable to refund the transaction';
$msg = ctrans('texts.error'); $msg = ctrans('texts.error');
if ($this->getMessage() && strlen($this->getMessage()) >= 1) { if ($this->getMessage() && strlen($this->getMessage()) > 1) {
$msg = $this->getMessage(); $msg = $this->getMessage();
} }

View File

@ -131,8 +131,8 @@ class TaskFilters extends QueryFilters
$status_parameters = explode(',', $value); $status_parameters = explode(',', $value);
if(count($status_parameters) > 0) if(count($status_parameters) >= 1)
return $this->builder->whereIn('status_id', $this->transformKeys($status_parameters)); $this->builder->whereIn('status_id', $this->transformKeys($status_parameters));
return $this->builder; return $this->builder;
} }

View File

@ -11,6 +11,7 @@
namespace App\Models; namespace App\Models;
use App\Models\GatewayType;
use App\Utils\Traits\AppSetup; use App\Utils\Traits\AppSetup;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use App\Utils\Traits\MakesDates; use App\Utils\Traits\MakesDates;
@ -26,6 +27,9 @@ use App\Models\Presenters\ClientPresenter;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use App\Utils\Traits\ClientGroupSettingsSaver; use App\Utils\Traits\ClientGroupSettingsSaver;
use App\Libraries\Currency\Conversion\CurrencyApi; use App\Libraries\Currency\Conversion\CurrencyApi;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Contracts\Translation\HasLocalePreference; use Illuminate\Contracts\Translation\HasLocalePreference;
/** /**
@ -303,62 +307,62 @@ class Client extends BaseModel implements HasLocalePreference
return $this->hasMany(Activity::class)->take(50)->orderBy('id', 'desc'); return $this->hasMany(Activity::class)->take(50)->orderBy('id', 'desc');
} }
public function contacts() public function contacts() :HasMany
{ {
return $this->hasMany(ClientContact::class)->orderBy('is_primary', 'desc'); return $this->hasMany(ClientContact::class)->orderBy('is_primary', 'desc');
} }
public function primary_contact() public function primary_contact():HasMany
{ {
return $this->hasMany(ClientContact::class)->where('is_primary', true); return $this->hasMany(ClientContact::class)->where('is_primary', true);
} }
public function company() public function company() :BelongsTo
{ {
return $this->belongsTo(Company::class); return $this->belongsTo(Company::class);
} }
public function user() public function user() :BelongsTo
{ {
return $this->belongsTo(User::class)->withTrashed(); return $this->belongsTo(User::class)->withTrashed();
} }
public function assigned_user() public function assigned_user() :BelongsTo
{ {
return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed(); return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed();
} }
public function country() public function country() :BelongsTo
{ {
return $this->belongsTo(Country::class); return $this->belongsTo(Country::class);
} }
public function invoices() public function invoices() :HasMany
{ {
return $this->hasMany(Invoice::class)->withTrashed(); return $this->hasMany(Invoice::class)->withTrashed();
} }
public function quotes() public function quotes() :HasMany
{ {
return $this->hasMany(Quote::class)->withTrashed(); return $this->hasMany(Quote::class)->withTrashed();
} }
public function tasks() public function tasks() :HasMany
{ {
return $this->hasMany(Task::class)->withTrashed(); return $this->hasMany(Task::class)->withTrashed();
} }
public function payments() public function payments() :HasMany
{ {
return $this->hasMany(Payment::class)->withTrashed(); return $this->hasMany(Payment::class)->withTrashed();
} }
public function recurring_invoices() public function recurring_invoices() :HasMany
{ {
return $this->hasMany(RecurringInvoice::class)->withTrashed(); return $this->hasMany(RecurringInvoice::class)->withTrashed();
} }
public function recurring_expenses() public function recurring_expenses() :HasMany
{ {
return $this->hasMany(RecurringExpense::class)->withTrashed(); return $this->hasMany(RecurringExpense::class)->withTrashed();
} }
@ -368,12 +372,12 @@ class Client extends BaseModel implements HasLocalePreference
return $this->belongsTo(Country::class, 'shipping_country_id', 'id'); return $this->belongsTo(Country::class, 'shipping_country_id', 'id');
} }
public function system_logs() public function system_logs() :HasMany
{ {
return $this->hasMany(SystemLog::class)->take(50)->orderBy('id', 'desc'); return $this->hasMany(SystemLog::class)->take(50)->orderBy('id', 'desc');
} }
public function timezone() public function timezone() :TimeZone
{ {
return Timezone::find($this->getSetting('timezone_id')); return Timezone::find($this->getSetting('timezone_id'));
} }
@ -391,17 +395,17 @@ class Client extends BaseModel implements HasLocalePreference
})->first(); })->first();
} }
public function industry() public function industry() :BelongsTo
{ {
return $this->belongsTo(Industry::class); return $this->belongsTo(Industry::class);
} }
public function size() public function size() :BelongsTo
{ {
return $this->belongsTo(Size::class); return $this->belongsTo(Size::class);
} }
public function locale() public function locale() :string
{ {
if (! $this->language()) { if (! $this->language()) {
return 'en'; return 'en';
@ -472,7 +476,7 @@ class Client extends BaseModel implements HasLocalePreference
* @param string $setting The Setting parameter * @param string $setting The Setting parameter
* @return mixed The setting requested * @return mixed The setting requested
*/ */
public function getSetting($setting) public function getSetting($setting) :mixed
{ {
/*Client Settings*/ /*Client Settings*/
if ($this->settings && property_exists($this->settings, $setting) && isset($this->settings->{$setting})) { if ($this->settings && property_exists($this->settings, $setting) && isset($this->settings->{$setting})) {
@ -502,7 +506,6 @@ class Client extends BaseModel implements HasLocalePreference
return ''; return '';
// throw new \Exception("Settings corrupted", 1);
} }
public function getSettingEntity($setting) public function getSettingEntity($setting)
@ -528,12 +531,12 @@ class Client extends BaseModel implements HasLocalePreference
throw new \Exception('Could not find a settings object', 1); throw new \Exception('Could not find a settings object', 1);
} }
public function documents() public function documents() :MorphMany
{ {
return $this->morphMany(Document::class, 'documentable'); return $this->morphMany(Document::class, 'documentable');
} }
public function group_settings() public function group_settings() :BelongsTo
{ {
return $this->belongsTo(GroupSetting::class); return $this->belongsTo(GroupSetting::class);
} }
@ -656,7 +659,7 @@ class Client extends BaseModel implements HasLocalePreference
} }
} }
public function getCurrencyCode() public function getCurrencyCode(): string
{ {
if ($this->currency()) { if ($this->currency()) {
return $this->currency()->code; return $this->currency()->code;
@ -697,51 +700,51 @@ class Client extends BaseModel implements HasLocalePreference
})->first()->locale; })->first()->locale;
} }
public function backup_path() public function backup_path() :string
{ {
return $this->company->company_key.'/'.$this->client_hash.'/backups'; return $this->company->company_key.'/'.$this->client_hash.'/backups';
} }
public function invoice_filepath($invitation) public function invoice_filepath($invitation) :string
{ {
$contact_key = $invitation->contact->contact_key; $contact_key = $invitation->contact->contact_key;
return $this->company->company_key.'/'.$this->client_hash.'/'.$contact_key.'/invoices/'; return $this->company->company_key.'/'.$this->client_hash.'/'.$contact_key.'/invoices/';
} }
public function e_invoice_filepath($invitation) public function e_invoice_filepath($invitation) :string
{ {
$contact_key = $invitation->contact->contact_key; $contact_key = $invitation->contact->contact_key;
return $this->company->company_key.'/'.$this->client_hash.'/'.$contact_key.'/e_invoice/'; return $this->company->company_key.'/'.$this->client_hash.'/'.$contact_key.'/e_invoice/';
} }
public function quote_filepath($invitation) public function quote_filepath($invitation) :string
{ {
$contact_key = $invitation->contact->contact_key; $contact_key = $invitation->contact->contact_key;
return $this->company->company_key.'/'.$this->client_hash.'/'.$contact_key.'/quotes/'; return $this->company->company_key.'/'.$this->client_hash.'/'.$contact_key.'/quotes/';
} }
public function credit_filepath($invitation) public function credit_filepath($invitation) :string
{ {
$contact_key = $invitation->contact->contact_key; $contact_key = $invitation->contact->contact_key;
return $this->company->company_key.'/'.$this->client_hash.'/'.$contact_key.'/credits/'; return $this->company->company_key.'/'.$this->client_hash.'/'.$contact_key.'/credits/';
} }
public function recurring_invoice_filepath($invitation) public function recurring_invoice_filepath($invitation) :string
{ {
$contact_key = $invitation->contact->contact_key; $contact_key = $invitation->contact->contact_key;
return $this->company->company_key.'/'.$this->client_hash.'/'.$contact_key.'/recurring_invoices/'; return $this->company->company_key.'/'.$this->client_hash.'/'.$contact_key.'/recurring_invoices/';
} }
public function company_filepath() public function company_filepath() :string
{ {
return $this->company->company_key.'/'; return $this->company->company_key.'/';
} }
public function document_filepath() public function document_filepath() :string
{ {
return $this->company->company_key.'/documents/'; return $this->company->company_key.'/documents/';
} }
@ -772,7 +775,7 @@ class Client extends BaseModel implements HasLocalePreference
return $defaults; return $defaults;
} }
public function timezone_offset() public function timezone_offset() :int
{ {
$offset = 0; $offset = 0;
@ -802,7 +805,7 @@ class Client extends BaseModel implements HasLocalePreference
]; ];
} }
public function translate_entity() public function translate_entity() :string
{ {
return ctrans('texts.client'); return ctrans('texts.client');
} }

View File

@ -8,5 +8,6 @@ parameters:
- 'vendor/' - 'vendor/'
- 'app/Jobs/Ninja/*' - 'app/Jobs/Ninja/*'
- 'app/Console/Commands/*' - 'app/Console/Commands/*'
- 'app/DataMapper/Analytics/*'
universalObjectCratesClasses: universalObjectCratesClasses:
- App\DataMapper\Tax\RuleInterface - App\DataMapper\Tax\RuleInterface