1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Static Analysis

This commit is contained in:
David Bomba 2024-11-02 11:25:28 +11:00
parent ef3864b85b
commit 432f85f223
12 changed files with 41 additions and 43 deletions

View File

@ -23,7 +23,7 @@ class EInvoiceTokenController extends BaseController
/** @var \App\Models\Company $company */ /** @var \App\Models\Company $company */
$company = auth()->user()->company(); $company = auth()->user()->company();
$company->e_invoicing_token = $request->get('token'); // $company->e_invoicing_token = $request->get('token');
$company->save(); $company->save();
return response()->noContent(); return response()->noContent();

View File

@ -416,7 +416,7 @@ class Company extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document> * @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/ */
public function documents() public function documents()
{ {

View File

@ -268,9 +268,9 @@ class Credit extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<CompanyLedger> * @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/ */
public function company_ledger(): \Illuminate\Database\Eloquent\Relations\MorphMany public function company_ledger()
{ {
return $this->morphMany(CompanyLedger::class, 'company_ledgerable'); return $this->morphMany(CompanyLedger::class, 'company_ledgerable');
} }
@ -290,17 +290,17 @@ class Credit extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany<Payment> * @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/ */
public function payments(): \Illuminate\Database\Eloquent\Relations\MorphToMany public function payments()
{ {
return $this->morphToMany(Payment::class, 'paymentable'); return $this->morphToMany(Payment::class, 'paymentable');
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document> * @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/ */
public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany public function documents()
{ {
return $this->morphMany(Document::class, 'documentable'); return $this->morphMany(Document::class, 'documentable');
} }

View File

@ -166,9 +166,6 @@ class Expense extends BaseModel
return self::class; return self::class;
} }
/**
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document>
*/
public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany
{ {
return $this->morphMany(Document::class, 'documentable'); return $this->morphMany(Document::class, 'documentable');

View File

@ -102,7 +102,7 @@ class GroupSetting extends StaticModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document> * @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/ */
public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany
{ {

View File

@ -292,7 +292,7 @@ class Invoice extends BaseModel
// } // }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<Company> * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/ */
public function company() public function company()
{ {
@ -345,7 +345,7 @@ class Invoice extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document> * @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/ */
public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany
{ {
@ -353,7 +353,7 @@ class Invoice extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany<Payment> * @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/ */
public function payments(): \Illuminate\Database\Eloquent\Relations\MorphToMany public function payments(): \Illuminate\Database\Eloquent\Relations\MorphToMany
{ {
@ -361,7 +361,7 @@ class Invoice extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany<Payment> * @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/ */
public function net_payments(): \Illuminate\Database\Eloquent\Relations\MorphToMany public function net_payments(): \Illuminate\Database\Eloquent\Relations\MorphToMany
{ {
@ -369,7 +369,7 @@ class Invoice extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<CompanyLedger> * @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/ */
public function company_ledger(): \Illuminate\Database\Eloquent\Relations\MorphMany public function company_ledger(): \Illuminate\Database\Eloquent\Relations\MorphMany
{ {
@ -382,7 +382,7 @@ class Invoice extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<Backup> * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/ */
public function history(): \Illuminate\Database\Eloquent\Relations\HasManyThrough public function history(): \Illuminate\Database\Eloquent\Relations\HasManyThrough
{ {
@ -400,7 +400,7 @@ class Invoice extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\HasOne<Task> * @return \Illuminate\Database\Eloquent\Relations\HasOne
*/ */
public function task(): \Illuminate\Database\Eloquent\Relations\HasOne public function task(): \Illuminate\Database\Eloquent\Relations\HasOne
{ {
@ -408,7 +408,7 @@ class Invoice extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\HasOne<Quote> * @return \Illuminate\Database\Eloquent\Relations\HasOne
*/ */
public function quote(): \Illuminate\Database\Eloquent\Relations\HasOne public function quote(): \Illuminate\Database\Eloquent\Relations\HasOne
{ {
@ -421,7 +421,7 @@ class Invoice extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\HasOne<Expense> * @return \Illuminate\Database\Eloquent\Relations\HasOne
*/ */
public function expense(): \Illuminate\Database\Eloquent\Relations\HasOne public function expense(): \Illuminate\Database\Eloquent\Relations\HasOne
{ {

View File

@ -219,7 +219,7 @@ class Payment extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany<Paymentable> * @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/ */
public function invoices(): \Illuminate\Database\Eloquent\Relations\MorphToMany public function invoices(): \Illuminate\Database\Eloquent\Relations\MorphToMany
{ {
@ -227,7 +227,7 @@ class Payment extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany<Paymentable> * @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/ */
public function credits(): \Illuminate\Database\Eloquent\Relations\MorphToMany public function credits(): \Illuminate\Database\Eloquent\Relations\MorphToMany
{ {
@ -235,7 +235,7 @@ class Payment extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<CompanyLedger> * @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/ */
public function company_ledger(): \Illuminate\Database\Eloquent\Relations\MorphMany public function company_ledger(): \Illuminate\Database\Eloquent\Relations\MorphMany
{ {

View File

@ -227,7 +227,7 @@ class Quote extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<Backup> * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/ */
public function history(): \Illuminate\Database\Eloquent\Relations\HasManyThrough public function history(): \Illuminate\Database\Eloquent\Relations\HasManyThrough
{ {
@ -270,7 +270,7 @@ class Quote extends BaseModel
} }
/** /**
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document> * @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/ */
public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany
{ {

View File

@ -95,11 +95,13 @@ class StorecoveAdapter
//configure identifiers //configure identifiers
//set additional identifier if required (ie de => FR with FR vat) //set additional identifier if required (ie de => FR with FR vat)
return $this;
} }
public function validate(): self public function validate(): self
{ {
return $this->valid_document; // $this->valid_document
return $this;
} }
public function getInvoice(): Invoice public function getInvoice(): Invoice

View File

@ -16,7 +16,7 @@ class StorecoveRouter
/** /**
* Provides a country matrix for the correct scheme to send via * Provides a country matrix for the correct scheme to send via
* *
* @var mixed $routing_rules * @var array $routing_rules
**/ **/
private array $routing_rules = [ private array $routing_rules = [
"US" => [ "US" => [

View File

@ -34,7 +34,7 @@ class StorecoveTransformer implements TransformerInterface
return $this; return $this;
} }
public function getInvoice($s_invoice): StorecoveInvoice public function getInvoice(): StorecoveInvoice
{ {
return $this->s_invoice; return $this->s_invoice;
} }
@ -42,6 +42,7 @@ class StorecoveTransformer implements TransformerInterface
public function createNewStorecoveInvoice(): self public function createNewStorecoveInvoice(): self
{ {
$this->s_invoice = (new \ReflectionClass(StorecoveInvoice::class))->newInstanceWithoutConstructor(); $this->s_invoice = (new \ReflectionClass(StorecoveInvoice::class))->newInstanceWithoutConstructor();
return $this;
} }
//$invoice = inbound peppol //$invoice = inbound peppol
@ -166,11 +167,6 @@ class StorecoveTransformer implements TransformerInterface
return $doc; return $doc;
} }
public function getInvoice(): StorecoveInvoice
{
return $this->s_invoice;
}
public function toJson(): string public function toJson(): string
{ {
return json_encode($this->s_invoice, JSON_PRETTY_PRINT); return json_encode($this->s_invoice, JSON_PRETTY_PRINT);

View File

@ -60,16 +60,19 @@ class SendEDocument implements ShouldQueue
$result = $storecove->build($model); $result = $storecove->build($model);
// $xml = $p->toXml(); /**************************** Legacy */
$xml = $p->toXml();
// $payload = [ $payload = [
// 'legal_entity_id' => $model->company->legal_entity_id, 'legal_entity_id' => $model->company->legal_entity_id,
// 'document' => base64_encode($xml), 'document' => base64_encode($xml),
// 'tenant_id' => $model->company->company_key, 'tenant_id' => $model->company->company_key,
// 'identifiers' => $identifiers, 'identifiers' => $identifiers,
// // 'e_invoicing_token' => $model->company->e_invoicing_token, // 'e_invoicing_token' => $model->company->e_invoicing_token,
// // include whitelabel key. // include whitelabel key.
// ]; ];
/**************************** Legacy */
$r = Http::withHeaders($this->getHeaders()) $r = Http::withHeaders($this->getHeaders())
->post(config('ninja.hosted_ninja_url')."/api/einvoice/submission", $payload); ->post(config('ninja.hosted_ninja_url')."/api/einvoice/submission", $payload);