Static analysis

This commit is contained in:
David Bomba 2025-04-23 13:27:03 +10:00
parent 09f1eb634c
commit 0c68bbe594
10 changed files with 33 additions and 32 deletions

View File

@ -1 +1 @@
5.11.69
5.11.70

View File

@ -40,6 +40,8 @@ class BaseTransformer
{
protected $company;
public array $error_array = [];
public function __construct($company)
{
$this->company = $company;

View File

@ -39,12 +39,8 @@ class InvoiceTransformer extends BaseTransformer
'sent' => Invoice::STATUS_SENT,
'draft' => Invoice::STATUS_DRAFT,
'paid' => Invoice::STATUS_PAID,
1 => Invoice::STATUS_PAID,
'1' => Invoice::STATUS_PAID,
0 => Invoice::STATUS_SENT,
'0' => Invoice::STATUS_SENT,
true => Invoice::STATUS_PAID,
false => Invoice::STATUS_SENT,
'true' => Invoice::STATUS_PAID,
'false' => Invoice::STATUS_SENT,
'' => Invoice::STATUS_SENT,

View File

@ -34,6 +34,8 @@ class QuotesTable extends Component
public string $db;
public string $sort_field = 'date';
public function mount()
{
MultiDB::setDb($this->db);

View File

@ -147,24 +147,25 @@ class BlockonomicsPaymentDriver extends BaseDriver
return $this->payment_method->refund($payment, $amount); //this is your custom implementation from here
}
public function testNewAddressGen($crypto = 'btc', $response): string
{
$api_key = $this->company_gateway->getConfigField('apiKey');
$new_address_reset_url = $this->NEW_ADDRESS_URL . '?reset=1';
$new_address_response = Http::withToken($api_key)
->post($new_address_reset_url, []);
if ($new_address_response->response_code != 200) {
return isset($new_address_response->response_message) && $new_address_response->response_message
? $new_address_response->response_message
: 'Could not generate new address';
}
//dead code? //2025-04-23
// public function testNewAddressGen($crypto = 'btc', $response): string
// {
// $api_key = $this->company_gateway->getConfigField('apiKey');
// $new_address_reset_url = $this->NEW_ADDRESS_URL . '?reset=1';
// $new_address_response = Http::withToken($api_key)
// ->post($new_address_reset_url, []);
// if ($new_address_response->response_code != 200) {
// return isset($new_address_response->response_message) && $new_address_response->response_message
// ? $new_address_response->response_message
// : 'Could not generate new address';
// }
if (empty($new_address_response->address)) {
return 'No address returned from Blockonomics API';
}
// if (empty($new_address_response->address)) {
// return 'No address returned from Blockonomics API';
// }
return 'ok';
}
// return 'ok';
// }
public function checkStores($stores): string
{

View File

@ -34,9 +34,7 @@ class Statement
use MakesHash;
use MakesDates;
/**
* @var ?Invoice
*/
/** @var Invoice|null */
protected $entity;
private array $variables = [];
@ -216,7 +214,7 @@ class Statement
$this->client->settings = $settings;
$this->entity = \App\Models\Invoice::factory()->make(); //@phpstan-ignore-line
$this->entity->client =$this->client;
$this->entity->client =$this->client;//@phpstan-ignore-line
$ii = \App\Models\InvoiceInvitation::factory()->make(); //@phpstan-ignore-line
$ii->setRelation('invoice', $this->entity); //@phpstan-ignore-line
$ii->setRelation('contact', $this->client->contacts->first()); //@phpstan-ignore-line

View File

@ -595,7 +595,7 @@ class Mutator implements MutatorInterface
//Regardless, always include the client email address as a route - Storecove will only use this as a fallback.
$client_email = $this->getIndividualEmailRoute();
if(strlen($client_email ?? '') > 2)
if(strlen($client_email) > 2)
$this->setEmailRouting($client_email);
$code = $this->getClientRoutingCode();

View File

@ -1651,7 +1651,7 @@ class PdfBuilder
]],
['element' => 'tr', 'properties' => [], 'elements' => [
['element' => 'th', 'properties' => [], 'content' => ctrans('texts.statement_date')],
['element' => 'th', 'properties' => [], 'content' => $s_date ?? ''],
['element' => 'th', 'properties' => [], 'content' => $s_date],
]],
['element' => 'tr', 'properties' => [], 'elements' => [
['element' => 'th', 'properties' => [], 'content' => '$balance_due_label'],

View File

@ -64,7 +64,7 @@ class ProjectReport extends BaseExport
$user_name = $user ? $user->present()->name() : '';
$query = \App\Models\Project::with(['invoices','expenses','tasks'])
->where('company_id', $this->company->id);
->where('company_id', $this->company->id);
$projects = &$this->input['projects'];
@ -95,16 +95,18 @@ class ProjectReport extends BaseExport
$ts = new TemplateService();
/** @var Project $_project */
$_project = $query->first();
$ts_instance = $ts->setCompany($this->company)
// ->setData($data)
->processData($data)
->setRawTemplate(file_get_contents(resource_path($this->template)))
->addGlobal(['currency_code' => $query->first()->client->company->currency()->code])
->addGlobal(['currency_code' => $_project->client->company->currency()->code])
->setGlobals()
->parseNinjaBlocks()
->save();
nlog($ts_instance->getHtml());
return $ts_instance->getPdf();
}

View File

@ -17,8 +17,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION', '5.11.69'),
'app_tag' => env('APP_TAG', '5.11.69'),
'app_version' => env('APP_VERSION', '5.11.70'),
'app_tag' => env('APP_TAG', '5.11.70'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),