1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Static analysis cleanup

This commit is contained in:
David Bomba 2023-04-26 20:24:10 +10:00
parent df49ab9aec
commit d8da1f8fea
3 changed files with 5 additions and 30 deletions

View File

@ -108,9 +108,9 @@ class InvoiceItemSum
$this->line_items = []; $this->line_items = [];
} }
public function process() public function process(): self
{ {
if (! $this->invoice->line_items || ! is_array($this->invoice->line_items) || count($this->invoice->line_items) == 0) { if (!$this->invoice->line_items || !is_array($this->invoice->line_items)) {
$this->items = []; $this->items = [];
return $this; return $this;
@ -121,7 +121,7 @@ class InvoiceItemSum
return $this; return $this;
} }
private function calcLineItems() private function calcLineItems(): self
{ {
foreach ($this->invoice->line_items as $this->item) { foreach ($this->invoice->line_items as $this->item) {
$this->cleanLineItem() $this->cleanLineItem()

View File

@ -16,6 +16,7 @@ use App\Utils\Number;
use App\Models\Credit; use App\Models\Credit;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\PurchaseOrder; use App\Models\PurchaseOrder;
use App\Models\RecurringQuote;
use App\Models\RecurringInvoice; use App\Models\RecurringInvoice;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use App\Utils\Traits\NumberFormatter; use App\Utils\Traits\NumberFormatter;
@ -27,7 +28,7 @@ class InvoiceSum
use Discounter; use Discounter;
use NumberFormatter; use NumberFormatter;
protected RecurringInvoice | Invoice | Quote | Credit | PurchaseOrder $invoice; protected RecurringInvoice | Invoice | Quote | Credit | PurchaseOrder | RecurringQuote $invoice;
public $tax_map; public $tax_map;

View File

@ -99,9 +99,6 @@ class SelfUpdateController extends BaseController
nlog('Extracting zip'); nlog('Extracting zip');
//clean up old snappdf installations
//$this->cleanOldSnapChromeBinaries();
$zipFile = new \PhpZip\ZipFile(); $zipFile = new \PhpZip\ZipFile();
$zipFile->openFile($file); $zipFile->openFile($file);
@ -144,29 +141,6 @@ class SelfUpdateController extends BaseController
return response()->json(['message' => 'Update completed'], 200); return response()->json(['message' => 'Update completed'], 200);
} }
private function cleanOldSnapChromeBinaries()
{
$current_revision = base_path('vendor/beganovich/snappdf/versions/revision.txt');
$current_revision_text = file_get_contents($current_revision);
$iterator = new \DirectoryIterator(base_path('vendor/beganovich/snappdf/versions'));
foreach ($iterator as $file) {
if ($file->isDir() && ! $file->isDot() && ($current_revision_text != $file->getFileName())) {
$directoryIterator = new \RecursiveDirectoryIterator(base_path('vendor/beganovich/snappdf/versions/'.$file->getFileName()), \RecursiveDirectoryIterator::SKIP_DOTS);
foreach (new \RecursiveIteratorIterator($directoryIterator) as $filex) {
unlink($filex->getPathName());
}
$this->deleteDirectory(base_path('vendor/beganovich/snappdf/versions/'.$file->getFileName()));
}
}
$iterator = null;
}
private function deleteDirectory($dir) private function deleteDirectory($dir)
{ {
if (! file_exists($dir)) { if (! file_exists($dir)) {