Static Analysis

This commit is contained in:
David Bomba 2024-06-09 15:56:05 +10:00
parent cf35c30bfc
commit f7bd62d84a
6 changed files with 37 additions and 9 deletions

View File

@ -412,6 +412,7 @@ class Client extends BaseModel implements HasLocalePreference
public function date_format() public function date_format()
{ {
/** @var \Illuminate\Support\Collection $date_formats */
$date_formats = app('date_formats'); $date_formats = app('date_formats');
// $date_formats = Cache::get('date_formats'); // $date_formats = Cache::get('date_formats');
@ -428,6 +429,8 @@ class Client extends BaseModel implements HasLocalePreference
public function currency() public function currency()
{ {
/** @var \Illuminate\Support\Collection $currencies */
$currencies = app('currencies'); $currencies = app('currencies');
// $currencies = Cache::get('currencies'); // $currencies = Cache::get('currencies');

View File

@ -319,6 +319,7 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
*/ */
public function processTokenPayment($request, array $response) { public function processTokenPayment($request, array $response) {
/** @var \App\Models\ClientGatewayToken $cgt */
$cgt = ClientGatewayToken::where('client_id', $this->client->id) $cgt = ClientGatewayToken::where('client_id', $this->client->id)
->where('token', $request['token']) ->where('token', $request['token'])
->firstOrFail(); ->firstOrFail();

View File

@ -295,7 +295,7 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
*/ */
public function processTokenPayment($request, array $response) { public function processTokenPayment($request, array $response) {
/** @car \App\Models\ClientGatwayToken $cgt */ /** @var \App\Models\ClientGatewayToken $cgt */
$cgt = ClientGatewayToken::where('client_id', $this->client->id) $cgt = ClientGatewayToken::where('client_id', $this->client->id)
->where('token', $request['token']) ->where('token', $request['token'])
->firstOrFail(); ->firstOrFail();

View File

@ -75,7 +75,7 @@ class WePayPaymentDriver extends BaseDriver
* Setup the gateway * Setup the gateway
* *
* @param array $data user_id + company * @param array $data user_id + company
* @return \Illuminate\View\View * @return void
*/ */
public function setup(array $data) public function setup(array $data)
{ {

View File

@ -26,9 +26,15 @@ class OrderXDocument extends AbstractService
{ {
public OrderDocumentBuilder $orderxdocument; public OrderDocumentBuilder $orderxdocument;
/** @var \App\Models\Invoice | \App\Models\Quote | \App\Models\PurchaseOrder | \App\Models\Credit $document */ /**
* __construct
public function __construct(public mixed $document, private readonly bool $returnObject = false, private array $tax_map = []) *
* @param \App\Models\Invoice | \App\Models\Quote | \App\Models\PurchaseOrder | \App\Models\Credit $document
* @param bool $returnObject
* @param array $tax_map
* @return void
*/
public function __construct(public \App\Models\Invoice | \App\Models\Quote | \App\Models\PurchaseOrder | \App\Models\Credit $document, private readonly bool $returnObject = false, private array $tax_map = [])
{ {
} }
@ -36,7 +42,6 @@ class OrderXDocument extends AbstractService
{ {
$company = $this->document->company; $company = $this->document->company;
/** @var \App\Models\Client | \App\Models\Vendor $settings_entity */
$settings_entity = ($this->document instanceof PurchaseOrder) ? $this->document->vendor : $this->document->client; $settings_entity = ($this->document instanceof PurchaseOrder) ? $this->document->vendor : $this->document->client;
$profile = $settings_entity->getSetting('e_quote_type') ? $settings_entity->getSetting('e_quote_type') : "OrderX_Extended"; $profile = $settings_entity->getSetting('e_quote_type') ? $settings_entity->getSetting('e_quote_type') : "OrderX_Extended";
@ -176,7 +181,17 @@ class OrderXDocument extends AbstractService
} }
} }
$this->orderxdocument->setDocumentSummation($this->document->amount, $this->document->balance, $invoicing_data->getSubTotal(), $invoicing_data->getTotalSurcharges(), $invoicing_data->getTotalDiscount(), $invoicing_data->getSubTotal(), $invoicing_data->getItemTotalTaxes(), 0.0, $this->document->amount - $this->document->balance); $this->orderxdocument->setDocumentSummation(
$this->document->amount,
$this->document->balance,
$invoicing_data->getSubTotal(),
$invoicing_data->getTotalSurcharges(),
// $invoicing_data->getTotalDiscount(),
$invoicing_data->getSubTotal(),
$invoicing_data->getItemTotalTaxes(),
// 0.0,
// ($this->document->amount - $this->document->balance)
);
foreach ($this->tax_map as $item) { foreach ($this->tax_map as $item) {
$this->orderxdocument->addDocumentTax($item["tax_type"], "VAT", $item["net_amount"], $item["tax_rate"] * $item["net_amount"], $item["tax_rate"] * 100); $this->orderxdocument->addDocumentTax($item["tax_type"], "VAT", $item["net_amount"], $item["tax_rate"] * $item["net_amount"], $item["tax_rate"] * 100);

View File

@ -25,7 +25,16 @@ class ZugferdEDokument extends AbstractService
{ {
public ZugferdDocumentBuilder $xdocument; public ZugferdDocumentBuilder $xdocument;
public function __construct(public object $document, private readonly bool $returnObject = false, private array $tax_map = [])
/**
* __construct
*
* \App\Models\Invoice | \App\Models\Quote | \App\Models\PurchaseOrder | \App\Models\Credit $document
* @param bool $returnObject
* @param array $tax_map
* @return void
*/
public function __construct(public \App\Models\Invoice | \App\Models\Quote | \App\Models\PurchaseOrder | \App\Models\Credit $document, private readonly bool $returnObject = false, private array $tax_map = [])
{ {
} }