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:
parent
df49ab9aec
commit
d8da1f8fea
@ -108,9 +108,9 @@ class InvoiceItemSum
|
||||
$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 = [];
|
||||
|
||||
return $this;
|
||||
@ -121,7 +121,7 @@ class InvoiceItemSum
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function calcLineItems()
|
||||
private function calcLineItems(): self
|
||||
{
|
||||
foreach ($this->invoice->line_items as $this->item) {
|
||||
$this->cleanLineItem()
|
||||
|
@ -16,6 +16,7 @@ use App\Utils\Number;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\RecurringQuote;
|
||||
use App\Models\RecurringInvoice;
|
||||
use Illuminate\Support\Collection;
|
||||
use App\Utils\Traits\NumberFormatter;
|
||||
@ -27,7 +28,7 @@ class InvoiceSum
|
||||
use Discounter;
|
||||
use NumberFormatter;
|
||||
|
||||
protected RecurringInvoice | Invoice | Quote | Credit | PurchaseOrder $invoice;
|
||||
protected RecurringInvoice | Invoice | Quote | Credit | PurchaseOrder | RecurringQuote $invoice;
|
||||
|
||||
public $tax_map;
|
||||
|
||||
|
@ -99,9 +99,6 @@ class SelfUpdateController extends BaseController
|
||||
|
||||
nlog('Extracting zip');
|
||||
|
||||
//clean up old snappdf installations
|
||||
//$this->cleanOldSnapChromeBinaries();
|
||||
|
||||
$zipFile = new \PhpZip\ZipFile();
|
||||
|
||||
$zipFile->openFile($file);
|
||||
@ -144,29 +141,6 @@ class SelfUpdateController extends BaseController
|
||||
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)
|
||||
{
|
||||
if (! file_exists($dir)) {
|
||||
|
Loading…
Reference in New Issue
Block a user