mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
Implement PHP CS Fixer and a coding standard to follow (#471)
* Create PHP CS Fixer config and add to CI workflow * Run php cs fixer on project * Add newline at end of file * Update to use PHP CS Fixer v3 * Run v3 config on project * Run seperate config in CI
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Crater\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Carbon\Carbon;
|
||||
use Crater\Models\Estimate;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class CheckEstimateStatus extends Command
|
||||
{
|
||||
@ -39,7 +40,7 @@ class CheckEstimateStatus extends Command
|
||||
public function handle()
|
||||
{
|
||||
$date = Carbon::now();
|
||||
$status = array(Estimate::STATUS_ACCEPTED, Estimate::STATUS_REJECTED, Estimate::STATUS_EXPIRED);
|
||||
$status = [Estimate::STATUS_ACCEPTED, Estimate::STATUS_REJECTED, Estimate::STATUS_EXPIRED];
|
||||
$estimates = Estimate::whereNotIn('status', $status)->whereDate('expiry_date', '<', $date)->get();
|
||||
|
||||
foreach ($estimates as $estimate) {
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Crater\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Carbon\Carbon;
|
||||
use Crater\Models\Invoice;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class CheckInvoiceStatus extends Command
|
||||
{
|
||||
@ -39,7 +40,7 @@ class CheckInvoiceStatus extends Command
|
||||
public function handle()
|
||||
{
|
||||
$date = Carbon::now();
|
||||
$invoices = Invoice::where('status', '<>', Invoice::STATUS_COMPLETED)->whereDate('due_date', '<',$date)->get();
|
||||
$invoices = Invoice::where('status', '<>', Invoice::STATUS_COMPLETED)->whereDate('due_date', '<', $date)->get();
|
||||
|
||||
foreach ($invoices as $invoice) {
|
||||
$invoice->status = Invoice::STATUS_OVERDUE;
|
||||
|
||||
@ -5,7 +5,6 @@ namespace Crater\Console\Commands;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Console\ConfirmableTrait;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class ResetApp extends Command
|
||||
{
|
||||
@ -42,7 +41,7 @@ class ResetApp extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (!$this->confirmToProceed()) {
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Crater\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Crater\Space\Updater;
|
||||
use Crater\Models\Setting;
|
||||
use Crater\Space\Updater;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
// Implementation taken from Akaunting - https://github.com/akaunting/akaunting
|
||||
class UpdateCommand extends Command
|
||||
@ -57,42 +57,43 @@ class UpdateCommand extends Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->version) {
|
||||
if (! $this->version) {
|
||||
$this->info('No Update Available! You are already on the latest version.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->confirm("Do you wish to update to {$this->version}?")) {
|
||||
if (! $this->confirm("Do you wish to update to {$this->version}?")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$path = $this->download()) {
|
||||
if (! $path = $this->download()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$path = $this->unzip($path)) {
|
||||
if (! $path = $this->unzip($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->copyFiles($path)) {
|
||||
if (! $this->copyFiles($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(isset($this->response->deleted_files) && !empty($this->response->deleted_files)) {
|
||||
if (!$this->deleteFiles($this->response->deleted_files)) {
|
||||
if (isset($this->response->deleted_files) && ! empty($this->response->deleted_files)) {
|
||||
if (! $this->deleteFiles($this->response->deleted_files)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->migrateUpdate()) {
|
||||
if (! $this->migrateUpdate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->finish()) {
|
||||
if (! $this->finish()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->info('Successfully updated to ' . $this->version);
|
||||
$this->info('Successfully updated to '.$this->version);
|
||||
}
|
||||
|
||||
public function getInstalledVersion()
|
||||
@ -102,7 +103,7 @@ class UpdateCommand extends Command
|
||||
|
||||
public function getLatestVersionResponse()
|
||||
{
|
||||
$this->info('Your currently installed version is ' . $this->installed);
|
||||
$this->info('Your currently installed version is '.$this->installed);
|
||||
$this->line('');
|
||||
$this->info('Checking for update...');
|
||||
|
||||
@ -110,14 +111,12 @@ class UpdateCommand extends Command
|
||||
$response = Updater::checkForUpdate($this->installed);
|
||||
|
||||
if ($response->success) {
|
||||
|
||||
$extensions = $response->version->extensions;
|
||||
|
||||
$is_required = false;
|
||||
|
||||
foreach ($extensions as $key => $extension) {
|
||||
|
||||
if(!$extension) {
|
||||
if (! $extension) {
|
||||
$is_required = true;
|
||||
$this->info('❌ '.$key);
|
||||
}
|
||||
@ -125,7 +124,7 @@ class UpdateCommand extends Command
|
||||
$this->info('✅ '.$key);
|
||||
}
|
||||
|
||||
if($is_required) {
|
||||
if ($is_required) {
|
||||
return 'extension_required';
|
||||
}
|
||||
|
||||
@ -146,8 +145,9 @@ class UpdateCommand extends Command
|
||||
|
||||
try {
|
||||
$path = Updater::download($this->version, 1);
|
||||
if (!is_string($path)) {
|
||||
if (! is_string($path)) {
|
||||
$this->error('Download exception');
|
||||
|
||||
return false;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@ -165,8 +165,9 @@ class UpdateCommand extends Command
|
||||
|
||||
try {
|
||||
$path = Updater::unzip($path);
|
||||
if (!is_string($path)) {
|
||||
if (! is_string($path)) {
|
||||
$this->error('Unzipping exception');
|
||||
|
||||
return false;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
Reference in New Issue
Block a user